Linux 5.0-rc6
Unified · Split
| @@ -72,6 +72,10 @@ ForEachMacros: · 71 unmodified lines | |||
| 72 | - 'apei_estatus_for_each_section' | 72 | - 'apei_estatus_for_each_section' |
| 73 | - 'ata_for_each_dev' | 73 | - 'ata_for_each_dev' |
| 74 | - 'ata_for_each_link' | 74 | - 'ata_for_each_link' |
| 75 | - '__ata_qc_for_each' | ||
| 76 | - 'ata_qc_for_each' | ||
| 77 | - 'ata_qc_for_each_raw' | ||
| 78 | - 'ata_qc_for_each_with_internal' | ||
| 75 | - 'ax25_for_each' | 79 | - 'ax25_for_each' |
| 76 | - 'ax25_uid_for_each' | 80 | - 'ax25_uid_for_each' |
| 77 | - 'bio_for_each_integrity_vec' | 81 | - 'bio_for_each_integrity_vec' |
| @@ -85,6 +89,7 @@ ForEachMacros: · 7 unmodified lines | |||
| 85 | - 'blk_queue_for_each_rl' | 89 | - 'blk_queue_for_each_rl' |
| 86 | - 'bond_for_each_slave' | 90 | - 'bond_for_each_slave' |
| 87 | - 'bond_for_each_slave_rcu' | 91 | - 'bond_for_each_slave_rcu' |
| 92 | - 'bpf_for_each_spilled_reg' | ||
| 88 | - 'btree_for_each_safe128' | 93 | - 'btree_for_each_safe128' |
| 89 | - 'btree_for_each_safe32' | 94 | - 'btree_for_each_safe32' |
| 90 | - 'btree_for_each_safe64' | 95 | - 'btree_for_each_safe64' |
| @@ -103,6 +108,8 @@ ForEachMacros: · 12 unmodified lines | |||
| 103 | - 'drm_atomic_crtc_for_each_plane' | 108 | - 'drm_atomic_crtc_for_each_plane' |
| 104 | - 'drm_atomic_crtc_state_for_each_plane' | 109 | - 'drm_atomic_crtc_state_for_each_plane' |
| 105 | - 'drm_atomic_crtc_state_for_each_plane_state' | 110 | - 'drm_atomic_crtc_state_for_each_plane_state' |
| 111 | - 'drm_atomic_for_each_plane_damage' | ||
| 112 | - 'drm_connector_for_each_possible_encoder' | ||
| 106 | - 'drm_for_each_connector_iter' | 113 | - 'drm_for_each_connector_iter' |
| 107 | - 'drm_for_each_crtc' | 114 | - 'drm_for_each_crtc' |
| 108 | - 'drm_for_each_encoder' | 115 | - 'drm_for_each_encoder' |
| @@ -121,11 +128,21 @@ ForEachMacros: · 12 unmodified lines | |||
| 121 | - 'for_each_bio' | 128 | - 'for_each_bio' |
| 122 | - 'for_each_board_func_rsrc' | 129 | - 'for_each_board_func_rsrc' |
| 123 | - 'for_each_bvec' | 130 | - 'for_each_bvec' |
| 131 | - 'for_each_card_components' | ||
| 132 | - 'for_each_card_links' | ||
| 133 | - 'for_each_card_links_safe' | ||
| 134 | - 'for_each_card_prelinks' | ||
| 135 | - 'for_each_card_rtds' | ||
| 136 | - 'for_each_card_rtds_safe' | ||
| 137 | - 'for_each_cgroup_storage_type' | ||
| 124 | - 'for_each_child_of_node' | 138 | - 'for_each_child_of_node' |
| 125 | - 'for_each_clear_bit' | 139 | - 'for_each_clear_bit' |
| 126 | - 'for_each_clear_bit_from' | 140 | - 'for_each_clear_bit_from' |
| 127 | - 'for_each_cmsghdr' | 141 | - 'for_each_cmsghdr' |
| 128 | - 'for_each_compatible_node' | 142 | - 'for_each_compatible_node' |
| 143 | - 'for_each_component_dais' | ||
| 144 | - 'for_each_component_dais_safe' | ||
| 145 | - 'for_each_comp_order' | ||
| 129 | - 'for_each_console' | 146 | - 'for_each_console' |
| 130 | - 'for_each_cpu' | 147 | - 'for_each_cpu' |
| 131 | - 'for_each_cpu_and' | 148 | - 'for_each_cpu_and' |
| @@ -133,6 +150,10 @@ ForEachMacros: · 1 unmodified line | |||
| 133 | - 'for_each_cpu_wrap' | 150 | - 'for_each_cpu_wrap' |
| 134 | - 'for_each_dev_addr' | 151 | - 'for_each_dev_addr' |
| 135 | - 'for_each_dma_cap_mask' | 152 | - 'for_each_dma_cap_mask' |
| 153 | - 'for_each_dpcm_be' | ||
| 154 | - 'for_each_dpcm_be_rollback' | ||
| 155 | - 'for_each_dpcm_be_safe' | ||
| 156 | - 'for_each_dpcm_fe' | ||
| 136 | - 'for_each_drhd_unit' | 157 | - 'for_each_drhd_unit' |
| 137 | - 'for_each_dss_dev' | 158 | - 'for_each_dss_dev' |
| 138 | - 'for_each_efi_memory_desc' | 159 | - 'for_each_efi_memory_desc' |
| @@ -149,6 +170,7 @@ ForEachMacros: · 10 unmodified lines | |||
| 149 | - 'for_each_iommu' | 170 | - 'for_each_iommu' |
| 150 | - 'for_each_ip_tunnel_rcu' | 171 | - 'for_each_ip_tunnel_rcu' |
| 151 | - 'for_each_irq_nr' | 172 | - 'for_each_irq_nr' |
| 173 | - 'for_each_link_codecs' | ||
| 152 | - 'for_each_lru' | 174 | - 'for_each_lru' |
| 153 | - 'for_each_matching_node' | 175 | - 'for_each_matching_node' |
| 154 | - 'for_each_matching_node_and_match' | 176 | - 'for_each_matching_node_and_match' |
| @@ -160,6 +182,7 @@ ForEachMacros: · 5 unmodified lines | |||
| 160 | - 'for_each_mem_range_rev' | 182 | - 'for_each_mem_range_rev' |
| 161 | - 'for_each_migratetype_order' | 183 | - 'for_each_migratetype_order' |
| 162 | - 'for_each_msi_entry' | 184 | - 'for_each_msi_entry' |
| 185 | - 'for_each_msi_entry_safe' | ||
| 163 | - 'for_each_net' | 186 | - 'for_each_net' |
| 164 | - 'for_each_netdev' | 187 | - 'for_each_netdev' |
| 165 | - 'for_each_netdev_continue' | 188 | - 'for_each_netdev_continue' |
| @@ -183,12 +206,14 @@ ForEachMacros: · 17 unmodified lines | |||
| 183 | - 'for_each_node_with_property' | 206 | - 'for_each_node_with_property' |
| 184 | - 'for_each_of_allnodes' | 207 | - 'for_each_of_allnodes' |
| 185 | - 'for_each_of_allnodes_from' | 208 | - 'for_each_of_allnodes_from' |
| 209 | - 'for_each_of_cpu_node' | ||
| 186 | - 'for_each_of_pci_range' | 210 | - 'for_each_of_pci_range' |
| 187 | - 'for_each_old_connector_in_state' | 211 | - 'for_each_old_connector_in_state' |
| 188 | - 'for_each_old_crtc_in_state' | 212 | - 'for_each_old_crtc_in_state' |
| 189 | - 'for_each_oldnew_connector_in_state' | 213 | - 'for_each_oldnew_connector_in_state' |
| 190 | - 'for_each_oldnew_crtc_in_state' | 214 | - 'for_each_oldnew_crtc_in_state' |
| 191 | - 'for_each_oldnew_plane_in_state' | 215 | - 'for_each_oldnew_plane_in_state' |
| 216 | - 'for_each_oldnew_plane_in_state_reverse' | ||
| 192 | - 'for_each_oldnew_private_obj_in_state' | 217 | - 'for_each_oldnew_private_obj_in_state' |
| 193 | - 'for_each_old_plane_in_state' | 218 | - 'for_each_old_plane_in_state' |
| 194 | - 'for_each_old_private_obj_in_state' | 219 | - 'for_each_old_private_obj_in_state' |
| @@ -206,14 +231,17 @@ ForEachMacros: · 11 unmodified lines | |||
| 206 | - 'for_each_process' | 231 | - 'for_each_process' |
| 207 | - 'for_each_process_thread' | 232 | - 'for_each_process_thread' |
| 208 | - 'for_each_property_of_node' | 233 | - 'for_each_property_of_node' |
| 234 | - 'for_each_registered_fb' | ||
| 209 | - 'for_each_reserved_mem_region' | 235 | - 'for_each_reserved_mem_region' |
| 210 | - 'for_each_resv_unavail_range' | 236 | - 'for_each_rtd_codec_dai' |
| 237 | - 'for_each_rtd_codec_dai_rollback' | ||
| 211 | - 'for_each_rtdcom' | 238 | - 'for_each_rtdcom' |
| 212 | - 'for_each_rtdcom_safe' | 239 | - 'for_each_rtdcom_safe' |
| 213 | - 'for_each_set_bit' | 240 | - 'for_each_set_bit' |
| 214 | - 'for_each_set_bit_from' | 241 | - 'for_each_set_bit_from' |
| 215 | - 'for_each_sg' | 242 | - 'for_each_sg' |
| 216 | - 'for_each_sg_page' | 243 | - 'for_each_sg_page' |
| 244 | - 'for_each_sibling_event' | ||
| 217 | - '__for_each_thread' | 245 | - '__for_each_thread' |
| 218 | - 'for_each_thread' | 246 | - 'for_each_thread' |
| 219 | - 'for_each_zone' | 247 | - 'for_each_zone' |
| @@ -251,6 +279,8 @@ ForEachMacros: · 31 unmodified lines | |||
| 251 | - 'hlist_nulls_for_each_entry_from' | 279 | - 'hlist_nulls_for_each_entry_from' |
| 252 | - 'hlist_nulls_for_each_entry_rcu' | 280 | - 'hlist_nulls_for_each_entry_rcu' |
| 253 | - 'hlist_nulls_for_each_entry_safe' | 281 | - 'hlist_nulls_for_each_entry_safe' |
| 282 | - 'i3c_bus_for_each_i2cdev' | ||
| 283 | - 'i3c_bus_for_each_i3cdev' | ||
| 254 | - 'ide_host_for_each_port' | 284 | - 'ide_host_for_each_port' |
| 255 | - 'ide_port_for_each_dev' | 285 | - 'ide_port_for_each_dev' |
| 256 | - 'ide_port_for_each_present_dev' | 286 | - 'ide_port_for_each_present_dev' |
| @@ -267,11 +297,14 @@ ForEachMacros: · 10 unmodified lines | |||
| 267 | - 'kvm_for_each_memslot' | 297 | - 'kvm_for_each_memslot' |
| 268 | - 'kvm_for_each_vcpu' | 298 | - 'kvm_for_each_vcpu' |
| 269 | - 'list_for_each' | 299 | - 'list_for_each' |
| 300 | - 'list_for_each_codec' | ||
| 301 | - 'list_for_each_codec_safe' | ||
| 270 | - 'list_for_each_entry' | 302 | - 'list_for_each_entry' |
| 271 | - 'list_for_each_entry_continue' | 303 | - 'list_for_each_entry_continue' |
| 272 | - 'list_for_each_entry_continue_rcu' | 304 | - 'list_for_each_entry_continue_rcu' |
| 273 | - 'list_for_each_entry_continue_reverse' | 305 | - 'list_for_each_entry_continue_reverse' |
| 274 | - 'list_for_each_entry_from' | 306 | - 'list_for_each_entry_from' |
| 307 | - 'list_for_each_entry_from_rcu' | ||
| 275 | - 'list_for_each_entry_from_reverse' | 308 | - 'list_for_each_entry_from_reverse' |
| 276 | - 'list_for_each_entry_lockless' | 309 | - 'list_for_each_entry_lockless' |
| 277 | - 'list_for_each_entry_rcu' | 310 | - 'list_for_each_entry_rcu' |
| @@ -291,6 +324,7 @@ ForEachMacros: · 13 unmodified lines | |||
| 291 | - 'media_device_for_each_intf' | 324 | - 'media_device_for_each_intf' |
| 292 | - 'media_device_for_each_link' | 325 | - 'media_device_for_each_link' |
| 293 | - 'media_device_for_each_pad' | 326 | - 'media_device_for_each_pad' |
| 327 | - 'nanddev_io_for_each_page' | ||
| 294 | - 'netdev_for_each_lower_dev' | 328 | - 'netdev_for_each_lower_dev' |
| 295 | - 'netdev_for_each_lower_private' | 329 | - 'netdev_for_each_lower_private' |
| 296 | - 'netdev_for_each_lower_private_rcu' | 330 | - 'netdev_for_each_lower_private_rcu' |
| @@ -357,12 +391,14 @@ ForEachMacros: · 60 unmodified lines | |||
| 357 | - 'sk_nulls_for_each' | 391 | - 'sk_nulls_for_each' |
| 358 | - 'sk_nulls_for_each_from' | 392 | - 'sk_nulls_for_each_from' |
| 359 | - 'sk_nulls_for_each_rcu' | 393 | - 'sk_nulls_for_each_rcu' |
| 394 | - 'snd_array_for_each' | ||
| 360 | - 'snd_pcm_group_for_each_entry' | 395 | - 'snd_pcm_group_for_each_entry' |
| 361 | - 'snd_soc_dapm_widget_for_each_path' | 396 | - 'snd_soc_dapm_widget_for_each_path' |
| 362 | - 'snd_soc_dapm_widget_for_each_path_safe' | 397 | - 'snd_soc_dapm_widget_for_each_path_safe' |
| 363 | - 'snd_soc_dapm_widget_for_each_sink_path' | 398 | - 'snd_soc_dapm_widget_for_each_sink_path' |
| 364 | - 'snd_soc_dapm_widget_for_each_source_path' | 399 | - 'snd_soc_dapm_widget_for_each_source_path' |
| 365 | - 'tb_property_for_each' | 400 | - 'tb_property_for_each' |
| 401 | - 'tcf_exts_for_each_action' | ||
| 366 | - 'udp_portaddr_for_each_entry' | 402 | - 'udp_portaddr_for_each_entry' |
| 367 | - 'udp_portaddr_for_each_entry_rcu' | 403 | - 'udp_portaddr_for_each_entry_rcu' |
| 368 | - 'usb_hub_for_each_child' | 404 | - 'usb_hub_for_each_child' |
| @@ -371,6 +407,11 @@ ForEachMacros: · 2 unmodified lines | |||
| 371 | - 'v4l2_m2m_for_each_dst_buf_safe' | 407 | - 'v4l2_m2m_for_each_dst_buf_safe' |
| 372 | - 'v4l2_m2m_for_each_src_buf' | 408 | - 'v4l2_m2m_for_each_src_buf' |
| 373 | - 'v4l2_m2m_for_each_src_buf_safe' | 409 | - 'v4l2_m2m_for_each_src_buf_safe' |
| 410 | - 'virtio_device_for_each_vq' | ||
| 411 | - 'xa_for_each' | ||
| 412 | - 'xas_for_each' | ||
| 413 | - 'xas_for_each_conflict' | ||
| 414 | - 'xas_for_each_marked' | ||
| 374 | - 'zorro_for_each_dev' | 415 | - 'zorro_for_each_dev' |
| 375 | 416 | ||
| 376 | #IncludeBlocks: Preserve # Unknown to clang-format-5.0 | 417 | #IncludeBlocks: Preserve # Unknown to clang-format-5.0 |
| @@ -24,7 +24,7 @@ What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/ · 23 unmodified lines | |||
| 24 | cpld3_version | 24 | cpld3_version |
| 25 | 25 | ||
| 26 | Date: November 2018 | 26 | Date: November 2018 |
| 27 | KernelVersion: 4.21 | 27 | KernelVersion: 5.0 |
| 28 | Contact: Vadim Pasternak <vadimpmellanox.com> | 28 | Contact: Vadim Pasternak <vadimpmellanox.com> |
| 29 | Description: These files show with which CPLD versions have been burned | 29 | Description: These files show with which CPLD versions have been burned |
| 30 | on LED board. | 30 | on LED board. |
| @@ -35,7 +35,7 @@ What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/ · 4 unmodified lines | |||
| 35 | jtag_enable | 35 | jtag_enable |
| 36 | 36 | ||
| 37 | Date: November 2018 | 37 | Date: November 2018 |
| 38 | KernelVersion: 4.21 | 38 | KernelVersion: 5.0 |
| 39 | Contact: Vadim Pasternak <vadimpmellanox.com> | 39 | Contact: Vadim Pasternak <vadimpmellanox.com> |
| 40 | Description: These files enable and disable the access to the JTAG domain. | 40 | Description: These files enable and disable the access to the JTAG domain. |
| 41 | By default access to the JTAG domain is disabled. | 41 | By default access to the JTAG domain is disabled. |
| @@ -105,7 +105,7 @@ What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/ · 63 unmodified lines | |||
| 105 | reset_voltmon_upgrade_fail | 105 | reset_voltmon_upgrade_fail |
| 106 | 106 | ||
| 107 | Date: November 2018 | 107 | Date: November 2018 |
| 108 | KernelVersion: 4.21 | 108 | KernelVersion: 5.0 |
| 109 | Contact: Vadim Pasternak <vadimpmellanox.com> | 109 | Contact: Vadim Pasternak <vadimpmellanox.com> |
| 110 | Description: These files show the system reset cause, as following: ComEx | 110 | Description: These files show the system reset cause, as following: ComEx |
| 111 | power fail, reset from ComEx, system platform reset, reset | 111 | power fail, reset from ComEx, system platform reset, reset |
| @@ -279,3 +279,12 @@ Description: · 278 unmodified lines | |||
| 279 | size in 512B sectors of the zones of the device, with | 279 | size in 512B sectors of the zones of the device, with |
| 280 | the eventual exception of the last zone of the device | 280 | the eventual exception of the last zone of the device |
| 281 | which may be smaller. | 281 | which may be smaller. |
| 282 | |||
| 283 | What: /sys/block/<disk>/queue/io_timeout | ||
| 284 | Date: November 2018 | ||
| 285 | Contact: Weiping Zhang <zhangweiping@didiglobal.com> | ||
| 286 | Description: | ||
| 287 | io_timeout is the request timeout in milliseconds. If a request | ||
| 288 | does not complete in this time then the block driver timeout | ||
| 289 | handler is invoked. That timeout handler can decide to retry | ||
| 290 | the request, to fail it or to start a device recovery strategy. | ||
| @@ -122,11 +122,18 @@ Description: · 121 unmodified lines | |||
| 122 | statistics (bd_count, bd_reads, bd_writes) in a format | 122 | statistics (bd_count, bd_reads, bd_writes) in a format |
| 123 | similar to block layer statistics file format. | 123 | similar to block layer statistics file format. |
| 124 | 124 | ||
| 125 | What: /sys/block/zram<id>/writeback_limit_enable | ||
| 126 | Date: November 2018 | ||
| 127 | Contact: Minchan Kim <minchan@kernel.org> | ||
| 128 | Description: | ||
| 129 | The writeback_limit_enable file is read-write and specifies | ||
| 130 | eanbe of writeback_limit feature. "1" means eable the feature. | ||
| 131 | No limit "0" is the initial state. | ||
| 132 | |||
| 125 | What: /sys/block/zram<id>/writeback_limit | 133 | What: /sys/block/zram<id>/writeback_limit |
| 126 | Date: November 2018 | 134 | Date: November 2018 |
| 127 | Contact: Minchan Kim <minchan@kernel.org> | 135 | Contact: Minchan Kim <minchan@kernel.org> |
| 128 | Description: | 136 | Description: |
| 129 | The writeback_limit file is read-write and specifies the maximum | 137 | The writeback_limit file is read-write and specifies the maximum |
| 130 | amount of writeback ZRAM can do. The limit could be changed | 138 | amount of writeback ZRAM can do. The limit could be changed |
| 131 | in run time and "0" means disable the limit. | 139 | in run time. |
| 132 | No limit is the initial state. | ||
| @@ -1696,12 +1696,11 @@ · 1695 unmodified lines | |||
| 1696 | By default, super page will be supported if Intel IOMMU | 1696 | By default, super page will be supported if Intel IOMMU |
| 1697 | has the capability. With this option, super page will | 1697 | has the capability. With this option, super page will |
| 1698 | not be supported. | 1698 | not be supported. |
| 1699 | sm_off [Default Off] | 1699 | sm_on [Default Off] |
| 1700 | By default, scalable mode will be supported if the | 1700 | By default, scalable mode will be disabled even if the |
| 1701 | hardware advertises that it has support for the scalable | 1701 | hardware advertises that it has support for the scalable |
| 1702 | mode translation. With this option set, scalable mode | 1702 | mode translation. With this option set, scalable mode |
| 1703 | will not be used even on hardware which claims to support | 1703 | will be used on hardware which claims to support it. |
| 1704 | it. | ||
| 1705 | tboot_noforce [Default Off] | 1704 | tboot_noforce [Default Off] |
| 1706 | Do not force the Intel IOMMU enabled under tboot. | 1705 | Do not force the Intel IOMMU enabled under tboot. |
| 1707 | By default, tboot will force Intel IOMMU on, which | 1706 | By default, tboot will force Intel IOMMU on, which |
| @@ -357,6 +357,13 @@ video playing/streaming, a very low drop rate may be more important · 356 unmodified lines | |||
| 357 | than maximum throughput. In these cases, consider setting the | 357 | than maximum throughput. In these cases, consider setting the |
| 358 | strict_guarantees parameter. | 358 | strict_guarantees parameter. |
| 359 | 359 | ||
| 360 | slice_idle_us | ||
| 361 | ------------- | ||
| 362 | |||
| 363 | Controls the same tuning parameter as slice_idle, but in microseconds. | ||
| 364 | Either tunable can be used to set idling behavior. Afterwards, the | ||
| 365 | other tunable will reflect the newly set value in sysfs. | ||
| 366 | |||
| 360 | strict_guarantees | 367 | strict_guarantees |
| 361 | ----------------- | 368 | ----------------- |
| 362 | 369 | ||
| @@ -88,7 +88,8 @@ shared_tags=[0/1]: Default: 0 · 87 unmodified lines | |||
| 88 | 88 | ||
| 89 | zoned=[0/1]: Default: 0 | 89 | zoned=[0/1]: Default: 0 |
| 90 | 0: Block device is exposed as a random-access block device. | 90 | 0: Block device is exposed as a random-access block device. |
| 91 | 1: Block device is exposed as a host-managed zoned block device. | 91 | 1: Block device is exposed as a host-managed zoned block device. Requires |
| 92 | CONFIG_BLK_DEV_ZONED. | ||
| 92 | 93 | ||
| 93 | zone_size=[MB]: Default: 256 | 94 | zone_size=[MB]: Default: 256 |
| 94 | Per zone size when exposed as a zoned block device. Must be a power of two. | 95 | Per zone size when exposed as a zoned block device. Must be a power of two. |
| @@ -67,6 +67,13 @@ If set to a value larger than 0, the kernel will put the process issuing · 66 unmodified lines | |||
| 67 | IO to sleep for this amount of microseconds before entering classic | 67 | IO to sleep for this amount of microseconds before entering classic |
| 68 | polling. | 68 | polling. |
| 69 | 69 | ||
| 70 | io_timeout (RW) | ||
| 71 | --------------- | ||
| 72 | io_timeout is the request timeout in milliseconds. If a request does not | ||
| 73 | complete in this time then the block driver timeout handler is invoked. | ||
| 74 | That timeout handler can decide to retry the request, to fail it or to start | ||
| 75 | a device recovery strategy. | ||
| 76 | |||
| 70 | iostats (RW) | 77 | iostats (RW) |
| 71 | ------------- | 78 | ------------- |
| 72 | This file is used to control (on/off) the iostats accounting of the | 79 | This file is used to control (on/off) the iostats accounting of the |
| @@ -156,22 +156,23 @@ Per-device statistics are exported as various nodes under /sys/block/zram<id>/ · 155 unmodified lines | |||
| 156 | A brief description of exported device attributes. For more details please | 156 | A brief description of exported device attributes. For more details please |
| 157 | read Documentation/ABI/testing/sysfs-block-zram. | 157 | read Documentation/ABI/testing/sysfs-block-zram. |
| 158 | 158 | ||
| 159 | Name access description | 159 | Name access description |
| 160 | ---- ------ ----------- | 160 | ---- ------ ----------- |
| 161 | disksize RW show and set the device's disk size | 161 | disksize RW show and set the device's disk size |
| 162 | initstate RO shows the initialization state of the device | 162 | initstate RO shows the initialization state of the device |
| 163 | reset WO trigger device reset | 163 | reset WO trigger device reset |
| 164 | mem_used_max WO reset the `mem_used_max' counter (see later) | 164 | mem_used_max WO reset the `mem_used_max' counter (see later) |
| 165 | mem_limit WO specifies the maximum amount of memory ZRAM can use | 165 | mem_limit WO specifies the maximum amount of memory ZRAM can use |
| 166 | to store the compressed data | 166 | to store the compressed data |
| 167 | writeback_limit WO specifies the maximum amount of write IO zram can | 167 | writeback_limit WO specifies the maximum amount of write IO zram can |
| 168 | write out to backing device as 4KB unit | 168 | write out to backing device as 4KB unit |
| 169 | max_comp_streams RW the number of possible concurrent compress operations | 169 | writeback_limit_enable RW show and set writeback_limit feature |
| 170 | comp_algorithm RW show and change the compression algorithm | 170 | max_comp_streams RW the number of possible concurrent compress operations |
| 171 | compact WO trigger memory compaction | 171 | comp_algorithm RW show and change the compression algorithm |
| 172 | debug_stat RO this file is used for zram debugging purposes | 172 | compact WO trigger memory compaction |
| 173 | backing_dev RW set up backend storage for zram to write out | 173 | debug_stat RO this file is used for zram debugging purposes |
| 174 | idle WO mark allocated slot as idle | 174 | backing_dev RW set up backend storage for zram to write out |
| 175 | idle WO mark allocated slot as idle | ||
| 175 | 176 | ||
| 176 | 177 | ||
| 177 | User space is advised to use the following files to read the device statistics. | 178 | User space is advised to use the following files to read the device statistics. |
| @@ -280,32 +281,51 @@ With the command, zram writeback idle pages from memory to the storage. · 102 unmodified lines | |||
| 280 | If there are lots of write IO with flash device, potentially, it has | 281 | If there are lots of write IO with flash device, potentially, it has |
| 281 | flash wearout problem so that admin needs to design write limitation | 282 | flash wearout problem so that admin needs to design write limitation |
| 282 | to guarantee storage health for entire product life. | 283 | to guarantee storage health for entire product life. |
| 283 | To overcome the concern, zram supports "writeback_limit". | 284 | |
| 284 | The "writeback_limit"'s default value is 0 so that it doesn't limit | 285 | To overcome the concern, zram supports "writeback_limit" feature. |
| 285 | any writeback. If admin want to measure writeback count in a certain | 286 | The "writeback_limit_enable"'s default value is 0 so that it doesn't limit |
| 286 | period, he could know it via /sys/block/zram0/bd_stat's 3rd column. | 287 | any writeback. IOW, if admin want to apply writeback budget, he should |
| 288 | enable writeback_limit_enable via | ||
| 289 | |||
| 290 | $ echo 1 > /sys/block/zramX/writeback_limit_enable | ||
| 291 | |||
| 292 | Once writeback_limit_enable is set, zram doesn't allow any writeback | ||
| 293 | until admin set the budget via /sys/block/zramX/writeback_limit. | ||
| 294 | |||
| 295 | (If admin doesn't enable writeback_limit_enable, writeback_limit's value | ||
| 296 | assigned via /sys/block/zramX/writeback_limit is meaninless.) | ||
| 287 | 297 | ||
| 288 | If admin want to limit writeback as per-day 400M, he could do it | 298 | If admin want to limit writeback as per-day 400M, he could do it |
| 289 | like below. | 299 | like below. |
| 290 | 300 | ||
| 291 | MB_SHIFT=20 | 301 | $ MB_SHIFT=20 |
| 292 | 4K_SHIFT=12 | 302 | $ 4K_SHIFT=12 |
| 293 | echo $((400<<MB_SHIFT>>4K_SHIFT)) > \ | 303 | $ echo $((400<<MB_SHIFT>>4K_SHIFT)) > \ |
| 294 | /sys/block/zram0/writeback_limit. | 304 | /sys/block/zram0/writeback_limit. |
| 305 | $ echo 1 > /sys/block/zram0/writeback_limit_enable | ||
| 295 | 306 | ||
| 296 | If admin want to allow further write again, he could do it like below | 307 | If admin want to allow further write again once the bugdet is exausted, |
| 308 | he could do it like below | ||
| 297 | 309 | ||
| 298 | echo 0 > /sys/block/zram0/writeback_limit | 310 | $ echo $((400<<MB_SHIFT>>4K_SHIFT)) > \ |
| 311 | /sys/block/zram0/writeback_limit | ||
| 299 | 312 | ||
| 300 | If admin want to see remaining writeback budget since he set, | 313 | If admin want to see remaining writeback budget since he set, |
| 301 | 314 | ||
| 302 | cat /sys/block/zram0/writeback_limit | 315 | $ cat /sys/block/zramX/writeback_limit |
| 316 | |||
| 317 | If admin want to disable writeback limit, he could do | ||
| 318 | |||
| 319 | $ echo 0 > /sys/block/zramX/writeback_limit_enable | ||
| 303 | 320 | ||
| 304 | The writeback_limit count will reset whenever you reset zram(e.g., | 321 | The writeback_limit count will reset whenever you reset zram(e.g., |
| 305 | system reboot, echo 1 > /sys/block/zramX/reset) so keeping how many of | 322 | system reboot, echo 1 > /sys/block/zramX/reset) so keeping how many of |
| 306 | writeback happened until you reset the zram to allocate extra writeback | 323 | writeback happened until you reset the zram to allocate extra writeback |
| 307 | budget in next setting is user's job. | 324 | budget in next setting is user's job. |
| 308 | 325 | ||
| 326 | If admin want to measure writeback count in a certain period, he could | ||
| 327 | know it via /sys/block/zram0/bd_stat's 3rd column. | ||
| 328 | |||
| 309 | = memory tracking | 329 | = memory tracking |
| 310 | 330 | ||
| 311 | With CONFIG_ZRAM_MEMORY_TRACKING, user can know information of the | 331 | With CONFIG_ZRAM_MEMORY_TRACKING, user can know information of the |
| @@ -157,12 +157,11 @@ Q: Does BPF have a stable ABI? · 156 unmodified lines | |||
| 157 | ------------------------------ | 157 | ------------------------------ |
| 158 | A: YES. BPF instructions, arguments to BPF programs, set of helper | 158 | A: YES. BPF instructions, arguments to BPF programs, set of helper |
| 159 | functions and their arguments, recognized return codes are all part | 159 | functions and their arguments, recognized return codes are all part |
| 160 | of ABI. However when tracing programs are using bpf_probe_read() helper | 160 | of ABI. However there is one specific exception to tracing programs |
| 161 | to walk kernel internal datastructures and compile with kernel | 161 | which are using helpers like bpf_probe_read() to walk kernel internal |
| 162 | internal headers these accesses can and will break with newer | 162 | data structures and compile with kernel internal headers. Both of these |
| 163 | kernels. The union bpf_attr -> kern_version is checked at load time | 163 | kernel internals are subject to change and can break with newer kernels |
| 164 | to prevent accidentally loading kprobe-based bpf programs written | 164 | such that the program needs to be adapted accordingly. |
| 165 | for a different kernel. Networking programs don't do kern_version check. | ||
| 166 | 165 | ||
| 167 | Q: How much stack space a BPF program uses? | 166 | Q: How much stack space a BPF program uses? |
| 168 | ------------------------------------------- | 167 | ------------------------------------------- |
| @@ -108,12 +108,13 @@ some, but not all of the other indices changing. · 107 unmodified lines | |||
| 108 | 108 | ||
| 109 | Sometimes you need to ensure that a subsequent call to :c:func:`xa_store` | 109 | Sometimes you need to ensure that a subsequent call to :c:func:`xa_store` |
| 110 | will not need to allocate memory. The :c:func:`xa_reserve` function | 110 | will not need to allocate memory. The :c:func:`xa_reserve` function |
| 111 | will store a reserved entry at the indicated index. Users of the normal | 111 | will store a reserved entry at the indicated index. Users of the |
| 112 | API will see this entry as containing ``NULL``. If you do not need to | 112 | normal API will see this entry as containing ``NULL``. If you do |
| 113 | use the reserved entry, you can call :c:func:`xa_release` to remove the | 113 | not need to use the reserved entry, you can call :c:func:`xa_release` |
| 114 | unused entry. If another user has stored to the entry in the meantime, | 114 | to remove the unused entry. If another user has stored to the entry |
| 115 | :c:func:`xa_release` will do nothing; if instead you want the entry to | 115 | in the meantime, :c:func:`xa_release` will do nothing; if instead you |
| 116 | become ``NULL``, you should use :c:func:`xa_erase`. | 116 | want the entry to become ``NULL``, you should use :c:func:`xa_erase`. |
| 117 | Using :c:func:`xa_insert` on a reserved entry will fail. | ||
| 117 | 118 | ||
| 118 | If all entries in the array are ``NULL``, the :c:func:`xa_empty` function | 119 | If all entries in the array are ``NULL``, the :c:func:`xa_empty` function |
| 119 | will return ``true``. | 120 | will return ``true``. |
| @@ -183,6 +184,8 @@ Takes xa_lock internally: · 63 unmodified lines | |||
| 183 | * :c:func:`xa_store_bh` | 184 | * :c:func:`xa_store_bh` |
| 184 | * :c:func:`xa_store_irq` | 185 | * :c:func:`xa_store_irq` |
| 185 | * :c:func:`xa_insert` | 186 | * :c:func:`xa_insert` |
| 187 | * :c:func:`xa_insert_bh` | ||
| 188 | * :c:func:`xa_insert_irq` | ||
| 186 | * :c:func:`xa_erase` | 189 | * :c:func:`xa_erase` |
| 187 | * :c:func:`xa_erase_bh` | 190 | * :c:func:`xa_erase_bh` |
| 188 | * :c:func:`xa_erase_irq` | 191 | * :c:func:`xa_erase_irq` |
| @@ -17,7 +17,11 @@ extra-y += $(DT_TMP_SCHEMA) · 16 unmodified lines | |||
| 17 | quiet_cmd_mk_schema = SCHEMA $@ | 17 | quiet_cmd_mk_schema = SCHEMA $@ |
| 18 | cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(filter-out FORCE, $^) | 18 | cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(filter-out FORCE, $^) |
| 19 | 19 | ||
| 20 | DT_DOCS = $(shell cd $(srctree)/$(src) && find * -name '*.yaml') | 20 | DT_DOCS = $(shell \ |
| 21 | cd $(srctree)/$(src) && \ | ||
| 22 | find * \( -name '*.yaml' ! -name $(DT_TMP_SCHEMA) \) \ | ||
| 23 | ) | ||
| 24 | |||
| 21 | DT_SCHEMA_FILES ?= $(addprefix $(src)/,$(DT_DOCS)) | 25 | DT_SCHEMA_FILES ?= $(addprefix $(src)/,$(DT_DOCS)) |
| 22 | 26 | ||
| 23 | extra-y += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) | 27 | extra-y += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) |
| @@ -235,4 +235,4 @@ cpus { · 234 unmodified lines | |||
| 235 | =========================================== | 235 | =========================================== |
| 236 | 236 | ||
| 237 | [1] ARM Linux Kernel documentation - CPUs bindings | 237 | [1] ARM Linux Kernel documentation - CPUs bindings |
| 238 | Documentation/devicetree/bindings/arm/cpus.txt | 238 | Documentation/devicetree/bindings/arm/cpus.yaml |
| @@ -684,7 +684,7 @@ cpus { · 683 unmodified lines | |||
| 684 | =========================================== | 684 | =========================================== |
| 685 | 685 | ||
| 686 | [1] ARM Linux Kernel documentation - CPUs bindings | 686 | [1] ARM Linux Kernel documentation - CPUs bindings |
| 687 | Documentation/devicetree/bindings/arm/cpus.txt | 687 | Documentation/devicetree/bindings/arm/cpus.yaml |
| 688 | 688 | ||
| 689 | [2] ARM Linux Kernel documentation - PSCI bindings | 689 | [2] ARM Linux Kernel documentation - PSCI bindings |
| 690 | Documentation/devicetree/bindings/arm/psci.txt | 690 | Documentation/devicetree/bindings/arm/psci.txt |
| @@ -4,7 +4,7 @@ SP810 System Controller · 3 unmodified lines | |||
| 4 | Required properties: | 4 | Required properties: |
| 5 | 5 | ||
| 6 | - compatible: standard compatible string for a Primecell peripheral, | 6 | - compatible: standard compatible string for a Primecell peripheral, |
| 7 | see Documentation/devicetree/bindings/arm/primecell.txt | 7 | see Documentation/devicetree/bindings/arm/primecell.yaml |
| 8 | for more details | 8 | for more details |
| 9 | should be: "arm,sp810", "arm,primecell" | 9 | should be: "arm,sp810", "arm,primecell" |
| 10 | 10 | ||
| @@ -472,4 +472,4 @@ cpus { · 471 unmodified lines | |||
| 472 | 472 | ||
| 473 | =============================================================================== | 473 | =============================================================================== |
| 474 | [1] ARM Linux kernel documentation | 474 | [1] ARM Linux kernel documentation |
| 475 | Documentation/devicetree/bindings/arm/cpus.txt | 475 | Documentation/devicetree/bindings/arm/cpus.yaml |
| @@ -18,4 +18,4 @@ Required Properties: · 17 unmodified lines | |||
| 18 | Each clock is assigned an identifier and client nodes use this identifier | 18 | Each clock is assigned an identifier and client nodes use this identifier |
| 19 | to specify the clock which they consume. | 19 | to specify the clock which they consume. |
| 20 | 20 | ||
| 21 | All these identifier could be found in <dt-bindings/clock/marvell-mmp2.h>. | 21 | All these identifiers could be found in <dt-bindings/clock/marvell,mmp2.h>. |
| @@ -1,6 +1,6 @@ | |||
| 1 | * ARM PrimeCell Color LCD Controller PL110/PL111 | 1 | * ARM PrimeCell Color LCD Controller PL110/PL111 |
| 2 | 2 | ||
| 3 | See also Documentation/devicetree/bindings/arm/primecell.txt | 3 | See also Documentation/devicetree/bindings/arm/primecell.yaml |
| 4 | 4 | ||
| 5 | Required properties: | 5 | Required properties: |
| 6 | 6 | ||
| @@ -27,7 +27,6 @@ Example: · 26 unmodified lines | |||
| 27 | reg = <0x04300000 0x20000>; | 27 | reg = <0x04300000 0x20000>; |
| 28 | reg-names = "kgsl_3d0_reg_memory"; | 28 | reg-names = "kgsl_3d0_reg_memory"; |
| 29 | interrupts = <GIC_SPI 80 0>; | 29 | interrupts = <GIC_SPI 80 0>; |
| 30 | interrupt-names = "kgsl_3d0_irq"; | ||
| 31 | clock-names = | 30 | clock-names = |
| 32 | "core", | 31 | "core", |
| 33 | "iface", | 32 | "iface", |
| @@ -14,8 +14,6 @@ Required properties: · 13 unmodified lines | |||
| 14 | 14 | ||
| 15 | "marvell,armada-8k-gpio" should be used for the Armada 7K and 8K | 15 | "marvell,armada-8k-gpio" should be used for the Armada 7K and 8K |
| 16 | SoCs (either from AP or CP), see | 16 | SoCs (either from AP or CP), see |
| 17 | Documentation/devicetree/bindings/arm/marvell/cp110-system-controller0.txt | ||
| 18 | and | ||
| 19 | Documentation/devicetree/bindings/arm/marvell/ap806-system-controller.txt | 17 | Documentation/devicetree/bindings/arm/marvell/ap806-system-controller.txt |
| 20 | for specific details about the offset property. | 18 | for specific details about the offset property. |
| 21 | 19 | ||
| @@ -78,7 +78,7 @@ Sub-nodes: · 77 unmodified lines | |||
| 78 | PPI affinity can be expressed as a single "ppi-partitions" node, | 78 | PPI affinity can be expressed as a single "ppi-partitions" node, |
| 79 | containing a set of sub-nodes, each with the following property: | 79 | containing a set of sub-nodes, each with the following property: |
| 80 | - affinity: Should be a list of phandles to CPU nodes (as described in | 80 | - affinity: Should be a list of phandles to CPU nodes (as described in |
| 81 | Documentation/devicetree/bindings/arm/cpus.txt). | 81 | Documentation/devicetree/bindings/arm/cpus.yaml). |
| 82 | 82 | ||
| 83 | GICv3 has one or more Interrupt Translation Services (ITS) that are | 83 | GICv3 has one or more Interrupt Translation Services (ITS) that are |
| 84 | used to route Message Signalled Interrupts (MSI) to the CPUs. | 84 | used to route Message Signalled Interrupts (MSI) to the CPUs. |
| @@ -1,7 +1,8 @@ | |||
| 1 | Altera SOCFPGA Reset Manager | 1 | Altera SOCFPGA Reset Manager |
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible : "altr,rst-mgr" | 4 | - compatible : "altr,rst-mgr" for (Cyclone5/Arria5/Arria10) |
| 5 | "altr,stratix10-rst-mgr","altr,rst-mgr" for Stratix10 ARM64 SoC | ||
| 5 | - reg : Should contain 1 register ranges(address and length) | 6 | - reg : Should contain 1 register ranges(address and length) |
| 6 | - altr,modrst-offset : Should contain the offset of the first modrst register. | 7 | - altr,modrst-offset : Should contain the offset of the first modrst register. |
| 7 | - #reset-cells: 1 | 8 | - #reset-cells: 1 |
| @@ -120,27 +120,30 @@ Example: · 119 unmodified lines | |||
| 120 | }; | 120 | }; |
| 121 | 121 | ||
| 122 | 122 | ||
| 123 | USB3 core reset | 123 | Peripheral core reset in glue layer |
| 124 | --------------- | 124 | ----------------------------------- |
| 125 | 125 | ||
| 126 | USB3 core reset belongs to USB3 glue layer. Before using the core reset, | 126 | Some peripheral core reset belongs to its own glue layer. Before using |
| 127 | it is necessary to control the clocks and resets to enable this layer. | 127 | this core reset, it is necessary to control the clocks and resets to enable |
| 128 | These clocks and resets should be described in each property. | 128 | this layer. These clocks and resets should be described in each property. |
| 129 | 129 | ||
| 130 | Required properties: | 130 | Required properties: |
| 131 | - compatible: Should be | 131 | - compatible: Should be |
| 132 | "socionext,uniphier-pro4-usb3-reset" - for Pro4 SoC | 132 | "socionext,uniphier-pro4-usb3-reset" - for Pro4 SoC USB3 |
| 133 | "socionext,uniphier-pxs2-usb3-reset" - for PXs2 SoC | 133 | "socionext,uniphier-pxs2-usb3-reset" - for PXs2 SoC USB3 |
| 134 | "socionext,uniphier-ld20-usb3-reset" - for LD20 SoC | 134 | "socionext,uniphier-ld20-usb3-reset" - for LD20 SoC USB3 |
| 135 | "socionext,uniphier-pxs3-usb3-reset" - for PXs3 SoC | 135 | "socionext,uniphier-pxs3-usb3-reset" - for PXs3 SoC USB3 |
| 136 | "socionext,uniphier-pro4-ahci-reset" - for Pro4 SoC AHCI | ||
| 137 | "socionext,uniphier-pxs2-ahci-reset" - for PXs2 SoC AHCI | ||
| 138 | "socionext,uniphier-pxs3-ahci-reset" - for PXs3 SoC AHCI | ||
| 136 | - #reset-cells: Should be 1. | 139 | - #reset-cells: Should be 1. |
| 137 | - reg: Specifies offset and length of the register set for the device. | 140 | - reg: Specifies offset and length of the register set for the device. |
| 138 | - clocks: A list of phandles to the clock gate for USB3 glue layer. | 141 | - clocks: A list of phandles to the clock gate for the glue layer. |
| 139 | According to the clock-names, appropriate clocks are required. | 142 | According to the clock-names, appropriate clocks are required. |
| 140 | - clock-names: Should contain | 143 | - clock-names: Should contain |
| 141 | "gio", "link" - for Pro4 SoC | 144 | "gio", "link" - for Pro4 SoC |
| 142 | "link" - for others | 145 | "link" - for others |
| 143 | - resets: A list of phandles to the reset control for USB3 glue layer. | 146 | - resets: A list of phandles to the reset control for the glue layer. |
| 144 | According to the reset-names, appropriate resets are required. | 147 | According to the reset-names, appropriate resets are required. |
| 145 | - reset-names: Should contain | 148 | - reset-names: Should contain |
| 146 | "gio", "link" - for Pro4 SoC | 149 | "gio", "link" - for Pro4 SoC |
| @@ -4,14 +4,10 @@ Required properties: · 3 unmodified lines | |||
| 4 | - compatible : "olpc,ap-sp" | 4 | - compatible : "olpc,ap-sp" |
| 5 | - reg : base address and length of SoC's WTM registers | 5 | - reg : base address and length of SoC's WTM registers |
| 6 | - interrupts : SP-AP interrupt | 6 | - interrupts : SP-AP interrupt |
| 7 | - clocks : phandle + clock-specifier for the clock that drives the WTM | ||
| 8 | - clock-names: should be "sp" | ||
| 9 | 7 | ||
| 10 | Example: | 8 | Example: |
| 11 | ap-sp@d4290000 { | 9 | ap-sp@d4290000 { |
| 12 | compatible = "olpc,ap-sp"; | 10 | compatible = "olpc,ap-sp"; |
| 13 | reg = <0xd4290000 0x1000>; | 11 | reg = <0xd4290000 0x1000>; |
| 14 | interrupts = <40>; | 12 | interrupts = <40>; |
| 15 | clocks = <&soc_clocks MMP2_CLK_SP>; | ||
| 16 | clock-names = "sp"; | ||
| 17 | } | 13 | } |
| @@ -55,7 +55,7 @@ of these nodes are defined by the individual bindings for the specific function · 54 unmodified lines | |||
| 55 | = EXAMPLE | 55 | = EXAMPLE |
| 56 | The following example represents the GLINK RPM node on a MSM8996 device, with | 56 | The following example represents the GLINK RPM node on a MSM8996 device, with |
| 57 | the function for the "rpm_request" channel defined, which is used for | 57 | the function for the "rpm_request" channel defined, which is used for |
| 58 | regualtors and root clocks. | 58 | regulators and root clocks. |
| 59 | 59 | ||
| 60 | apcs_glb: mailbox@9820000 { | 60 | apcs_glb: mailbox@9820000 { |
| 61 | compatible = "qcom,msm8996-apcs-hmss-global"; | 61 | compatible = "qcom,msm8996-apcs-hmss-global"; |
| @@ -41,12 +41,12 @@ processor ID) and a string identifier. · 40 unmodified lines | |||
| 41 | - qcom,local-pid: | 41 | - qcom,local-pid: |
| 42 | Usage: required | 42 | Usage: required |
| 43 | Value type: <u32> | 43 | Value type: <u32> |
| 44 | Definition: specifies the identfier of the local endpoint of this edge | 44 | Definition: specifies the identifier of the local endpoint of this edge |
| 45 | 45 | ||
| 46 | - qcom,remote-pid: | 46 | - qcom,remote-pid: |
| 47 | Usage: required | 47 | Usage: required |
| 48 | Value type: <u32> | 48 | Value type: <u32> |
| 49 | Definition: specifies the identfier of the remote endpoint of this edge | 49 | Definition: specifies the identifier of the remote endpoint of this edge |
| 50 | 50 | ||
| 51 | = SUBNODES | 51 | = SUBNODES |
| 52 | Each SMP2P pair contain a set of inbound and outbound entries, these are | 52 | Each SMP2P pair contain a set of inbound and outbound entries, these are |
| @@ -124,11 +124,11 @@ struct bus_attribute { · 123 unmodified lines | |||
| 124 | ssize_t (*store)(struct bus_type *, const char * buf, size_t count); | 124 | ssize_t (*store)(struct bus_type *, const char * buf, size_t count); |
| 125 | }; | 125 | }; |
| 126 | 126 | ||
| 127 | Bus drivers can export attributes using the BUS_ATTR macro that works | 127 | Bus drivers can export attributes using the BUS_ATTR_RW macro that works |
| 128 | similarly to the DEVICE_ATTR macro for devices. For example, a definition | 128 | similarly to the DEVICE_ATTR_RW macro for devices. For example, a |
| 129 | like this: | 129 | definition like this: |
| 130 | 130 | ||
| 131 | static BUS_ATTR(debug,0644,show_debug,store_debug); | 131 | static BUS_ATTR_RW(debug); |
| 132 | 132 | ||
| 133 | is equivalent to declaring: | 133 | is equivalent to declaring: |
| 134 | 134 | ||
| @@ -163,6 +163,14 @@ C. Boot options · 162 unmodified lines | |||
| 163 | be preserved until there actually is some text is output to the console. | 163 | be preserved until there actually is some text is output to the console. |
| 164 | This option causes fbcon to bind immediately to the fbdev device. | 164 | This option causes fbcon to bind immediately to the fbdev device. |
| 165 | 165 | ||
| 166 | 7. fbcon=logo-pos:<location> | ||
| 167 | |||
| 168 | The only possible 'location' is 'center' (without quotes), and when | ||
| 169 | given, the bootup logo is moved from the default top-left corner | ||
| 170 | location to the center of the framebuffer. If more than one logo is | ||
| 171 | displayed due to multiple CPUs, the collected line of logos is moved | ||
| 172 | as a whole. | ||
| 173 | |||
| 166 | C. Attaching, Detaching and Unloading | 174 | C. Attaching, Detaching and Unloading |
| 167 | 175 | ||
| 168 | Before going on to how to attach, detach and unload the framebuffer console, an | 176 | Before going on to how to attach, detach and unload the framebuffer console, an |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | TODO | | 11 | | arm: | TODO | |
| 12 | | arm64: | TODO | | 12 | | arm64: | TODO | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | ok | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | ok | | 16 | | hexagon: | ok | |
| 16 | | ia64: | ok | | 17 | | ia64: | ok | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | ok | | 13 | | c6x: | ok | |
| 14 | | csky: | ok | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | ok | | 16 | | hexagon: | ok | |
| 16 | | ia64: | ok | | 17 | | ia64: | ok | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | TODO | | 11 | | arm: | TODO | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | ok | | 15 | | h8300: | ok | |
| 15 | | hexagon: | ok | | 16 | | hexagon: | ok | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | TODO | | 11 | | arm: | TODO | |
| 12 | | arm64: | TODO | | 12 | | arm64: | TODO | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | ok | | 17 | | ia64: | ok | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | ok | | 17 | | ia64: | ok | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | TODO | | 12 | | arm64: | TODO | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | TODO | | 11 | | arm: | TODO | |
| 12 | | arm64: | TODO | | 12 | | arm64: | TODO | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | ok | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | TODO | | 11 | | arm: | TODO | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | ok | | 16 | | hexagon: | ok | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | TODO | | 11 | | arm: | TODO | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | ok | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | TODO | | 11 | | arm: | TODO | |
| 12 | | arm64: | TODO | | 12 | | arm64: | TODO | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | ok | | 17 | | ia64: | ok | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | ok | | 16 | | hexagon: | ok | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | |||
| 34 | | arm: | ok | | 34 | | arm: | ok | |
| 35 | | arm64: | ok | | 35 | | arm64: | ok | |
| 36 | | c6x: | TODO | | 36 | | c6x: | TODO | |
| 37 | | csky: | TODO | | ||
| 37 | | h8300: | TODO | | 38 | | h8300: | TODO | |
| 38 | | hexagon: | TODO | | 39 | | hexagon: | TODO | |
| 39 | | ia64: | TODO | | 40 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | .. | | 11 | | arm: | .. | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | .. | | 13 | | c6x: | .. | |
| 14 | | csky: | .. | | ||
| 14 | | h8300: | .. | | 15 | | h8300: | .. | |
| 15 | | hexagon: | .. | | 16 | | hexagon: | .. | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | ok | | 13 | | c6x: | ok | |
| 14 | | csky: | ok | | ||
| 14 | | h8300: | ok | | 15 | | h8300: | ok | |
| 15 | | hexagon: | ok | | 16 | | hexagon: | ok | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | .. | | 17 | | ia64: | .. | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | TODO | | 11 | | arm: | TODO | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | ok | | 13 | | c6x: | ok | |
| 14 | | csky: | ok | | ||
| 14 | | h8300: | ok | | 15 | | h8300: | ok | |
| 15 | | hexagon: | ok | | 16 | | hexagon: | ok | |
| 16 | | ia64: | ok | | 17 | | ia64: | ok | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | ok | | 17 | | ia64: | ok | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | TODO | | 11 | | arm: | TODO | |
| 12 | | arm64: | TODO | | 12 | | arm64: | TODO | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | ok | | 17 | | ia64: | ok | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | .. | | 13 | | c6x: | .. | |
| 14 | | csky: | .. | | ||
| 14 | | h8300: | .. | | 15 | | h8300: | .. | |
| 15 | | hexagon: | .. | | 16 | | hexagon: | .. | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | TODO | | 11 | | arm: | TODO | |
| 12 | | arm64: | TODO | | 12 | | arm64: | TODO | |
| 13 | | c6x: | .. | | 13 | | c6x: | .. | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | .. | | 15 | | h8300: | .. | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | TODO | | 11 | | arm: | TODO | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | TODO | | 11 | | arm: | TODO | |
| 12 | | arm64: | TODO | | 12 | | arm64: | TODO | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | .. | | 11 | | arm: | .. | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | .. | | 13 | | c6x: | .. | |
| 14 | | csky: | .. | | ||
| 14 | | h8300: | .. | | 15 | | h8300: | .. | |
| 15 | | hexagon: | .. | | 16 | | hexagon: | .. | |
| 16 | | ia64: | ok | | 17 | | ia64: | ok | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | | arm: | ok | | 11 | | arm: | ok | |
| 12 | | arm64: | ok | | 12 | | arm64: | ok | |
| 13 | | c6x: | TODO | | 13 | | c6x: | TODO | |
| 14 | | csky: | TODO | | ||
| 14 | | h8300: | TODO | | 15 | | h8300: | TODO | |
| 15 | | hexagon: | TODO | | 16 | | hexagon: | TODO | |
| 16 | | ia64: | TODO | | 17 | | ia64: | TODO | |
| @@ -344,7 +344,9 @@ struct bus_attribute { · 343 unmodified lines | |||
| 344 | 344 | ||
| 345 | Declaring: | 345 | Declaring: |
| 346 | 346 | ||
| 347 | BUS_ATTR(_name, _mode, _show, _store) | 347 | static BUS_ATTR_RW(name); |
| 348 | static BUS_ATTR_RO(name); | ||
| 349 | static BUS_ATTR_WO(name); | ||
| 348 | 350 | ||
| 349 | Creation/Removal: | 351 | Creation/Removal: |
| 350 | 352 | ||
| @@ -11,19 +11,19 @@ Contents: · 10 unmodified lines | |||
| 11 | batman-adv | 11 | batman-adv |
| 12 | can | 12 | can |
| 13 | can_ucan_protocol | 13 | can_ucan_protocol |
| 14 | dpaa2/index | 14 | device_drivers/freescale/dpaa2/index |
| 15 | e100 | 15 | device_drivers/intel/e100 |
| 16 | e1000 | 16 | device_drivers/intel/e1000 |
| 17 | e1000e | 17 | device_drivers/intel/e1000e |
| 18 | fm10k | 18 | device_drivers/intel/fm10k |
| 19 | igb | 19 | device_drivers/intel/igb |
| 20 | igbvf | 20 | device_drivers/intel/igbvf |
| 21 | ixgb | 21 | device_drivers/intel/ixgb |
| 22 | ixgbe | 22 | device_drivers/intel/ixgbe |
| 23 | ixgbevf | 23 | device_drivers/intel/ixgbevf |
| 24 | i40e | 24 | device_drivers/intel/i40e |
| 25 | iavf | 25 | device_drivers/intel/iavf |
| 26 | ice | 26 | device_drivers/intel/ice |
| 27 | kapi | 27 | kapi |
| 28 | z8530book | 28 | z8530book |
| 29 | msg_zerocopy | 29 | msg_zerocopy |
| @@ -1000,51 +1000,6 @@ The kernel interface functions are as follows: · 999 unmodified lines | |||
| 1000 | size should be set when the call is begun. tx_total_len may not be less | 1000 | size should be set when the call is begun. tx_total_len may not be less |
| 1001 | than zero. | 1001 | than zero. |
| 1002 | 1002 | ||
| 1003 | (*) Check to see the completion state of a call so that the caller can assess | ||
| 1004 | whether it needs to be retried. | ||
| 1005 | |||
| 1006 | enum rxrpc_call_completion { | ||
| 1007 | RXRPC_CALL_SUCCEEDED, | ||
| 1008 | RXRPC_CALL_REMOTELY_ABORTED, | ||
| 1009 | RXRPC_CALL_LOCALLY_ABORTED, | ||
| 1010 | RXRPC_CALL_LOCAL_ERROR, | ||
| 1011 | RXRPC_CALL_NETWORK_ERROR, | ||
| 1012 | }; | ||
| 1013 | |||
| 1014 | int rxrpc_kernel_check_call(struct socket *sock, struct rxrpc_call *call, | ||
| 1015 | enum rxrpc_call_completion *_compl, | ||
| 1016 | u32 *_abort_code); | ||
| 1017 | |||
| 1018 | On return, -EINPROGRESS will be returned if the call is still ongoing; if | ||
| 1019 | it is finished, *_compl will be set to indicate the manner of completion, | ||
| 1020 | *_abort_code will be set to any abort code that occurred. 0 will be | ||
| 1021 | returned on a successful completion, -ECONNABORTED will be returned if the | ||
| 1022 | client failed due to a remote abort and anything else will return an | ||
| 1023 | appropriate error code. | ||
| 1024 | |||
| 1025 | The caller should look at this information to decide if it's worth | ||
| 1026 | retrying the call. | ||
| 1027 | |||
| 1028 | (*) Retry a client call. | ||
| 1029 | |||
| 1030 | int rxrpc_kernel_retry_call(struct socket *sock, | ||
| 1031 | struct rxrpc_call *call, | ||
| 1032 | struct sockaddr_rxrpc *srx, | ||
| 1033 | struct key *key); | ||
| 1034 | |||
| 1035 | This attempts to partially reinitialise a call and submit it again while | ||
| 1036 | reusing the original call's Tx queue to avoid the need to repackage and | ||
| 1037 | re-encrypt the data to be sent. call indicates the call to retry, srx the | ||
| 1038 | new address to send it to and key the encryption key to use for signing or | ||
| 1039 | encrypting the packets. | ||
| 1040 | |||
| 1041 | For this to work, the first Tx data packet must still be in the transmit | ||
| 1042 | queue, and currently this is only permitted for local and network errors | ||
| 1043 | and the call must not have been aborted. Any partially constructed Tx | ||
| 1044 | packet is left as is and can continue being filled afterwards. | ||
| 1045 | |||
| 1046 | It returns 0 if the call was requeued and an error otherwise. | ||
| 1047 | |||
| 1048 | (*) Get call RTT. | 1003 | (*) Get call RTT. |
| 1049 | 1004 | ||
| 1050 | u64 rxrpc_kernel_get_rtt(struct socket *sock, struct rxrpc_call *call); | 1005 | u64 rxrpc_kernel_get_rtt(struct socket *sock, struct rxrpc_call *call); |
| @@ -336,7 +336,26 @@ time client replies ACK, this socket will get another chance to move · 335 unmodified lines | |||
| 336 | to the accept queue. | 336 | to the accept queue. |
| 337 | 337 | ||
| 338 | 338 | ||
| 339 | TCP Fast Open | 339 | * TcpEstabResets |
| 340 | Defined in `RFC1213 tcpEstabResets`_. | ||
| 341 | |||
| 342 | .. _RFC1213 tcpEstabResets: https://tools.ietf.org/html/rfc1213#page-48 | ||
| 343 | |||
| 344 | * TcpAttemptFails | ||
| 345 | Defined in `RFC1213 tcpAttemptFails`_. | ||
| 346 | |||
| 347 | .. _RFC1213 tcpAttemptFails: https://tools.ietf.org/html/rfc1213#page-48 | ||
| 348 | |||
| 349 | * TcpOutRsts | ||
| 350 | Defined in `RFC1213 tcpOutRsts`_. The RFC says this counter indicates | ||
| 351 | the 'segments sent containing the RST flag', but in linux kernel, this | ||
| 352 | couner indicates the segments kerenl tried to send. The sending | ||
| 353 | process might be failed due to some errors (e.g. memory alloc failed). | ||
| 354 | |||
| 355 | .. _RFC1213 tcpOutRsts: https://tools.ietf.org/html/rfc1213#page-52 | ||
| 356 | |||
| 357 | |||
| 358 | TCP Fast Path | ||
| 340 | ============ | 359 | ============ |
| 341 | When kernel receives a TCP packet, it has two paths to handler the | 360 | When kernel receives a TCP packet, it has two paths to handler the |
| 342 | packet, one is fast path, another is slow path. The comment in kernel | 361 | packet, one is fast path, another is slow path. The comment in kernel |
| @@ -383,8 +402,6 @@ increase 1. · 40 unmodified lines | |||
| 383 | 402 | ||
| 384 | TCP abort | 403 | TCP abort |
| 385 | ======== | 404 | ======== |
| 386 | |||
| 387 | |||
| 388 | * TcpExtTCPAbortOnData | 405 | * TcpExtTCPAbortOnData |
| 389 | It means TCP layer has data in flight, but need to close the | 406 | It means TCP layer has data in flight, but need to close the |
| 390 | connection. So TCP layer sends a RST to the other side, indicate the | 407 | connection. So TCP layer sends a RST to the other side, indicate the |
| @@ -545,7 +562,6 @@ packet yet, the sender would know packet 4 is out of order. The TCP · 154 unmodified lines | |||
| 545 | stack of kernel will increase TcpExtTCPSACKReorder for both of the | 562 | stack of kernel will increase TcpExtTCPSACKReorder for both of the |
| 546 | above scenarios. | 563 | above scenarios. |
| 547 | 564 | ||
| 548 | |||
| 549 | DSACK | 565 | DSACK |
| 550 | ===== | 566 | ===== |
| 551 | The DSACK is defined in `RFC2883`_. The receiver uses DSACK to report | 567 | The DSACK is defined in `RFC2883`_. The receiver uses DSACK to report |
| @@ -566,13 +582,63 @@ The TCP stack receives an out of order duplicate packet, so it sends a · 14 unmodified lines | |||
| 566 | DSACK to the sender. | 582 | DSACK to the sender. |
| 567 | 583 | ||
| 568 | * TcpExtTCPDSACKRecv | 584 | * TcpExtTCPDSACKRecv |
| 569 | The TCP stack receives a DSACK, which indicate an acknowledged | 585 | The TCP stack receives a DSACK, which indicates an acknowledged |
| 570 | duplicate packet is received. | 586 | duplicate packet is received. |
| 571 | 587 | ||
| 572 | * TcpExtTCPDSACKOfoRecv | 588 | * TcpExtTCPDSACKOfoRecv |
| 573 | The TCP stack receives a DSACK, which indicate an out of order | 589 | The TCP stack receives a DSACK, which indicate an out of order |
| 574 | duplicate packet is received. | 590 | duplicate packet is received. |
| 575 | 591 | ||
| 592 | invalid SACK and DSACK | ||
| 593 | ==================== | ||
| 594 | When a SACK (or DSACK) block is invalid, a corresponding counter would | ||
| 595 | be updated. The validation method is base on the start/end sequence | ||
| 596 | number of the SACK block. For more details, please refer the comment | ||
| 597 | of the function tcp_is_sackblock_valid in the kernel source code. A | ||
| 598 | SACK option could have up to 4 blocks, they are checked | ||
| 599 | individually. E.g., if 3 blocks of a SACk is invalid, the | ||
| 600 | corresponding counter would be updated 3 times. The comment of the | ||
| 601 | `Add counters for discarded SACK blocks`_ patch has additional | ||
| 602 | explaination: | ||
| 603 | |||
| 604 | .. _Add counters for discarded SACK blocks: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=18f02545a9a16c9a89778b91a162ad16d510bb32 | ||
| 605 | |||
| 606 | * TcpExtTCPSACKDiscard | ||
| 607 | This counter indicates how many SACK blocks are invalid. If the invalid | ||
| 608 | SACK block is caused by ACK recording, the TCP stack will only ignore | ||
| 609 | it and won't update this counter. | ||
| 610 | |||
| 611 | * TcpExtTCPDSACKIgnoredOld and TcpExtTCPDSACKIgnoredNoUndo | ||
| 612 | When a DSACK block is invalid, one of these two counters would be | ||
| 613 | updated. Which counter will be updated depends on the undo_marker flag | ||
| 614 | of the TCP socket. If the undo_marker is not set, the TCP stack isn't | ||
| 615 | likely to re-transmit any packets, and we still receive an invalid | ||
| 616 | DSACK block, the reason might be that the packet is duplicated in the | ||
| 617 | middle of the network. In such scenario, TcpExtTCPDSACKIgnoredNoUndo | ||
| 618 | will be updated. If the undo_marker is set, TcpExtTCPDSACKIgnoredOld | ||
| 619 | will be updated. As implied in its name, it might be an old packet. | ||
| 620 | |||
| 621 | SACK shift | ||
| 622 | ========= | ||
| 623 | The linux networking stack stores data in sk_buff struct (skb for | ||
| 624 | short). If a SACK block acrosses multiple skb, the TCP stack will try | ||
| 625 | to re-arrange data in these skb. E.g. if a SACK block acknowledges seq | ||
| 626 | 10 to 15, skb1 has seq 10 to 13, skb2 has seq 14 to 20. The seq 14 and | ||
| 627 | 15 in skb2 would be moved to skb1. This operation is 'shift'. If a | ||
| 628 | SACK block acknowledges seq 10 to 20, skb1 has seq 10 to 13, skb2 has | ||
| 629 | seq 14 to 20. All data in skb2 will be moved to skb1, and skb2 will be | ||
| 630 | discard, this operation is 'merge'. | ||
| 631 | |||
| 632 | * TcpExtTCPSackShifted | ||
| 633 | A skb is shifted | ||
| 634 | |||
| 635 | * TcpExtTCPSackMerged | ||
| 636 | A skb is merged | ||
| 637 | |||
| 638 | * TcpExtTCPSackShiftFallback | ||
| 639 | A skb should be shifted or merged, but the TCP stack doesn't do it for | ||
| 640 | some reasons. | ||
| 641 | |||
| 576 | TCP out of order | 642 | TCP out of order |
| 577 | =============== | 643 | =============== |
| 578 | * TcpExtTCPOFOQueue | 644 | * TcpExtTCPOFOQueue |
| @@ -662,6 +728,60 @@ unacknowledged number (more strict than `RFC 5961 section 5.2`_). · 83 unmodified lines | |||
| 662 | .. _RFC 5961 section 4.2: https://tools.ietf.org/html/rfc5961#page-9 | 728 | .. _RFC 5961 section 4.2: https://tools.ietf.org/html/rfc5961#page-9 |
| 663 | .. _RFC 5961 section 5.2: https://tools.ietf.org/html/rfc5961#page-11 | 729 | .. _RFC 5961 section 5.2: https://tools.ietf.org/html/rfc5961#page-11 |
| 664 | 730 | ||
| 731 | TCP receive window | ||
| 732 | ================= | ||
| 733 | * TcpExtTCPWantZeroWindowAdv | ||
| 734 | Depending on current memory usage, the TCP stack tries to set receive | ||
| 735 | window to zero. But the receive window might still be a no-zero | ||
| 736 | value. For example, if the previous window size is 10, and the TCP | ||
| 737 | stack receives 3 bytes, the current window size would be 7 even if the | ||
| 738 | window size calculated by the memory usage is zero. | ||
| 739 | |||
| 740 | * TcpExtTCPToZeroWindowAdv | ||
| 741 | The TCP receive window is set to zero from a no-zero value. | ||
| 742 | |||
| 743 | * TcpExtTCPFromZeroWindowAdv | ||
| 744 | The TCP receive window is set to no-zero value from zero. | ||
| 745 | |||
| 746 | |||
| 747 | Delayed ACK | ||
| 748 | ========== | ||
| 749 | The TCP Delayed ACK is a technique which is used for reducing the | ||
| 750 | packet count in the network. For more details, please refer the | ||
| 751 | `Delayed ACK wiki`_ | ||
| 752 | |||
| 753 | .. _Delayed ACK wiki: https://en.wikipedia.org/wiki/TCP_delayed_acknowledgment | ||
| 754 | |||
| 755 | * TcpExtDelayedACKs | ||
| 756 | A delayed ACK timer expires. The TCP stack will send a pure ACK packet | ||
| 757 | and exit the delayed ACK mode. | ||
| 758 | |||
| 759 | * TcpExtDelayedACKLocked | ||
| 760 | A delayed ACK timer expires, but the TCP stack can't send an ACK | ||
| 761 | immediately due to the socket is locked by a userspace program. The | ||
| 762 | TCP stack will send a pure ACK later (after the userspace program | ||
| 763 | unlock the socket). When the TCP stack sends the pure ACK later, the | ||
| 764 | TCP stack will also update TcpExtDelayedACKs and exit the delayed ACK | ||
| 765 | mode. | ||
| 766 | |||
| 767 | * TcpExtDelayedACKLost | ||
| 768 | It will be updated when the TCP stack receives a packet which has been | ||
| 769 | ACKed. A Delayed ACK loss might cause this issue, but it would also be | ||
| 770 | triggered by other reasons, such as a packet is duplicated in the | ||
| 771 | network. | ||
| 772 | |||
| 773 | Tail Loss Probe (TLP) | ||
| 774 | =================== | ||
| 775 | TLP is an algorithm which is used to detect TCP packet loss. For more | ||
| 776 | details, please refer the `TLP paper`_. | ||
| 777 | |||
| 778 | .. _TLP paper: https://tools.ietf.org/html/draft-dukkipati-tcpm-tcp-loss-probe-01 | ||
| 779 | |||
| 780 | * TcpExtTCPLossProbes | ||
| 781 | A TLP probe packet is sent. | ||
| 782 | |||
| 783 | * TcpExtTCPLossProbeRecovery | ||
| 784 | A packet loss is detected and recovered by TLP. | ||
| 665 | 785 | ||
| 666 | examples | 786 | examples |
| 667 | ======= | 787 | ======= |
| @@ -417,7 +417,7 @@ is again deprecated and ts[2] holds a hardware timestamp if set. · 416 unmodified lines | |||
| 417 | 417 | ||
| 418 | Hardware time stamping must also be initialized for each device driver | 418 | Hardware time stamping must also be initialized for each device driver |
| 419 | that is expected to do hardware time stamping. The parameter is defined in | 419 | that is expected to do hardware time stamping. The parameter is defined in |
| 420 | /include/linux/net_tstamp.h as: | 420 | include/uapi/linux/net_tstamp.h as: |
| 421 | 421 | ||
| 422 | struct hwtstamp_config { | 422 | struct hwtstamp_config { |
| 423 | int flags; /* no flags defined right now, must be zero */ | 423 | int flags; /* no flags defined right now, must be zero */ |
| @@ -487,7 +487,7 @@ enum { · 63 unmodified lines | |||
| 487 | HWTSTAMP_FILTER_PTP_V1_L4_EVENT, | 487 | HWTSTAMP_FILTER_PTP_V1_L4_EVENT, |
| 488 | 488 | ||
| 489 | /* for the complete list of values, please check | 489 | /* for the complete list of values, please check |
| 490 | * the include file /include/linux/net_tstamp.h | 490 | * the include file include/uapi/linux/net_tstamp.h |
| 491 | */ | 491 | */ |
| 492 | }; | 492 | }; |
| 493 | 493 | ||
| @@ -56,26 +56,32 @@ of any kernel data structures. · 55 unmodified lines | |||
| 56 | 56 | ||
| 57 | dentry-state: | 57 | dentry-state: |
| 58 | 58 | ||
| 59 | From linux/fs/dentry.c: | 59 | From linux/include/linux/dcache.h: |
| 60 | -------------------------------------------------------------- | 60 | -------------------------------------------------------------- |
| 61 | struct { | 61 | struct dentry_stat_t dentry_stat { |
| 62 | int nr_dentry; | 62 | int nr_dentry; |
| 63 | int nr_unused; | 63 | int nr_unused; |
| 64 | int age_limit; /* age in seconds */ | 64 | int age_limit; /* age in seconds */ |
| 65 | int want_pages; /* pages requested by system */ | 65 | int want_pages; /* pages requested by system */ |
| 66 | int dummy[2]; | 66 | int nr_negative; /* # of unused negative dentries */ |
| 67 | } dentry_stat = {0, 0, 45, 0,}; | 67 | int dummy; /* Reserved for future use */ |
| 68 | -------------------------------------------------------------- | 68 | }; |
| 69 | 69 | -------------------------------------------------------------- | |
| 70 | Dentries are dynamically allocated and deallocated, and | 70 | |
| 71 | nr_dentry seems to be 0 all the time. Hence it's safe to | 71 | Dentries are dynamically allocated and deallocated. |
| 72 | assume that only nr_unused, age_limit and want_pages are | 72 | |
| 73 | used. Nr_unused seems to be exactly what its name says. | 73 | nr_dentry shows the total number of dentries allocated (active |
| 74 | + unused). nr_unused shows the number of dentries that are not | ||
| 75 | actively used, but are saved in the LRU list for future reuse. | ||
| 76 | |||
| 74 | Age_limit is the age in seconds after which dcache entries | 77 | Age_limit is the age in seconds after which dcache entries |
| 75 | can be reclaimed when memory is short and want_pages is | 78 | can be reclaimed when memory is short and want_pages is |
| 76 | nonzero when shrink_dcache_pages() has been called and the | 79 | nonzero when shrink_dcache_pages() has been called and the |
| 77 | dcache isn't pruned yet. | 80 | dcache isn't pruned yet. |
| 78 | 81 | ||
| 82 | nr_negative shows the number of unused dentries that are also | ||
| 83 | negative dentries which do not mapped to actual files. | ||
| 84 | |||
| 79 | ============================================================== | 85 | ============================================================== |
| 80 | 86 | ||
| 81 | dquot-max & dquot-nr: | 87 | dquot-max & dquot-nr: |
| @@ -165,7 +165,7 @@ Do some work... · 164 unmodified lines | |||
| 165 | The same can also be done from an application program. | 165 | The same can also be done from an application program. |
| 166 | 166 | ||
| 167 | Disable specific CPU's specific idle state from cpuidle sysfs (see | 167 | Disable specific CPU's specific idle state from cpuidle sysfs (see |
| 168 | Documentation/cpuidle/sysfs.txt): | 168 | Documentation/admin-guide/pm/cpuidle.rst): |
| 169 | # echo 1 > /sys/devices/system/cpu/cpu$cpu/cpuidle/state$state/disable | 169 | # echo 1 > /sys/devices/system/cpu/cpu$cpu/cpuidle/state$state/disable |
| 170 | 170 | ||
| 171 | 171 | ||
| @@ -242,6 +242,6 @@ References · 241 unmodified lines | |||
| 242 | ========== | 242 | ========== |
| 243 | 243 | ||
| 244 | .. [white-paper] http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/12/AMD_Memory_Encryption_Whitepaper_v7-Public.pdf | 244 | .. [white-paper] http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/12/AMD_Memory_Encryption_Whitepaper_v7-Public.pdf |
| 245 | .. [api-spec] http://support.amd.com/TechDocs/55766_SEV-KM%20API_Specification.pdf | 245 | .. [api-spec] http://support.amd.com/TechDocs/55766_SEV-KM_API_Specification.pdf |
| 246 | .. [amd-apm] http://support.amd.com/TechDocs/24593.pdf (section 15.34) | 246 | .. [amd-apm] http://support.amd.com/TechDocs/24593.pdf (section 15.34) |
| 247 | .. [kvm-forum] http://www.linux-kvm.org/images/7/74/02x08A-Thomas_Lendacky-AMDs_Virtualizatoin_Memory_Encryption_Technology.pdf | 247 | .. [kvm-forum] http://www.linux-kvm.org/images/7/74/02x08A-Thomas_Lendacky-AMDs_Virtualizatoin_Memory_Encryption_Technology.pdf |
| @@ -9,7 +9,7 @@ Fenghua Yu <fenghua.yu@intel.com> · 8 unmodified lines | |||
| 9 | Tony Luck <tony.luck@intel.com> | 9 | Tony Luck <tony.luck@intel.com> |
| 10 | Vikas Shivappa <vikas.shivappa@intel.com> | 10 | Vikas Shivappa <vikas.shivappa@intel.com> |
| 11 | 11 | ||
| 12 | This feature is enabled by the CONFIG_RESCTRL and the X86 /proc/cpuinfo | 12 | This feature is enabled by the CONFIG_X86_CPU_RESCTRL and the x86 /proc/cpuinfo |
| 13 | flag bits: | 13 | flag bits: |
| 14 | RDT (Resource Director Technology) Allocation - "rdt_a" | 14 | RDT (Resource Director Technology) Allocation - "rdt_a" |
| 15 | CAT (Cache Allocation Technology) - "cat_l3", "cat_l2" | 15 | CAT (Cache Allocation Technology) - "cat_l3", "cat_l2" |
| @@ -2848,6 +2848,9 @@ F: include/uapi/linux/if_bonding.h · 2847 unmodified lines | |||
| 2848 | BPF (Safe dynamic programs and tools) | 2848 | BPF (Safe dynamic programs and tools) |
| 2849 | M: Alexei Starovoitov <ast@kernel.org> | 2849 | M: Alexei Starovoitov <ast@kernel.org> |
| 2850 | M: Daniel Borkmann <daniel@iogearbox.net> | 2850 | M: Daniel Borkmann <daniel@iogearbox.net> |
| 2851 | R: Martin KaFai Lau <kafai@fb.com> | ||
| 2852 | R: Song Liu <songliubraving@fb.com> | ||
| 2853 | R: Yonghong Song <yhs@fb.com> | ||
| 2851 | L: netdev@vger.kernel.org | 2854 | L: netdev@vger.kernel.org |
| 2852 | L: linux-kernel@vger.kernel.org | 2855 | L: linux-kernel@vger.kernel.org |
| 2853 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git | 2856 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git |
| @@ -2873,6 +2876,8 @@ F: samples/bpf/ · 19 unmodified lines | |||
| 2873 | F: tools/bpf/ | 2876 | F: tools/bpf/ |
| 2874 | F: tools/lib/bpf/ | 2877 | F: tools/lib/bpf/ |
| 2875 | F: tools/testing/selftests/bpf/ | 2878 | F: tools/testing/selftests/bpf/ |
| 2879 | K: bpf | ||
| 2880 | N: bpf | ||
| 2876 | 2881 | ||
| 2877 | BPF JIT for ARM | 2882 | BPF JIT for ARM |
| 2878 | M: Shubham Bansal <illusionist.neo@gmail.com> | 2883 | M: Shubham Bansal <illusionist.neo@gmail.com> |
| @@ -3052,8 +3057,8 @@ F: include/linux/bcm963xx_nvram.h · 173 unmodified lines | |||
| 3052 | F: include/linux/bcm963xx_tag.h | 3057 | F: include/linux/bcm963xx_tag.h |
| 3053 | 3058 | ||
| 3054 | BROADCOM BNX2 GIGABIT ETHERNET DRIVER | 3059 | BROADCOM BNX2 GIGABIT ETHERNET DRIVER |
| 3055 | M: Rasesh Mody <rasesh.mody@cavium.com> | 3060 | M: Rasesh Mody <rmody@marvell.com> |
| 3056 | M: Dept-GELinuxNICDev@cavium.com | 3061 | M: GR-Linux-NIC-Dev@marvell.com |
| 3057 | L: netdev@vger.kernel.org | 3062 | L: netdev@vger.kernel.org |
| 3058 | S: Supported | 3063 | S: Supported |
| 3059 | F: drivers/net/ethernet/broadcom/bnx2.* | 3064 | F: drivers/net/ethernet/broadcom/bnx2.* |
| @@ -3072,9 +3077,9 @@ S: Supported · 12 unmodified lines | |||
| 3072 | F: drivers/scsi/bnx2i/ | 3077 | F: drivers/scsi/bnx2i/ |
| 3073 | 3078 | ||
| 3074 | BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER | 3079 | BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER |
| 3075 | M: Ariel Elior <ariel.elior@cavium.com> | 3080 | M: Ariel Elior <aelior@marvell.com> |
| 3076 | M: Sudarsana Kalluru <sudarsana.kalluru@cavium.com> | 3081 | M: Sudarsana Kalluru <skalluru@marvell.com> |
| 3077 | M: everest-linux-l2@cavium.com | 3082 | M: GR-everest-linux-l2@marvell.com |
| 3078 | L: netdev@vger.kernel.org | 3083 | L: netdev@vger.kernel.org |
| 3079 | S: Supported | 3084 | S: Supported |
| 3080 | F: drivers/net/ethernet/broadcom/bnx2x/ | 3085 | F: drivers/net/ethernet/broadcom/bnx2x/ |
| @@ -3249,9 +3254,9 @@ S: Supported · 168 unmodified lines | |||
| 3249 | F: drivers/scsi/bfa/ | 3254 | F: drivers/scsi/bfa/ |
| 3250 | 3255 | ||
| 3251 | BROCADE BNA 10 GIGABIT ETHERNET DRIVER | 3256 | BROCADE BNA 10 GIGABIT ETHERNET DRIVER |
| 3252 | M: Rasesh Mody <rasesh.mody@cavium.com> | 3257 | M: Rasesh Mody <rmody@marvell.com> |
| 3253 | M: Sudarsana Kalluru <sudarsana.kalluru@cavium.com> | 3258 | M: Sudarsana Kalluru <skalluru@marvell.com> |
| 3254 | M: Dept-GELinuxNICDev@cavium.com | 3259 | M: GR-Linux-NIC-Dev@marvell.com |
| 3255 | L: netdev@vger.kernel.org | 3260 | L: netdev@vger.kernel.org |
| 3256 | S: Supported | 3261 | S: Supported |
| 3257 | F: drivers/net/ethernet/brocade/bna/ | 3262 | F: drivers/net/ethernet/brocade/bna/ |
| @@ -3471,10 +3476,9 @@ F: drivers/i2c/busses/i2c-octeon* · 213 unmodified lines | |||
| 3471 | F: drivers/i2c/busses/i2c-thunderx* | 3476 | F: drivers/i2c/busses/i2c-thunderx* |
| 3472 | 3477 | ||
| 3473 | CAVIUM LIQUIDIO NETWORK DRIVER | 3478 | CAVIUM LIQUIDIO NETWORK DRIVER |
| 3474 | M: Derek Chickles <derek.chickles@caviumnetworks.com> | 3479 | M: Derek Chickles <dchickles@marvell.com> |
| 3475 | M: Satanand Burla <satananda.burla@caviumnetworks.com> | 3480 | M: Satanand Burla <sburla@marvell.com> |
| 3476 | M: Felix Manlunas <felix.manlunas@caviumnetworks.com> | 3481 | M: Felix Manlunas <fmanlunas@marvell.com> |
| 3477 | M: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com> | ||
| 3478 | L: netdev@vger.kernel.org | 3482 | L: netdev@vger.kernel.org |
| 3479 | W: http://www.cavium.com | 3483 | W: http://www.cavium.com |
| 3480 | S: Supported | 3484 | S: Supported |
| @@ -3951,7 +3955,7 @@ L: netdev@vger.kernel.org · 470 unmodified lines | |||
| 3951 | S: Maintained | 3955 | S: Maintained |
| 3952 | F: drivers/net/ethernet/ti/cpmac.c | 3956 | F: drivers/net/ethernet/ti/cpmac.c |
| 3953 | 3957 | ||
| 3954 | CPU FREQUENCY DRIVERS | 3958 | CPU FREQUENCY SCALING FRAMEWORK |
| 3955 | M: "Rafael J. Wysocki" <rjw@rjwysocki.net> | 3959 | M: "Rafael J. Wysocki" <rjw@rjwysocki.net> |
| 3956 | M: Viresh Kumar <viresh.kumar@linaro.org> | 3960 | M: Viresh Kumar <viresh.kumar@linaro.org> |
| 3957 | L: linux-pm@vger.kernel.org | 3961 | L: linux-pm@vger.kernel.org |
| @@ -3959,6 +3963,8 @@ S: Maintained · 1 unmodified line | |||
| 3959 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git | 3963 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git |
| 3960 | T: git git://git.linaro.org/people/vireshk/linux.git (For ARM Updates) | 3964 | T: git git://git.linaro.org/people/vireshk/linux.git (For ARM Updates) |
| 3961 | B: https://bugzilla.kernel.org | 3965 | B: https://bugzilla.kernel.org |
| 3966 | F: Documentation/admin-guide/pm/cpufreq.rst | ||
| 3967 | F: Documentation/admin-guide/pm/intel_pstate.rst | ||
| 3962 | F: Documentation/cpu-freq/ | 3968 | F: Documentation/cpu-freq/ |
| 3963 | F: Documentation/devicetree/bindings/cpufreq/ | 3969 | F: Documentation/devicetree/bindings/cpufreq/ |
| 3964 | F: drivers/cpufreq/ | 3970 | F: drivers/cpufreq/ |
| @@ -3977,6 +3983,7 @@ F: drivers/cpufreq/arm_big_little.c · 12 unmodified lines | |||
| 3977 | CPU POWER MONITORING SUBSYSTEM | 3983 | CPU POWER MONITORING SUBSYSTEM |
| 3978 | M: Thomas Renninger <trenn@suse.com> | 3984 | M: Thomas Renninger <trenn@suse.com> |
| 3979 | M: Shuah Khan <shuah@kernel.org> | 3985 | M: Shuah Khan <shuah@kernel.org> |
| 3986 | M: Shuah Khan <skhan@linuxfoundation.org> | ||
| 3980 | L: linux-pm@vger.kernel.org | 3987 | L: linux-pm@vger.kernel.org |
| 3981 | S: Maintained | 3988 | S: Maintained |
| 3982 | F: tools/power/cpupower/ | 3989 | F: tools/power/cpupower/ |
| @@ -4006,13 +4013,14 @@ S: Supported · 23 unmodified lines | |||
| 4006 | F: drivers/cpuidle/cpuidle-exynos.c | 4013 | F: drivers/cpuidle/cpuidle-exynos.c |
| 4007 | F: arch/arm/mach-exynos/pm.c | 4014 | F: arch/arm/mach-exynos/pm.c |
| 4008 | 4015 | ||
| 4009 | CPUIDLE DRIVERS | 4016 | CPU IDLE TIME MANAGEMENT FRAMEWORK |
| 4010 | M: "Rafael J. Wysocki" <rjw@rjwysocki.net> | 4017 | M: "Rafael J. Wysocki" <rjw@rjwysocki.net> |
| 4011 | M: Daniel Lezcano <daniel.lezcano@linaro.org> | 4018 | M: Daniel Lezcano <daniel.lezcano@linaro.org> |
| 4012 | L: linux-pm@vger.kernel.org | 4019 | L: linux-pm@vger.kernel.org |
| 4013 | S: Maintained | 4020 | S: Maintained |
| 4014 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git | 4021 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git |
| 4015 | B: https://bugzilla.kernel.org | 4022 | B: https://bugzilla.kernel.org |
| 4023 | F: Documentation/admin-guide/pm/cpuidle.rst | ||
| 4016 | F: drivers/cpuidle/* | 4024 | F: drivers/cpuidle/* |
| 4017 | F: include/linux/cpuidle.h | 4025 | F: include/linux/cpuidle.h |
| 4018 | 4026 | ||
| @@ -5178,7 +5186,7 @@ DRM DRIVERS FOR XEN · 1159 unmodified lines | |||
| 5178 | M: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> | 5186 | M: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> |
| 5179 | T: git git://anongit.freedesktop.org/drm/drm-misc | 5187 | T: git git://anongit.freedesktop.org/drm/drm-misc |
| 5180 | L: dri-devel@lists.freedesktop.org | 5188 | L: dri-devel@lists.freedesktop.org |
| 5181 | L: xen-devel@lists.xen.org | 5189 | L: xen-devel@lists.xenproject.org (moderated for non-subscribers) |
| 5182 | S: Supported | 5190 | S: Supported |
| 5183 | F: drivers/gpu/drm/xen/ | 5191 | F: drivers/gpu/drm/xen/ |
| 5184 | F: Documentation/gpu/xen-front.rst | 5192 | F: Documentation/gpu/xen-front.rst |
| @@ -8256,6 +8264,7 @@ F: include/uapi/linux/sunrpc/ · 3071 unmodified lines | |||
| 8256 | 8264 | ||
| 8257 | KERNEL SELFTEST FRAMEWORK | 8265 | KERNEL SELFTEST FRAMEWORK |
| 8258 | M: Shuah Khan <shuah@kernel.org> | 8266 | M: Shuah Khan <shuah@kernel.org> |
| 8267 | M: Shuah Khan <skhan@linuxfoundation.org> | ||
| 8259 | L: linux-kselftest@vger.kernel.org | 8268 | L: linux-kselftest@vger.kernel.org |
| 8260 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git | 8269 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git |
| 8261 | Q: https://patchwork.kernel.org/project/linux-kselftest/list/ | 8270 | Q: https://patchwork.kernel.org/project/linux-kselftest/list/ |
| @@ -10686,9 +10695,9 @@ S: Maintained · 2424 unmodified lines | |||
| 10686 | F: drivers/net/netdevsim/* | 10695 | F: drivers/net/netdevsim/* |
| 10687 | 10696 | ||
| 10688 | NETXEN (1/10) GbE SUPPORT | 10697 | NETXEN (1/10) GbE SUPPORT |
| 10689 | M: Manish Chopra <manish.chopra@cavium.com> | 10698 | M: Manish Chopra <manishc@marvell.com> |
| 10690 | M: Rahul Verma <rahul.verma@cavium.com> | 10699 | M: Rahul Verma <rahulv@marvell.com> |
| 10691 | M: Dept-GELinuxNICDev@cavium.com | 10700 | M: GR-Linux-NIC-Dev@marvell.com |
| 10692 | L: netdev@vger.kernel.org | 10701 | L: netdev@vger.kernel.org |
| 10693 | S: Supported | 10702 | S: Supported |
| 10694 | F: drivers/net/ethernet/qlogic/netxen/ | 10703 | F: drivers/net/ethernet/qlogic/netxen/ |
| @@ -11303,10 +11312,12 @@ F: include/dt-bindings/ · 608 unmodified lines | |||
| 11303 | 11312 | ||
| 11304 | OPENCORES I2C BUS DRIVER | 11313 | OPENCORES I2C BUS DRIVER |
| 11305 | M: Peter Korsgaard <peter@korsgaard.com> | 11314 | M: Peter Korsgaard <peter@korsgaard.com> |
| 11315 | M: Andrew Lunn <andrew@lunn.ch> | ||
| 11306 | L: linux-i2c@vger.kernel.org | 11316 | L: linux-i2c@vger.kernel.org |
| 11307 | S: Maintained | 11317 | S: Maintained |
| 11308 | F: Documentation/i2c/busses/i2c-ocores | 11318 | F: Documentation/i2c/busses/i2c-ocores |
| 11309 | F: drivers/i2c/busses/i2c-ocores.c | 11319 | F: drivers/i2c/busses/i2c-ocores.c |
| 11320 | F: include/linux/platform_data/i2c-ocores.h | ||
| 11310 | 11321 | ||
| 11311 | OPENRISC ARCHITECTURE | 11322 | OPENRISC ARCHITECTURE |
| 11312 | M: Jonas Bonn <jonas@southpole.se> | 11323 | M: Jonas Bonn <jonas@southpole.se> |
| @@ -12472,8 +12483,8 @@ S: Supported · 1159 unmodified lines | |||
| 12472 | F: drivers/scsi/qedi/ | 12483 | F: drivers/scsi/qedi/ |
| 12473 | 12484 | ||
| 12474 | QLOGIC QL4xxx ETHERNET DRIVER | 12485 | QLOGIC QL4xxx ETHERNET DRIVER |
| 12475 | M: Ariel Elior <Ariel.Elior@cavium.com> | 12486 | M: Ariel Elior <aelior@marvell.com> |
| 12476 | M: everest-linux-l2@cavium.com | 12487 | M: GR-everest-linux-l2@marvell.com |
| 12477 | L: netdev@vger.kernel.org | 12488 | L: netdev@vger.kernel.org |
| 12478 | S: Supported | 12489 | S: Supported |
| 12479 | F: drivers/net/ethernet/qlogic/qed/ | 12490 | F: drivers/net/ethernet/qlogic/qed/ |
| @@ -12481,8 +12492,8 @@ F: include/linux/qed/ · 1 unmodified line | |||
| 12481 | F: drivers/net/ethernet/qlogic/qede/ | 12492 | F: drivers/net/ethernet/qlogic/qede/ |
| 12482 | 12493 | ||
| 12483 | QLOGIC QL4xxx RDMA DRIVER | 12494 | QLOGIC QL4xxx RDMA DRIVER |
| 12484 | M: Michal Kalderon <Michal.Kalderon@cavium.com> | 12495 | M: Michal Kalderon <mkalderon@marvell.com> |
| 12485 | M: Ariel Elior <Ariel.Elior@cavium.com> | 12496 | M: Ariel Elior <aelior@marvell.com> |
| 12486 | L: linux-rdma@vger.kernel.org | 12497 | L: linux-rdma@vger.kernel.org |
| 12487 | S: Supported | 12498 | S: Supported |
| 12488 | F: drivers/infiniband/hw/qedr/ | 12499 | F: drivers/infiniband/hw/qedr/ |
| @@ -12502,7 +12513,7 @@ F: Documentation/scsi/LICENSE.qla2xxx · 13 unmodified lines | |||
| 12502 | F: drivers/scsi/qla2xxx/ | 12513 | F: drivers/scsi/qla2xxx/ |
| 12503 | 12514 | ||
| 12504 | QLOGIC QLA3XXX NETWORK DRIVER | 12515 | QLOGIC QLA3XXX NETWORK DRIVER |
| 12505 | M: Dept-GELinuxNICDev@cavium.com | 12516 | M: GR-Linux-NIC-Dev@marvell.com |
| 12506 | L: netdev@vger.kernel.org | 12517 | L: netdev@vger.kernel.org |
| 12507 | S: Supported | 12518 | S: Supported |
| 12508 | F: Documentation/networking/device_drivers/qlogic/LICENSE.qla3xxx | 12519 | F: Documentation/networking/device_drivers/qlogic/LICENSE.qla3xxx |
| @@ -12516,16 +12527,16 @@ F: Documentation/scsi/LICENSE.qla4xxx · 7 unmodified lines | |||
| 12516 | F: drivers/scsi/qla4xxx/ | 12527 | F: drivers/scsi/qla4xxx/ |
| 12517 | 12528 | ||
| 12518 | QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER | 12529 | QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER |
| 12519 | M: Shahed Shaikh <Shahed.Shaikh@cavium.com> | 12530 | M: Shahed Shaikh <shshaikh@marvell.com> |
| 12520 | M: Manish Chopra <manish.chopra@cavium.com> | 12531 | M: Manish Chopra <manishc@marvell.com> |
| 12521 | M: Dept-GELinuxNICDev@cavium.com | 12532 | M: GR-Linux-NIC-Dev@marvell.com |
| 12522 | L: netdev@vger.kernel.org | 12533 | L: netdev@vger.kernel.org |
| 12523 | S: Supported | 12534 | S: Supported |
| 12524 | F: drivers/net/ethernet/qlogic/qlcnic/ | 12535 | F: drivers/net/ethernet/qlogic/qlcnic/ |
| 12525 | 12536 | ||
| 12526 | QLOGIC QLGE 10Gb ETHERNET DRIVER | 12537 | QLOGIC QLGE 10Gb ETHERNET DRIVER |
| 12527 | M: Manish Chopra <manish.chopra@cavium.com> | 12538 | M: Manish Chopra <manishc@marvell.com> |
| 12528 | M: Dept-GELinuxNICDev@cavium.com | 12539 | M: GR-Linux-NIC-Dev@marvell.com |
| 12529 | L: netdev@vger.kernel.org | 12540 | L: netdev@vger.kernel.org |
| 12530 | S: Supported | 12541 | S: Supported |
| 12531 | F: drivers/net/ethernet/qlogic/qlge/ | 12542 | F: drivers/net/ethernet/qlogic/qlge/ |
| @@ -12864,6 +12875,13 @@ F: Documentation/devicetree/bindings/net/dsa/realtek-smi.txt · 332 unmodified lines | |||
| 12864 | F: drivers/net/dsa/realtek-smi* | 12875 | F: drivers/net/dsa/realtek-smi* |
| 12865 | F: drivers/net/dsa/rtl83* | 12876 | F: drivers/net/dsa/rtl83* |
| 12866 | 12877 | ||
| 12878 | REDPINE WIRELESS DRIVER | ||
| 12879 | M: Amitkumar Karwar <amitkarwar@gmail.com> | ||
| 12880 | M: Siva Rebbagondla <siva8118@gmail.com> | ||
| 12881 | L: linux-wireless@vger.kernel.org | ||
| 12882 | S: Maintained | ||
| 12883 | F: drivers/net/wireless/rsi/ | ||
| 12884 | |||
| 12867 | REGISTER MAP ABSTRACTION | 12885 | REGISTER MAP ABSTRACTION |
| 12868 | M: Mark Brown <broonie@kernel.org> | 12886 | M: Mark Brown <broonie@kernel.org> |
| 12869 | L: linux-kernel@vger.kernel.org | 12887 | L: linux-kernel@vger.kernel.org |
| @@ -13692,6 +13710,15 @@ L: netdev@vger.kernel.org · 822 unmodified lines | |||
| 13692 | S: Supported | 13710 | S: Supported |
| 13693 | F: drivers/net/ethernet/sfc/ | 13711 | F: drivers/net/ethernet/sfc/ |
| 13694 | 13712 | ||
| 13713 | SFF/SFP/SFP+ MODULE SUPPORT | ||
| 13714 | M: Russell King <linux@armlinux.org.uk> | ||
| 13715 | L: netdev@vger.kernel.org | ||
| 13716 | S: Maintained | ||
| 13717 | F: drivers/net/phy/phylink.c | ||
| 13718 | F: drivers/net/phy/sfp* | ||
| 13719 | F: include/linux/phylink.h | ||
| 13720 | F: include/linux/sfp.h | ||
| 13721 | |||
| 13695 | SGI GRU DRIVER | 13722 | SGI GRU DRIVER |
| 13696 | M: Dimitri Sivanich <sivanich@sgi.com> | 13723 | M: Dimitri Sivanich <sivanich@sgi.com> |
| 13697 | S: Maintained | 13724 | S: Maintained |
| @@ -13820,8 +13847,9 @@ F: drivers/media/mmc/siano/ · 122 unmodified lines | |||
| 13820 | 13847 | ||
| 13821 | SIFIVE DRIVERS | 13848 | SIFIVE DRIVERS |
| 13822 | M: Palmer Dabbelt <palmer@sifive.com> | 13849 | M: Palmer Dabbelt <palmer@sifive.com> |
| 13850 | M: Paul Walmsley <paul.walmsley@sifive.com> | ||
| 13823 | L: linux-riscv@lists.infradead.org | 13851 | L: linux-riscv@lists.infradead.org |
| 13824 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux.git | 13852 | T: git git://github.com/sifive/riscv-linux.git |
| 13825 | S: Supported | 13853 | S: Supported |
| 13826 | K: sifive | 13854 | K: sifive |
| 13827 | N: sifive | 13855 | N: sifive |
| @@ -14432,6 +14460,11 @@ M: Florian Schilhabel <florian.c.schilhabel@googlemail.com>. · 604 unmodified lines | |||
| 14432 | S: Odd Fixes | 14460 | S: Odd Fixes |
| 14433 | F: drivers/staging/rtl8712/ | 14461 | F: drivers/staging/rtl8712/ |
| 14434 | 14462 | ||
| 14463 | STAGING - REALTEK RTL8188EU DRIVERS | ||
| 14464 | M: Larry Finger <Larry.Finger@lwfinger.net> | ||
| 14465 | S: Odd Fixes | ||
| 14466 | F: drivers/staging/rtl8188eu/ | ||
| 14467 | |||
| 14435 | STAGING - SILICON MOTION SM750 FRAME BUFFER DRIVER | 14468 | STAGING - SILICON MOTION SM750 FRAME BUFFER DRIVER |
| 14436 | M: Sudip Mukherjee <sudipm.mukherjee@gmail.com> | 14469 | M: Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
| 14437 | M: Teddy Wang <teddy.wang@siliconmotion.com> | 14470 | M: Teddy Wang <teddy.wang@siliconmotion.com> |
| @@ -15802,7 +15835,6 @@ M: Alan Stern <stern@rowland.harvard.edu> · 1364 unmodified lines | |||
| 15802 | L: linux-usb@vger.kernel.org | 15835 | L: linux-usb@vger.kernel.org |
| 15803 | L: usb-storage@lists.one-eyed-alien.net | 15836 | L: usb-storage@lists.one-eyed-alien.net |
| 15804 | S: Maintained | 15837 | S: Maintained |
| 15805 | W: http://www.one-eyed-alien.net/~mdharm/linux-usb/ | ||
| 15806 | F: drivers/usb/storage/ | 15838 | F: drivers/usb/storage/ |
| 15807 | 15839 | ||
| 15808 | USB MIDI DRIVER | 15840 | USB MIDI DRIVER |
| @@ -15834,6 +15866,7 @@ F: drivers/usb/common/usb-otg-fsm.c · 25 unmodified lines | |||
| 15834 | USB OVER IP DRIVER | 15866 | USB OVER IP DRIVER |
| 15835 | M: Valentina Manea <valentina.manea.m@gmail.com> | 15867 | M: Valentina Manea <valentina.manea.m@gmail.com> |
| 15836 | M: Shuah Khan <shuah@kernel.org> | 15868 | M: Shuah Khan <shuah@kernel.org> |
| 15869 | M: Shuah Khan <skhan@linuxfoundation.org> | ||
| 15837 | L: linux-usb@vger.kernel.org | 15870 | L: linux-usb@vger.kernel.org |
| 15838 | S: Maintained | 15871 | S: Maintained |
| 15839 | F: Documentation/usb/usbip_protocol.txt | 15872 | F: Documentation/usb/usbip_protocol.txt |
| @@ -16631,6 +16664,15 @@ S: Maintained · 791 unmodified lines | |||
| 16631 | F: drivers/platform/x86/ | 16664 | F: drivers/platform/x86/ |
| 16632 | F: drivers/platform/olpc/ | 16665 | F: drivers/platform/olpc/ |
| 16633 | 16666 | ||
| 16667 | X86 PLATFORM DRIVERS - ARCH | ||
| 16668 | R: Darren Hart <dvhart@infradead.org> | ||
| 16669 | R: Andy Shevchenko <andy@infradead.org> | ||
| 16670 | L: platform-driver-x86@vger.kernel.org | ||
| 16671 | L: x86@kernel.org | ||
| 16672 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core | ||
| 16673 | S: Maintained | ||
| 16674 | F: arch/x86/platform | ||
| 16675 | |||
| 16634 | X86 VDSO | 16676 | X86 VDSO |
| 16635 | M: Andy Lutomirski <luto@kernel.org> | 16677 | M: Andy Lutomirski <luto@kernel.org> |
| 16636 | L: linux-kernel@vger.kernel.org | 16678 | L: linux-kernel@vger.kernel.org |
| @@ -16663,6 +16705,24 @@ T: git git://linuxtv.org/media_tree.git · 26 unmodified lines | |||
| 16663 | S: Maintained | 16705 | S: Maintained |
| 16664 | F: drivers/media/tuners/tuner-xc2028.* | 16706 | F: drivers/media/tuners/tuner-xc2028.* |
| 16665 | 16707 | ||
| 16708 | XDP (eXpress Data Path) | ||
| 16709 | M: Alexei Starovoitov <ast@kernel.org> | ||
| 16710 | M: Daniel Borkmann <daniel@iogearbox.net> | ||
| 16711 | M: David S. Miller <davem@davemloft.net> | ||
| 16712 | M: Jakub Kicinski <jakub.kicinski@netronome.com> | ||
| 16713 | M: Jesper Dangaard Brouer <hawk@kernel.org> | ||
| 16714 | M: John Fastabend <john.fastabend@gmail.com> | ||
| 16715 | L: netdev@vger.kernel.org | ||
| 16716 | L: xdp-newbies@vger.kernel.org | ||
| 16717 | S: Supported | ||
| 16718 | F: net/core/xdp.c | ||
| 16719 | F: include/net/xdp.h | ||
| 16720 | F: kernel/bpf/devmap.c | ||
| 16721 | F: kernel/bpf/cpumap.c | ||
| 16722 | F: include/trace/events/xdp.h | ||
| 16723 | K: xdp | ||
| 16724 | N: xdp | ||
| 16725 | |||
| 16666 | XDP SOCKETS (AF_XDP) | 16726 | XDP SOCKETS (AF_XDP) |
| 16667 | M: Björn Töpel <bjorn.topel@intel.com> | 16727 | M: Björn Töpel <bjorn.topel@intel.com> |
| 16668 | M: Magnus Karlsson <magnus.karlsson@intel.com> | 16728 | M: Magnus Karlsson <magnus.karlsson@intel.com> |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | VERSION = 5 | 2 | VERSION = 5 |
| 3 | PATCHLEVEL = 0 | 3 | PATCHLEVEL = 0 |
| 4 | SUBLEVEL = 0 | 4 | SUBLEVEL = 0 |
| 5 | EXTRAVERSION = -rc1 | 5 | EXTRAVERSION = -rc6 |
| 6 | NAME = Shy Crocodile | 6 | NAME = Shy Crocodile |
| 7 | 7 | ||
| 8 | # *DOCUMENTATION* | 8 | # *DOCUMENTATION* |
| @@ -955,6 +955,7 @@ ifdef CONFIG_STACK_VALIDATION · 946 unmodified lines | |||
| 955 | endif | 955 | endif |
| 956 | endif | 956 | endif |
| 957 | 957 | ||
| 958 | PHONY += prepare0 | ||
| 958 | 959 | ||
| 959 | ifeq ($(KBUILD_EXTMOD),) | 960 | ifeq ($(KBUILD_EXTMOD),) |
| 960 | core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/ | 961 | core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/ |
| @@ -1061,8 +1062,7 @@ scripts: scripts_basic scripts_dtc · 100 unmodified lines | |||
| 1061 | # archprepare is used in arch Makefiles and when processed asm symlink, | 1062 | # archprepare is used in arch Makefiles and when processed asm symlink, |
| 1062 | # version.h and scripts_basic is processed / created. | 1063 | # version.h and scripts_basic is processed / created. |
| 1063 | 1064 | ||
| 1064 | # Listed in dependency order | 1065 | PHONY += prepare archprepare prepare1 prepare2 prepare3 |
| 1065 | PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 | ||
| 1066 | 1066 | ||
| 1067 | # prepare3 is used to check if we are building in a separate output directory, | 1067 | # prepare3 is used to check if we are building in a separate output directory, |
| 1068 | # and if so do: | 1068 | # and if so do: |
| @@ -1360,11 +1360,11 @@ mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS)) · 291 unmodified lines | |||
| 1360 | mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) | 1360 | mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) |
| 1361 | mrproper-dirs := $(addprefix _mrproper_,scripts) | 1361 | mrproper-dirs := $(addprefix _mrproper_,scripts) |
| 1362 | 1362 | ||
| 1363 | PHONY += $(mrproper-dirs) mrproper archmrproper | 1363 | PHONY += $(mrproper-dirs) mrproper |
| 1364 | $(mrproper-dirs): | 1364 | $(mrproper-dirs): |
| 1365 | $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) | 1365 | $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) |
| 1366 | 1366 | ||
| 1367 | mrproper: clean archmrproper $(mrproper-dirs) | 1367 | mrproper: clean $(mrproper-dirs) |
| 1368 | $(call cmd,rmdirs) | 1368 | $(call cmd,rmdirs) |
| 1369 | $(call cmd,rmfiles) | 1369 | $(call cmd,rmfiles) |
| 1370 | 1370 | ||
| @@ -3,23 +3,19 @@ generic-y += bugs.h · 2 unmodified lines | |||
| 3 | generic-y += compat.h | 3 | generic-y += compat.h |
| 4 | generic-y += device.h | 4 | generic-y += device.h |
| 5 | generic-y += div64.h | 5 | generic-y += div64.h |
| 6 | generic-y += dma-mapping.h | ||
| 7 | generic-y += emergency-restart.h | 6 | generic-y += emergency-restart.h |
| 8 | generic-y += extable.h | 7 | generic-y += extable.h |
| 9 | generic-y += fb.h | ||
| 10 | generic-y += ftrace.h | 8 | generic-y += ftrace.h |
| 11 | generic-y += hardirq.h | 9 | generic-y += hardirq.h |
| 12 | generic-y += hw_irq.h | 10 | generic-y += hw_irq.h |
| 13 | generic-y += irq_regs.h | 11 | generic-y += irq_regs.h |
| 14 | generic-y += irq_work.h | 12 | generic-y += irq_work.h |
| 15 | generic-y += kmap_types.h | ||
| 16 | generic-y += local.h | 13 | generic-y += local.h |
| 17 | generic-y += local64.h | 14 | generic-y += local64.h |
| 18 | generic-y += mcs_spinlock.h | 15 | generic-y += mcs_spinlock.h |
| 19 | generic-y += mm-arch-hooks.h | 16 | generic-y += mm-arch-hooks.h |
| 20 | generic-y += msi.h | 17 | generic-y += msi.h |
| 21 | generic-y += parport.h | 18 | generic-y += parport.h |
| 22 | generic-y += pci.h | ||
| 23 | generic-y += percpu.h | 19 | generic-y += percpu.h |
| 24 | generic-y += preempt.h | 20 | generic-y += preempt.h |
| 25 | generic-y += topology.h | 21 | generic-y += topology.h |
| @@ -216,6 +216,14 @@ struct bcr_fp_arcv2 { · 215 unmodified lines | |||
| 216 | #endif | 216 | #endif |
| 217 | }; | 217 | }; |
| 218 | 218 | ||
| 219 | struct bcr_actionpoint { | ||
| 220 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
| 221 | unsigned int pad:21, min:1, num:2, ver:8; | ||
| 222 | #else | ||
| 223 | unsigned int ver:8, num:2, min:1, pad:21; | ||
| 224 | #endif | ||
| 225 | }; | ||
| 226 | |||
| 219 | #include <soc/arc/timers.h> | 227 | #include <soc/arc/timers.h> |
| 220 | 228 | ||
| 221 | struct bcr_bpu_arcompact { | 229 | struct bcr_bpu_arcompact { |
| @@ -283,7 +291,7 @@ struct cpuinfo_arc_cache { · 61 unmodified lines | |||
| 283 | }; | 291 | }; |
| 284 | 292 | ||
| 285 | struct cpuinfo_arc_bpu { | 293 | struct cpuinfo_arc_bpu { |
| 286 | unsigned int ver, full, num_cache, num_pred; | 294 | unsigned int ver, full, num_cache, num_pred, ret_stk; |
| 287 | }; | 295 | }; |
| 288 | 296 | ||
| 289 | struct cpuinfo_arc_ccm { | 297 | struct cpuinfo_arc_ccm { |
| @@ -302,7 +310,7 @@ struct cpuinfo_arc { · 12 unmodified lines | |||
| 302 | struct { | 310 | struct { |
| 303 | unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, swape:1, pad1:2, | 311 | unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, swape:1, pad1:2, |
| 304 | fpu_sp:1, fpu_dp:1, dual:1, dual_enb:1, pad2:4, | 312 | fpu_sp:1, fpu_dp:1, dual:1, dual_enb:1, pad2:4, |
| 305 | debug:1, ap:1, smart:1, rtt:1, pad3:4, | 313 | ap_num:4, ap_full:1, smart:1, rtt:1, pad3:1, |
| 306 | timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4; | 314 | timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4; |
| 307 | } extn; | 315 | } extn; |
| 308 | struct bcr_mpy extn_mpy; | 316 | struct bcr_mpy extn_mpy; |
| @@ -340,7 +340,7 @@ static inline __attribute__ ((const)) int __fls(unsigned long x) · 339 unmodified lines | |||
| 340 | /* | 340 | /* |
| 341 | * __ffs: Similar to ffs, but zero based (0-31) | 341 | * __ffs: Similar to ffs, but zero based (0-31) |
| 342 | */ | 342 | */ |
| 343 | static inline __attribute__ ((const)) int __ffs(unsigned long word) | 343 | static inline __attribute__ ((const)) unsigned long __ffs(unsigned long word) |
| 344 | { | 344 | { |
| 345 | if (!word) | 345 | if (!word) |
| 346 | return word; | 346 | return word; |
| @@ -400,9 +400,9 @@ static inline __attribute__ ((const)) int ffs(unsigned long x) · 53 unmodified lines | |||
| 400 | /* | 400 | /* |
| 401 | * __ffs: Similar to ffs, but zero based (0-31) | 401 | * __ffs: Similar to ffs, but zero based (0-31) |
| 402 | */ | 402 | */ |
| 403 | static inline __attribute__ ((const)) int __ffs(unsigned long x) | 403 | static inline __attribute__ ((const)) unsigned long __ffs(unsigned long x) |
| 404 | { | 404 | { |
| 405 | int n; | 405 | unsigned long n; |
| 406 | 406 | ||
| 407 | asm volatile( | 407 | asm volatile( |
| 408 | " ffs.f %0, %1 \n" /* 0:31; 31(Z) if src 0 */ | 408 | " ffs.f %0, %1 \n" /* 0:31; 31(Z) if src 0 */ |
| @@ -103,7 +103,8 @@ static const char * const arc_pmu_ev_hw_map[] = { · 102 unmodified lines | |||
| 103 | 103 | ||
| 104 | /* counts condition */ | 104 | /* counts condition */ |
| 105 | [PERF_COUNT_HW_INSTRUCTIONS] = "iall", | 105 | [PERF_COUNT_HW_INSTRUCTIONS] = "iall", |
| 106 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = "ijmp", /* Excludes ZOL jumps */ | 106 | /* All jump instructions that are taken */ |
| 107 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = "ijmptak", | ||
| 107 | [PERF_COUNT_ARC_BPOK] = "bpok", /* NP-NT, PT-T, PNT-NT */ | 108 | [PERF_COUNT_ARC_BPOK] = "bpok", /* NP-NT, PT-T, PNT-NT */ |
| 108 | #ifdef CONFIG_ISA_ARCV2 | 109 | #ifdef CONFIG_ISA_ARCV2 |
| 109 | [PERF_COUNT_HW_BRANCH_MISSES] = "bpmp", | 110 | [PERF_COUNT_HW_BRANCH_MISSES] = "bpmp", |
| @@ -1,15 +1,10 @@ | |||
| 1 | /* | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | * Linux performance counter support for ARC700 series | 2 | // |
| 3 | * | 3 | // Linux performance counter support for ARC CPUs. |
| 4 | * Copyright (C) 2013-2015 Synopsys, Inc. (www.synopsys.com) | 4 | // This code is inspired by the perf support of various other architectures. |
| 5 | * | 5 | // |
| 6 | * This code is inspired by the perf support of various other architectures. | 6 | // Copyright (C) 2013-2018 Synopsys, Inc. (www.synopsys.com) |
| 7 | * | 7 | |
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | * | ||
| 12 | */ | ||
| 13 | #include <linux/errno.h> | 8 | #include <linux/errno.h> |
| 14 | #include <linux/interrupt.h> | 9 | #include <linux/interrupt.h> |
| 15 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| @@ -19,12 +14,31 @@ · 3 unmodified lines | |||
| 19 | #include <asm/arcregs.h> | 14 | #include <asm/arcregs.h> |
| 20 | #include <asm/stacktrace.h> | 15 | #include <asm/stacktrace.h> |
| 21 | 16 | ||
| 17 | /* HW holds 8 symbols + one for null terminator */ | ||
| 18 | #define ARCPMU_EVENT_NAME_LEN 9 | ||
| 19 | |||
| 20 | enum arc_pmu_attr_groups { | ||
| 21 | ARCPMU_ATTR_GR_EVENTS, | ||
| 22 | ARCPMU_ATTR_GR_FORMATS, | ||
| 23 | ARCPMU_NR_ATTR_GR | ||
| 24 | }; | ||
| 25 | |||
| 26 | struct arc_pmu_raw_event_entry { | ||
| 27 | char name[ARCPMU_EVENT_NAME_LEN]; | ||
| 28 | }; | ||
| 29 | |||
| 22 | struct arc_pmu { | 30 | struct arc_pmu { |
| 23 | struct pmu pmu; | 31 | struct pmu pmu; |
| 24 | unsigned int irq; | 32 | unsigned int irq; |
| 25 | int n_counters; | 33 | int n_counters; |
| 34 | int n_events; | ||
| 26 | u64 max_period; | 35 | u64 max_period; |
| 27 | int ev_hw_idx[PERF_COUNT_ARC_HW_MAX]; | 36 | int ev_hw_idx[PERF_COUNT_ARC_HW_MAX]; |
| 37 | |||
| 38 | struct arc_pmu_raw_event_entry *raw_entry; | ||
| 39 | struct attribute **attrs; | ||
| 40 | struct perf_pmu_events_attr *attr; | ||
| 41 | const struct attribute_group *attr_groups[ARCPMU_NR_ATTR_GR + 1]; | ||
| 28 | }; | 42 | }; |
| 29 | 43 | ||
| 30 | struct arc_pmu_cpu { | 44 | struct arc_pmu_cpu { |
| @@ -49,6 +63,7 @@ static int callchain_trace(unsigned int addr, void *data) · 18 unmodified lines | |||
| 49 | { | 63 | { |
| 50 | struct arc_callchain_trace *ctrl = data; | 64 | struct arc_callchain_trace *ctrl = data; |
| 51 | struct perf_callchain_entry_ctx *entry = ctrl->perf_stuff; | 65 | struct perf_callchain_entry_ctx *entry = ctrl->perf_stuff; |
| 66 | |||
| 52 | perf_callchain_store(entry, addr); | 67 | perf_callchain_store(entry, addr); |
| 53 | 68 | ||
| 54 | if (ctrl->depth++ < 3) | 69 | if (ctrl->depth++ < 3) |
| @@ -57,8 +72,8 @@ static int callchain_trace(unsigned int addr, void *data) · 2 unmodified lines | |||
| 57 | return -1; | 72 | return -1; |
| 58 | } | 73 | } |
| 59 | 74 | ||
| 60 | void | 75 | void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, |
| 61 | perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs) | 76 | struct pt_regs *regs) |
| 62 | { | 77 | { |
| 63 | struct arc_callchain_trace ctrl = { | 78 | struct arc_callchain_trace ctrl = { |
| 64 | .depth = 0, | 79 | .depth = 0, |
| @@ -68,8 +83,8 @@ perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *re · 3 unmodified lines | |||
| 68 | arc_unwind_core(NULL, regs, callchain_trace, &ctrl); | 83 | arc_unwind_core(NULL, regs, callchain_trace, &ctrl); |
| 69 | } | 84 | } |
| 70 | 85 | ||
| 71 | void | 86 | void perf_callchain_user(struct perf_callchain_entry_ctx *entry, |
| 72 | perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs) | 87 | struct pt_regs *regs) |
| 73 | { | 88 | { |
| 74 | /* | 89 | /* |
| 75 | * User stack can't be unwound trivially with kernel dwarf unwinder | 90 | * User stack can't be unwound trivially with kernel dwarf unwinder |
| @@ -82,10 +97,10 @@ static struct arc_pmu *arc_pmu; · 6 unmodified lines | |||
| 82 | static DEFINE_PER_CPU(struct arc_pmu_cpu, arc_pmu_cpu); | 97 | static DEFINE_PER_CPU(struct arc_pmu_cpu, arc_pmu_cpu); |
| 83 | 98 | ||
| 84 | /* read counter #idx; note that counter# != event# on ARC! */ | 99 | /* read counter #idx; note that counter# != event# on ARC! */ |
| 85 | static uint64_t arc_pmu_read_counter(int idx) | 100 | static u64 arc_pmu_read_counter(int idx) |
| 86 | { | 101 | { |
| 87 | uint32_t tmp; | 102 | u32 tmp; |
| 88 | uint64_t result; | 103 | u64 result; |
| 89 | 104 | ||
| 90 | /* | 105 | /* |
| 91 | * ARC supports making 'snapshots' of the counters, so we don't | 106 | * ARC supports making 'snapshots' of the counters, so we don't |
| @@ -94,7 +109,7 @@ static uint64_t arc_pmu_read_counter(int idx) · 2 unmodified lines | |||
| 94 | write_aux_reg(ARC_REG_PCT_INDEX, idx); | 109 | write_aux_reg(ARC_REG_PCT_INDEX, idx); |
| 95 | tmp = read_aux_reg(ARC_REG_PCT_CONTROL); | 110 | tmp = read_aux_reg(ARC_REG_PCT_CONTROL); |
| 96 | write_aux_reg(ARC_REG_PCT_CONTROL, tmp | ARC_REG_PCT_CONTROL_SN); | 111 | write_aux_reg(ARC_REG_PCT_CONTROL, tmp | ARC_REG_PCT_CONTROL_SN); |
| 97 | result = (uint64_t) (read_aux_reg(ARC_REG_PCT_SNAPH)) << 32; | 112 | result = (u64) (read_aux_reg(ARC_REG_PCT_SNAPH)) << 32; |
| 98 | result |= read_aux_reg(ARC_REG_PCT_SNAPL); | 113 | result |= read_aux_reg(ARC_REG_PCT_SNAPL); |
| 99 | 114 | ||
| 100 | return result; | 115 | return result; |
| @@ -103,9 +118,9 @@ static uint64_t arc_pmu_read_counter(int idx) · 2 unmodified lines | |||
| 103 | static void arc_perf_event_update(struct perf_event *event, | 118 | static void arc_perf_event_update(struct perf_event *event, |
| 104 | struct hw_perf_event *hwc, int idx) | 119 | struct hw_perf_event *hwc, int idx) |
| 105 | { | 120 | { |
| 106 | uint64_t prev_raw_count = local64_read(&hwc->prev_count); | 121 | u64 prev_raw_count = local64_read(&hwc->prev_count); |
| 107 | uint64_t new_raw_count = arc_pmu_read_counter(idx); | 122 | u64 new_raw_count = arc_pmu_read_counter(idx); |
| 108 | int64_t delta = new_raw_count - prev_raw_count; | 123 | s64 delta = new_raw_count - prev_raw_count; |
| 109 | 124 | ||
| 110 | /* | 125 | /* |
| 111 | * We aren't afraid of hwc->prev_count changing beneath our feet | 126 | * We aren't afraid of hwc->prev_count changing beneath our feet |
| @@ -155,7 +170,7 @@ static int arc_pmu_event_init(struct perf_event *event) · 43 unmodified lines | |||
| 155 | int ret; | 170 | int ret; |
| 156 | 171 | ||
| 157 | if (!is_sampling_event(event)) { | 172 | if (!is_sampling_event(event)) { |
| 158 | hwc->sample_period = arc_pmu->max_period; | 173 | hwc->sample_period = arc_pmu->max_period; |
| 159 | hwc->last_period = hwc->sample_period; | 174 | hwc->last_period = hwc->sample_period; |
| 160 | local64_set(&hwc->period_left, hwc->sample_period); | 175 | local64_set(&hwc->period_left, hwc->sample_period); |
| 161 | } | 176 | } |
| @@ -192,6 +207,18 @@ static int arc_pmu_event_init(struct perf_event *event) · 30 unmodified lines | |||
| 192 | pr_debug("init cache event with h/w %08x \'%s\'\n", | 207 | pr_debug("init cache event with h/w %08x \'%s\'\n", |
| 193 | (int)hwc->config, arc_pmu_ev_hw_map[ret]); | 208 | (int)hwc->config, arc_pmu_ev_hw_map[ret]); |
| 194 | return 0; | 209 | return 0; |
| 210 | |||
| 211 | case PERF_TYPE_RAW: | ||
| 212 | if (event->attr.config >= arc_pmu->n_events) | ||
| 213 | return -ENOENT; | ||
| 214 | |||
| 215 | hwc->config |= event->attr.config; | ||
| 216 | pr_debug("init raw event with idx %lld \'%s\'\n", | ||
| 217 | event->attr.config, | ||
| 218 | arc_pmu->raw_entry[event->attr.config].name); | ||
| 219 | |||
| 220 | return 0; | ||
| 221 | |||
| 195 | default: | 222 | default: |
| 196 | return -ENOENT; | 223 | return -ENOENT; |
| 197 | } | 224 | } |
| @@ -200,7 +227,7 @@ static int arc_pmu_event_init(struct perf_event *event) · 2 unmodified lines | |||
| 200 | /* starts all counters */ | 227 | /* starts all counters */ |
| 201 | static void arc_pmu_enable(struct pmu *pmu) | 228 | static void arc_pmu_enable(struct pmu *pmu) |
| 202 | { | 229 | { |
| 203 | uint32_t tmp; | 230 | u32 tmp; |
| 204 | tmp = read_aux_reg(ARC_REG_PCT_CONTROL); | 231 | tmp = read_aux_reg(ARC_REG_PCT_CONTROL); |
| 205 | write_aux_reg(ARC_REG_PCT_CONTROL, (tmp & 0xffff0000) | 0x1); | 232 | write_aux_reg(ARC_REG_PCT_CONTROL, (tmp & 0xffff0000) | 0x1); |
| 206 | } | 233 | } |
| @@ -208,7 +235,7 @@ static void arc_pmu_enable(struct pmu *pmu) · 1 unmodified line | |||
| 208 | /* stops all counters */ | 235 | /* stops all counters */ |
| 209 | static void arc_pmu_disable(struct pmu *pmu) | 236 | static void arc_pmu_disable(struct pmu *pmu) |
| 210 | { | 237 | { |
| 211 | uint32_t tmp; | 238 | u32 tmp; |
| 212 | tmp = read_aux_reg(ARC_REG_PCT_CONTROL); | 239 | tmp = read_aux_reg(ARC_REG_PCT_CONTROL); |
| 213 | write_aux_reg(ARC_REG_PCT_CONTROL, (tmp & 0xffff0000) | 0x0); | 240 | write_aux_reg(ARC_REG_PCT_CONTROL, (tmp & 0xffff0000) | 0x0); |
| 214 | } | 241 | } |
| @@ -228,7 +255,7 @@ static int arc_pmu_event_set_period(struct perf_event *event) · 13 unmodified lines | |||
| 228 | local64_set(&hwc->period_left, left); | 255 | local64_set(&hwc->period_left, left); |
| 229 | hwc->last_period = period; | 256 | hwc->last_period = period; |
| 230 | overflow = 1; | 257 | overflow = 1; |
| 231 | } else if (unlikely(left <= 0)) { | 258 | } else if (unlikely(left <= 0)) { |
| 232 | /* left underflowed by less than period. */ | 259 | /* left underflowed by less than period. */ |
| 233 | left += period; | 260 | left += period; |
| 234 | local64_set(&hwc->period_left, left); | 261 | local64_set(&hwc->period_left, left); |
| @@ -246,8 +273,8 @@ static int arc_pmu_event_set_period(struct perf_event *event) · 11 unmodified lines | |||
| 246 | write_aux_reg(ARC_REG_PCT_INDEX, idx); | 273 | write_aux_reg(ARC_REG_PCT_INDEX, idx); |
| 247 | 274 | ||
| 248 | /* Write value */ | 275 | /* Write value */ |
| 249 | write_aux_reg(ARC_REG_PCT_COUNTL, (u32)value); | 276 | write_aux_reg(ARC_REG_PCT_COUNTL, lower_32_bits(value)); |
| 250 | write_aux_reg(ARC_REG_PCT_COUNTH, (value >> 32)); | 277 | write_aux_reg(ARC_REG_PCT_COUNTH, upper_32_bits(value)); |
| 251 | 278 | ||
| 252 | perf_event_update_userpage(event); | 279 | perf_event_update_userpage(event); |
| 253 | 280 | ||
| @@ -277,7 +304,7 @@ static void arc_pmu_start(struct perf_event *event, int flags) · 23 unmodified lines | |||
| 277 | /* Enable interrupt for this counter */ | 304 | /* Enable interrupt for this counter */ |
| 278 | if (is_sampling_event(event)) | 305 | if (is_sampling_event(event)) |
| 279 | write_aux_reg(ARC_REG_PCT_INT_CTRL, | 306 | write_aux_reg(ARC_REG_PCT_INT_CTRL, |
| 280 | read_aux_reg(ARC_REG_PCT_INT_CTRL) | (1 << idx)); | 307 | read_aux_reg(ARC_REG_PCT_INT_CTRL) | BIT(idx)); |
| 281 | 308 | ||
| 282 | /* enable ARC pmu here */ | 309 | /* enable ARC pmu here */ |
| 283 | write_aux_reg(ARC_REG_PCT_INDEX, idx); /* counter # */ | 310 | write_aux_reg(ARC_REG_PCT_INDEX, idx); /* counter # */ |
| @@ -295,9 +322,9 @@ static void arc_pmu_stop(struct perf_event *event, int flags) · 11 unmodified lines | |||
| 295 | * Reset interrupt flag by writing of 1. This is required | 322 | * Reset interrupt flag by writing of 1. This is required |
| 296 | * to make sure pending interrupt was not left. | 323 | * to make sure pending interrupt was not left. |
| 297 | */ | 324 | */ |
| 298 | write_aux_reg(ARC_REG_PCT_INT_ACT, 1 << idx); | 325 | write_aux_reg(ARC_REG_PCT_INT_ACT, BIT(idx)); |
| 299 | write_aux_reg(ARC_REG_PCT_INT_CTRL, | 326 | write_aux_reg(ARC_REG_PCT_INT_CTRL, |
| 300 | read_aux_reg(ARC_REG_PCT_INT_CTRL) & ~(1 << idx)); | 327 | read_aux_reg(ARC_REG_PCT_INT_CTRL) & ~BIT(idx)); |
| 301 | } | 328 | } |
| 302 | 329 | ||
| 303 | if (!(event->hw.state & PERF_HES_STOPPED)) { | 330 | if (!(event->hw.state & PERF_HES_STOPPED)) { |
| @@ -349,9 +376,10 @@ static int arc_pmu_add(struct perf_event *event, int flags) · 45 unmodified lines | |||
| 349 | 376 | ||
| 350 | if (is_sampling_event(event)) { | 377 | if (is_sampling_event(event)) { |
| 351 | /* Mimic full counter overflow as other arches do */ | 378 | /* Mimic full counter overflow as other arches do */ |
| 352 | write_aux_reg(ARC_REG_PCT_INT_CNTL, (u32)arc_pmu->max_period); | 379 | write_aux_reg(ARC_REG_PCT_INT_CNTL, |
| 380 | lower_32_bits(arc_pmu->max_period)); | ||
| 353 | write_aux_reg(ARC_REG_PCT_INT_CNTH, | 381 | write_aux_reg(ARC_REG_PCT_INT_CNTH, |
| 354 | (arc_pmu->max_period >> 32)); | 382 | upper_32_bits(arc_pmu->max_period)); |
| 355 | } | 383 | } |
| 356 | 384 | ||
| 357 | write_aux_reg(ARC_REG_PCT_CONFIG, 0); | 385 | write_aux_reg(ARC_REG_PCT_CONFIG, 0); |
| @@ -392,7 +420,7 @@ static irqreturn_t arc_pmu_intr(int irq, void *dev) · 34 unmodified lines | |||
| 392 | idx = __ffs(active_ints); | 420 | idx = __ffs(active_ints); |
| 393 | 421 | ||
| 394 | /* Reset interrupt flag by writing of 1 */ | 422 | /* Reset interrupt flag by writing of 1 */ |
| 395 | write_aux_reg(ARC_REG_PCT_INT_ACT, 1 << idx); | 423 | write_aux_reg(ARC_REG_PCT_INT_ACT, BIT(idx)); |
| 396 | 424 | ||
| 397 | /* | 425 | /* |
| 398 | * On reset of "interrupt active" bit corresponding | 426 | * On reset of "interrupt active" bit corresponding |
| @@ -400,7 +428,7 @@ static irqreturn_t arc_pmu_intr(int irq, void *dev) · 1 unmodified line | |||
| 400 | * Now we need to re-enable interrupt for the counter. | 428 | * Now we need to re-enable interrupt for the counter. |
| 401 | */ | 429 | */ |
| 402 | write_aux_reg(ARC_REG_PCT_INT_CTRL, | 430 | write_aux_reg(ARC_REG_PCT_INT_CTRL, |
| 403 | read_aux_reg(ARC_REG_PCT_INT_CTRL) | (1 << idx)); | 431 | read_aux_reg(ARC_REG_PCT_INT_CTRL) | BIT(idx)); |
| 404 | 432 | ||
| 405 | event = pmu_cpu->act_counter[idx]; | 433 | event = pmu_cpu->act_counter[idx]; |
| 406 | hwc = &event->hw; | 434 | hwc = &event->hw; |
| @@ -414,7 +442,7 @@ static irqreturn_t arc_pmu_intr(int irq, void *dev) · 7 unmodified lines | |||
| 414 | arc_pmu_stop(event, 0); | 442 | arc_pmu_stop(event, 0); |
| 415 | } | 443 | } |
| 416 | 444 | ||
| 417 | active_ints &= ~(1U << idx); | 445 | active_ints &= ~BIT(idx); |
| 418 | } while (active_ints); | 446 | } while (active_ints); |
| 419 | 447 | ||
| 420 | done: | 448 | done: |
| @@ -441,19 +469,108 @@ static void arc_cpu_pmu_irq_init(void *data) · 20 unmodified lines | |||
| 441 | write_aux_reg(ARC_REG_PCT_INT_ACT, 0xffffffff); | 469 | write_aux_reg(ARC_REG_PCT_INT_ACT, 0xffffffff); |
| 442 | } | 470 | } |
| 443 | 471 | ||
| 472 | /* Event field occupies the bottom 15 bits of our config field */ | ||
| 473 | PMU_FORMAT_ATTR(event, "config:0-14"); | ||
| 474 | static struct attribute *arc_pmu_format_attrs[] = { | ||
| 475 | &format_attr_event.attr, | ||
| 476 | NULL, | ||
| 477 | }; | ||
| 478 | |||
| 479 | static struct attribute_group arc_pmu_format_attr_gr = { | ||
| 480 | .name = "format", | ||
| 481 | .attrs = arc_pmu_format_attrs, | ||
| 482 | }; | ||
| 483 | |||
| 484 | static ssize_t arc_pmu_events_sysfs_show(struct device *dev, | ||
| 485 | struct device_attribute *attr, | ||
| 486 | char *page) | ||
| 487 | { | ||
| 488 | struct perf_pmu_events_attr *pmu_attr; | ||
| 489 | |||
| 490 | pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr); | ||
| 491 | return sprintf(page, "event=0x%04llx\n", pmu_attr->id); | ||
| 492 | } | ||
| 493 | |||
| 494 | /* | ||
| 495 | * We don't add attrs here as we don't have pre-defined list of perf events. | ||
| 496 | * We will generate and add attrs dynamically in probe() after we read HW | ||
| 497 | * configuration. | ||
| 498 | */ | ||
| 499 | static struct attribute_group arc_pmu_events_attr_gr = { | ||
| 500 | .name = "events", | ||
| 501 | }; | ||
| 502 | |||
| 503 | static void arc_pmu_add_raw_event_attr(int j, char *str) | ||
| 504 | { | ||
| 505 | memmove(arc_pmu->raw_entry[j].name, str, ARCPMU_EVENT_NAME_LEN - 1); | ||
| 506 | arc_pmu->attr[j].attr.attr.name = arc_pmu->raw_entry[j].name; | ||
| 507 | arc_pmu->attr[j].attr.attr.mode = VERIFY_OCTAL_PERMISSIONS(0444); | ||
| 508 | arc_pmu->attr[j].attr.show = arc_pmu_events_sysfs_show; | ||
| 509 | arc_pmu->attr[j].id = j; | ||
| 510 | arc_pmu->attrs[j] = &(arc_pmu->attr[j].attr.attr); | ||
| 511 | } | ||
| 512 | |||
| 513 | static int arc_pmu_raw_alloc(struct device *dev) | ||
| 514 | { | ||
| 515 | arc_pmu->attr = devm_kmalloc_array(dev, arc_pmu->n_events + 1, | ||
| 516 | sizeof(*arc_pmu->attr), GFP_KERNEL | __GFP_ZERO); | ||
| 517 | if (!arc_pmu->attr) | ||
| 518 | return -ENOMEM; | ||
| 519 | |||
| 520 | arc_pmu->attrs = devm_kmalloc_array(dev, arc_pmu->n_events + 1, | ||
| 521 | sizeof(*arc_pmu->attrs), GFP_KERNEL | __GFP_ZERO); | ||
| 522 | if (!arc_pmu->attrs) | ||
| 523 | return -ENOMEM; | ||
| 524 | |||
| 525 | arc_pmu->raw_entry = devm_kmalloc_array(dev, arc_pmu->n_events, | ||
| 526 | sizeof(*arc_pmu->raw_entry), GFP_KERNEL | __GFP_ZERO); | ||
| 527 | if (!arc_pmu->raw_entry) | ||
| 528 | return -ENOMEM; | ||
| 529 | |||
| 530 | return 0; | ||
| 531 | } | ||
| 532 | |||
| 533 | static inline bool event_in_hw_event_map(int i, char *name) | ||
| 534 | { | ||
| 535 | if (!arc_pmu_ev_hw_map[i]) | ||
| 536 | return false; | ||
| 537 | |||
| 538 | if (!strlen(arc_pmu_ev_hw_map[i])) | ||
| 539 | return false; | ||
| 540 | |||
| 541 | if (strcmp(arc_pmu_ev_hw_map[i], name)) | ||
| 542 | return false; | ||
| 543 | |||
| 544 | return true; | ||
| 545 | } | ||
| 546 | |||
| 547 | static void arc_pmu_map_hw_event(int j, char *str) | ||
| 548 | { | ||
| 549 | int i; | ||
| 550 | |||
| 551 | /* See if HW condition has been mapped to a perf event_id */ | ||
| 552 | for (i = 0; i < ARRAY_SIZE(arc_pmu_ev_hw_map); i++) { | ||
| 553 | if (event_in_hw_event_map(i, str)) { | ||
| 554 | pr_debug("mapping perf event %2d to h/w event \'%8s\' (idx %d)\n", | ||
| 555 | i, str, j); | ||
| 556 | arc_pmu->ev_hw_idx[i] = j; | ||
| 557 | } | ||
| 558 | } | ||
| 559 | } | ||
| 560 | |||
| 444 | static int arc_pmu_device_probe(struct platform_device *pdev) | 561 | static int arc_pmu_device_probe(struct platform_device *pdev) |
| 445 | { | 562 | { |
| 446 | struct arc_reg_pct_build pct_bcr; | 563 | struct arc_reg_pct_build pct_bcr; |
| 447 | struct arc_reg_cc_build cc_bcr; | 564 | struct arc_reg_cc_build cc_bcr; |
| 448 | int i, j, has_interrupts; | 565 | int i, has_interrupts; |
| 449 | int counter_size; /* in bits */ | 566 | int counter_size; /* in bits */ |
| 450 | 567 | ||
| 451 | union cc_name { | 568 | union cc_name { |
| 452 | struct { | 569 | struct { |
| 453 | uint32_t word0, word1; | 570 | u32 word0, word1; |
| 454 | char sentinel; | 571 | char sentinel; |
| 455 | } indiv; | 572 | } indiv; |
| 456 | char str[9]; | 573 | char str[ARCPMU_EVENT_NAME_LEN]; |
| 457 | } cc_name; | 574 | } cc_name; |
| 458 | 575 | ||
| 459 | 576 | ||
| @@ -463,15 +580,22 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 3 unmodified lines | |||
| 463 | return -ENODEV; | 580 | return -ENODEV; |
| 464 | } | 581 | } |
| 465 | BUILD_BUG_ON(ARC_PERF_MAX_COUNTERS > 32); | 582 | BUILD_BUG_ON(ARC_PERF_MAX_COUNTERS > 32); |
| 466 | BUG_ON(pct_bcr.c > ARC_PERF_MAX_COUNTERS); | 583 | if (WARN_ON(pct_bcr.c > ARC_PERF_MAX_COUNTERS)) |
| 584 | return -EINVAL; | ||
| 467 | 585 | ||
| 468 | READ_BCR(ARC_REG_CC_BUILD, cc_bcr); | 586 | READ_BCR(ARC_REG_CC_BUILD, cc_bcr); |
| 469 | BUG_ON(!cc_bcr.v); /* Counters exist but No countable conditions ? */ | 587 | if (WARN(!cc_bcr.v, "Counters exist but No countable conditions?")) |
| 588 | return -EINVAL; | ||
| 470 | 589 | ||
| 471 | arc_pmu = devm_kzalloc(&pdev->dev, sizeof(struct arc_pmu), GFP_KERNEL); | 590 | arc_pmu = devm_kzalloc(&pdev->dev, sizeof(struct arc_pmu), GFP_KERNEL); |
| 472 | if (!arc_pmu) | 591 | if (!arc_pmu) |
| 473 | return -ENOMEM; | 592 | return -ENOMEM; |
| 474 | 593 | ||
| 594 | arc_pmu->n_events = cc_bcr.c; | ||
| 595 | |||
| 596 | if (arc_pmu_raw_alloc(&pdev->dev)) | ||
| 597 | return -ENOMEM; | ||
| 598 | |||
| 475 | has_interrupts = is_isa_arcv2() ? pct_bcr.i : 0; | 599 | has_interrupts = is_isa_arcv2() ? pct_bcr.i : 0; |
| 476 | 600 | ||
| 477 | arc_pmu->n_counters = pct_bcr.c; | 601 | arc_pmu->n_counters = pct_bcr.c; |
| @@ -481,30 +605,26 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 3 unmodified lines | |||
| 481 | 605 | ||
| 482 | pr_info("ARC perf\t: %d counters (%d bits), %d conditions%s\n", | 606 | pr_info("ARC perf\t: %d counters (%d bits), %d conditions%s\n", |
| 483 | arc_pmu->n_counters, counter_size, cc_bcr.c, | 607 | arc_pmu->n_counters, counter_size, cc_bcr.c, |
| 484 | has_interrupts ? ", [overflow IRQ support]":""); | 608 | has_interrupts ? ", [overflow IRQ support]" : ""); |
| 485 | 609 | ||
| 486 | cc_name.str[8] = 0; | 610 | cc_name.str[ARCPMU_EVENT_NAME_LEN - 1] = 0; |
| 487 | for (i = 0; i < PERF_COUNT_ARC_HW_MAX; i++) | 611 | for (i = 0; i < PERF_COUNT_ARC_HW_MAX; i++) |
| 488 | arc_pmu->ev_hw_idx[i] = -1; | 612 | arc_pmu->ev_hw_idx[i] = -1; |
| 489 | 613 | ||
| 490 | /* loop thru all available h/w condition indexes */ | 614 | /* loop thru all available h/w condition indexes */ |
| 491 | for (j = 0; j < cc_bcr.c; j++) { | 615 | for (i = 0; i < cc_bcr.c; i++) { |
| 492 | write_aux_reg(ARC_REG_CC_INDEX, j); | 616 | write_aux_reg(ARC_REG_CC_INDEX, i); |
| 493 | cc_name.indiv.word0 = read_aux_reg(ARC_REG_CC_NAME0); | 617 | cc_name.indiv.word0 = read_aux_reg(ARC_REG_CC_NAME0); |
| 494 | cc_name.indiv.word1 = read_aux_reg(ARC_REG_CC_NAME1); | 618 | cc_name.indiv.word1 = read_aux_reg(ARC_REG_CC_NAME1); |
| 495 | 619 | ||
| 496 | /* See if it has been mapped to a perf event_id */ | 620 | arc_pmu_map_hw_event(i, cc_name.str); |
| 497 | for (i = 0; i < ARRAY_SIZE(arc_pmu_ev_hw_map); i++) { | 621 | arc_pmu_add_raw_event_attr(i, cc_name.str); |
| 498 | if (arc_pmu_ev_hw_map[i] && | ||
| 499 | !strcmp(arc_pmu_ev_hw_map[i], cc_name.str) && | ||
| 500 | strlen(arc_pmu_ev_hw_map[i])) { | ||
| 501 | pr_debug("mapping perf event %2d to h/w event \'%8s\' (idx %d)\n", | ||
| 502 | i, cc_name.str, j); | ||
| 503 | arc_pmu->ev_hw_idx[i] = j; | ||
| 504 | } | ||
| 505 | } | ||
| 506 | } | 622 | } |
| 507 | 623 | ||
| 624 | arc_pmu_events_attr_gr.attrs = arc_pmu->attrs; | ||
| 625 | arc_pmu->attr_groups[ARCPMU_ATTR_GR_EVENTS] = &arc_pmu_events_attr_gr; | ||
| 626 | arc_pmu->attr_groups[ARCPMU_ATTR_GR_FORMATS] = &arc_pmu_format_attr_gr; | ||
| 627 | |||
| 508 | arc_pmu->pmu = (struct pmu) { | 628 | arc_pmu->pmu = (struct pmu) { |
| 509 | .pmu_enable = arc_pmu_enable, | 629 | .pmu_enable = arc_pmu_enable, |
| 510 | .pmu_disable = arc_pmu_disable, | 630 | .pmu_disable = arc_pmu_disable, |
| @@ -514,6 +634,7 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 3 unmodified lines | |||
| 514 | .start = arc_pmu_start, | 634 | .start = arc_pmu_start, |
| 515 | .stop = arc_pmu_stop, | 635 | .stop = arc_pmu_stop, |
| 516 | .read = arc_pmu_read, | 636 | .read = arc_pmu_read, |
| 637 | .attr_groups = arc_pmu->attr_groups, | ||
| 517 | }; | 638 | }; |
| 518 | 639 | ||
| 519 | if (has_interrupts) { | 640 | if (has_interrupts) { |
| @@ -535,17 +656,19 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 15 unmodified lines | |||
| 535 | } else | 656 | } else |
| 536 | arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT; | 657 | arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT; |
| 537 | 658 | ||
| 538 | return perf_pmu_register(&arc_pmu->pmu, pdev->name, PERF_TYPE_RAW); | 659 | /* |
| 660 | * perf parser doesn't really like '-' symbol in events name, so let's | ||
| 661 | * use '_' in arc pct name as it goes to kernel PMU event prefix. | ||
| 662 | */ | ||
| 663 | return perf_pmu_register(&arc_pmu->pmu, "arc_pct", PERF_TYPE_RAW); | ||
| 539 | } | 664 | } |
| 540 | 665 | ||
| 541 | #ifdef CONFIG_OF | ||
| 542 | static const struct of_device_id arc_pmu_match[] = { | 666 | static const struct of_device_id arc_pmu_match[] = { |
| 543 | { .compatible = "snps,arc700-pct" }, | 667 | { .compatible = "snps,arc700-pct" }, |
| 544 | { .compatible = "snps,archs-pct" }, | 668 | { .compatible = "snps,archs-pct" }, |
| 545 | {}, | 669 | {}, |
| 546 | }; | 670 | }; |
| 547 | MODULE_DEVICE_TABLE(of, arc_pmu_match); | 671 | MODULE_DEVICE_TABLE(of, arc_pmu_match); |
| 548 | #endif | ||
| 549 | 672 | ||
| 550 | static struct platform_driver arc_pmu_driver = { | 673 | static struct platform_driver arc_pmu_driver = { |
| 551 | .driver = { | 674 | .driver = { |
| @@ -123,6 +123,7 @@ static void read_arc_build_cfg_regs(void) · 122 unmodified lines | |||
| 123 | struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; | 123 | struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; |
| 124 | const struct id_to_str *tbl; | 124 | const struct id_to_str *tbl; |
| 125 | struct bcr_isa_arcv2 isa; | 125 | struct bcr_isa_arcv2 isa; |
| 126 | struct bcr_actionpoint ap; | ||
| 126 | 127 | ||
| 127 | FIX_PTR(cpu); | 128 | FIX_PTR(cpu); |
| 128 | 129 | ||
| @@ -195,6 +196,7 @@ static void read_arc_build_cfg_regs(void) · 66 unmodified lines | |||
| 195 | cpu->bpu.full = bpu.ft; | 196 | cpu->bpu.full = bpu.ft; |
| 196 | cpu->bpu.num_cache = 256 << bpu.bce; | 197 | cpu->bpu.num_cache = 256 << bpu.bce; |
| 197 | cpu->bpu.num_pred = 2048 << bpu.pte; | 198 | cpu->bpu.num_pred = 2048 << bpu.pte; |
| 199 | cpu->bpu.ret_stk = 4 << bpu.rse; | ||
| 198 | 200 | ||
| 199 | if (cpu->core.family >= 0x54) { | 201 | if (cpu->core.family >= 0x54) { |
| 200 | unsigned int exec_ctrl; | 202 | unsigned int exec_ctrl; |
| @@ -207,8 +209,11 @@ static void read_arc_build_cfg_regs(void) · 6 unmodified lines | |||
| 207 | } | 209 | } |
| 208 | } | 210 | } |
| 209 | 211 | ||
| 210 | READ_BCR(ARC_REG_AP_BCR, bcr); | 212 | READ_BCR(ARC_REG_AP_BCR, ap); |
| 211 | cpu->extn.ap = bcr.ver ? 1 : 0; | 213 | if (ap.ver) { |
| 214 | cpu->extn.ap_num = 2 << ap.num; | ||
| 215 | cpu->extn.ap_full = !!ap.min; | ||
| 216 | } | ||
| 212 | 217 | ||
| 213 | READ_BCR(ARC_REG_SMART_BCR, bcr); | 218 | READ_BCR(ARC_REG_SMART_BCR, bcr); |
| 214 | cpu->extn.smart = bcr.ver ? 1 : 0; | 219 | cpu->extn.smart = bcr.ver ? 1 : 0; |
| @@ -216,8 +221,6 @@ static void read_arc_build_cfg_regs(void) · 1 unmodified line | |||
| 216 | READ_BCR(ARC_REG_RTT_BCR, bcr); | 221 | READ_BCR(ARC_REG_RTT_BCR, bcr); |
| 217 | cpu->extn.rtt = bcr.ver ? 1 : 0; | 222 | cpu->extn.rtt = bcr.ver ? 1 : 0; |
| 218 | 223 | ||
| 219 | cpu->extn.debug = cpu->extn.ap | cpu->extn.smart | cpu->extn.rtt; | ||
| 220 | |||
| 221 | READ_BCR(ARC_REG_ISA_CFG_BCR, isa); | 224 | READ_BCR(ARC_REG_ISA_CFG_BCR, isa); |
| 222 | 225 | ||
| 223 | /* some hacks for lack of feature BCR info in old ARC700 cores */ | 226 | /* some hacks for lack of feature BCR info in old ARC700 cores */ |
| @@ -299,10 +302,10 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len) · 75 unmodified lines | |||
| 299 | 302 | ||
| 300 | if (cpu->bpu.ver) | 303 | if (cpu->bpu.ver) |
| 301 | n += scnprintf(buf + n, len - n, | 304 | n += scnprintf(buf + n, len - n, |
| 302 | "BPU\t\t: %s%s match, cache:%d, Predict Table:%d", | 305 | "BPU\t\t: %s%s match, cache:%d, Predict Table:%d Return stk: %d", |
| 303 | IS_AVAIL1(cpu->bpu.full, "full"), | 306 | IS_AVAIL1(cpu->bpu.full, "full"), |
| 304 | IS_AVAIL1(!cpu->bpu.full, "partial"), | 307 | IS_AVAIL1(!cpu->bpu.full, "partial"), |
| 305 | cpu->bpu.num_cache, cpu->bpu.num_pred); | 308 | cpu->bpu.num_cache, cpu->bpu.num_pred, cpu->bpu.ret_stk); |
| 306 | 309 | ||
| 307 | if (is_isa_arcv2()) { | 310 | if (is_isa_arcv2()) { |
| 308 | struct bcr_lpb lpb; | 311 | struct bcr_lpb lpb; |
| @@ -336,11 +339,17 @@ static char *arc_extn_mumbojumbo(int cpu_id, char *buf, int len) · 27 unmodified lines | |||
| 336 | IS_AVAIL1(cpu->extn.fpu_sp, "SP "), | 339 | IS_AVAIL1(cpu->extn.fpu_sp, "SP "), |
| 337 | IS_AVAIL1(cpu->extn.fpu_dp, "DP ")); | 340 | IS_AVAIL1(cpu->extn.fpu_dp, "DP ")); |
| 338 | 341 | ||
| 339 | if (cpu->extn.debug) | 342 | if (cpu->extn.ap_num | cpu->extn.smart | cpu->extn.rtt) { |
| 340 | n += scnprintf(buf + n, len - n, "DEBUG\t\t: %s%s%s\n", | 343 | n += scnprintf(buf + n, len - n, "DEBUG\t\t: %s%s", |
| 341 | IS_AVAIL1(cpu->extn.ap, "ActionPoint "), | ||
| 342 | IS_AVAIL1(cpu->extn.smart, "smaRT "), | 344 | IS_AVAIL1(cpu->extn.smart, "smaRT "), |
| 343 | IS_AVAIL1(cpu->extn.rtt, "RTT ")); | 345 | IS_AVAIL1(cpu->extn.rtt, "RTT ")); |
| 346 | if (cpu->extn.ap_num) { | ||
| 347 | n += scnprintf(buf + n, len - n, "ActionPoint %d/%s", | ||
| 348 | cpu->extn.ap_num, | ||
| 349 | cpu->extn.ap_full ? "full":"min"); | ||
| 350 | } | ||
| 351 | n += scnprintf(buf + n, len - n, "\n"); | ||
| 352 | } | ||
| 344 | 353 | ||
| 345 | if (cpu->dccm.sz || cpu->iccm.sz) | 354 | if (cpu->dccm.sz || cpu->iccm.sz) |
| 346 | n += scnprintf(buf + n, len - n, "Extn [CCM]\t: DCCM @ %x, %d KB / ICCM: @ %x, %d KB\n", | 355 | n += scnprintf(buf + n, len - n, "Extn [CCM]\t: DCCM @ %x, %d KB / ICCM: @ %x, %d KB\n", |
| @@ -18,6 +18,8 @@ · 17 unmodified lines | |||
| 18 | #include <asm/arcregs.h> | 18 | #include <asm/arcregs.h> |
| 19 | #include <asm/irqflags.h> | 19 | #include <asm/irqflags.h> |
| 20 | 20 | ||
| 21 | #define ARC_PATH_MAX 256 | ||
| 22 | |||
| 21 | /* | 23 | /* |
| 22 | * Common routine to print scratch regs (r0-r12) or callee regs (r13-r25) | 24 | * Common routine to print scratch regs (r0-r12) or callee regs (r13-r25) |
| 23 | * -Prints 3 regs per line and a CR. | 25 | * -Prints 3 regs per line and a CR. |
| @@ -58,11 +60,12 @@ static void show_callee_regs(struct callee_regs *cregs) · 34 unmodified lines | |||
| 58 | print_reg_file(&(cregs->r13), 13); | 60 | print_reg_file(&(cregs->r13), 13); |
| 59 | } | 61 | } |
| 60 | 62 | ||
| 61 | static void print_task_path_n_nm(struct task_struct *tsk, char *buf) | 63 | static void print_task_path_n_nm(struct task_struct *tsk) |
| 62 | { | 64 | { |
| 63 | char *path_nm = NULL; | 65 | char *path_nm = NULL; |
| 64 | struct mm_struct *mm; | 66 | struct mm_struct *mm; |
| 65 | struct file *exe_file; | 67 | struct file *exe_file; |
| 68 | char buf[ARC_PATH_MAX]; | ||
| 66 | 69 | ||
| 67 | mm = get_task_mm(tsk); | 70 | mm = get_task_mm(tsk); |
| 68 | if (!mm) | 71 | if (!mm) |
| @@ -72,7 +75,7 @@ static void print_task_path_n_nm(struct task_struct *tsk, char *buf) · 3 unmodified lines | |||
| 72 | mmput(mm); | 75 | mmput(mm); |
| 73 | 76 | ||
| 74 | if (exe_file) { | 77 | if (exe_file) { |
| 75 | path_nm = file_path(exe_file, buf, 255); | 78 | path_nm = file_path(exe_file, buf, ARC_PATH_MAX-1); |
| 76 | fput(exe_file); | 79 | fput(exe_file); |
| 77 | } | 80 | } |
| 78 | 81 | ||
| @@ -80,10 +83,9 @@ done: · 1 unmodified line | |||
| 80 | pr_info("Path: %s\n", !IS_ERR(path_nm) ? path_nm : "?"); | 83 | pr_info("Path: %s\n", !IS_ERR(path_nm) ? path_nm : "?"); |
| 81 | } | 84 | } |
| 82 | 85 | ||
| 83 | static void show_faulting_vma(unsigned long address, char *buf) | 86 | static void show_faulting_vma(unsigned long address) |
| 84 | { | 87 | { |
| 85 | struct vm_area_struct *vma; | 88 | struct vm_area_struct *vma; |
| 86 | char *nm = buf; | ||
| 87 | struct mm_struct *active_mm = current->active_mm; | 89 | struct mm_struct *active_mm = current->active_mm; |
| 88 | 90 | ||
| 89 | /* can't use print_vma_addr() yet as it doesn't check for | 91 | /* can't use print_vma_addr() yet as it doesn't check for |
| @@ -96,8 +98,11 @@ static void show_faulting_vma(unsigned long address, char *buf) · 6 unmodified lines | |||
| 96 | * if the container VMA is not found | 98 | * if the container VMA is not found |
| 97 | */ | 99 | */ |
| 98 | if (vma && (vma->vm_start <= address)) { | 100 | if (vma && (vma->vm_start <= address)) { |
| 101 | char buf[ARC_PATH_MAX]; | ||
| 102 | char *nm = "?"; | ||
| 103 | |||
| 99 | if (vma->vm_file) { | 104 | if (vma->vm_file) { |
| 100 | nm = file_path(vma->vm_file, buf, PAGE_SIZE - 1); | 105 | nm = file_path(vma->vm_file, buf, ARC_PATH_MAX-1); |
| 101 | if (IS_ERR(nm)) | 106 | if (IS_ERR(nm)) |
| 102 | nm = "?"; | 107 | nm = "?"; |
| 103 | } | 108 | } |
| @@ -173,13 +178,14 @@ void show_regs(struct pt_regs *regs) · 69 unmodified lines | |||
| 173 | { | 178 | { |
| 174 | struct task_struct *tsk = current; | 179 | struct task_struct *tsk = current; |
| 175 | struct callee_regs *cregs; | 180 | struct callee_regs *cregs; |
| 176 | char *buf; | ||
| 177 | 181 | ||
| 178 | buf = (char *)__get_free_page(GFP_KERNEL); | 182 | /* |
| 179 | if (!buf) | 183 | * generic code calls us with preemption disabled, but some calls |
| 180 | return; | 184 | * here could sleep, so re-enable to avoid lockdep splat |
| 185 | */ | ||
| 186 | preempt_enable(); | ||
| 181 | 187 | ||
| 182 | print_task_path_n_nm(tsk, buf); | 188 | print_task_path_n_nm(tsk); |
| 183 | show_regs_print_info(KERN_INFO); | 189 | show_regs_print_info(KERN_INFO); |
| 184 | 190 | ||
| 185 | show_ecr_verbose(regs); | 191 | show_ecr_verbose(regs); |
| @@ -189,7 +195,7 @@ void show_regs(struct pt_regs *regs) · 3 unmodified lines | |||
| 189 | (void *)regs->blink, (void *)regs->ret); | 195 | (void *)regs->blink, (void *)regs->ret); |
| 190 | 196 | ||
| 191 | if (user_mode(regs)) | 197 | if (user_mode(regs)) |
| 192 | show_faulting_vma(regs->ret, buf); /* faulting code, not data */ | 198 | show_faulting_vma(regs->ret); /* faulting code, not data */ |
| 193 | 199 | ||
| 194 | pr_info("[STAT32]: 0x%08lx", regs->status32); | 200 | pr_info("[STAT32]: 0x%08lx", regs->status32); |
| 195 | 201 | ||
| @@ -222,7 +228,7 @@ void show_regs(struct pt_regs *regs) · 26 unmodified lines | |||
| 222 | if (cregs) | 228 | if (cregs) |
| 223 | show_callee_regs(cregs); | 229 | show_callee_regs(cregs); |
| 224 | 230 | ||
| 225 | free_page((unsigned long)buf); | 231 | preempt_disable(); |
| 226 | } | 232 | } |
| 227 | 233 | ||
| 228 | void show_kernel_fault_diag(const char *str, struct pt_regs *regs, | 234 | void show_kernel_fault_diag(const char *str, struct pt_regs *regs, |
| @@ -7,11 +7,39 @@ · 6 unmodified lines | |||
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/linkage.h> | 9 | #include <linux/linkage.h> |
| 10 | #include <asm/cache.h> | ||
| 10 | 11 | ||
| 11 | #undef PREALLOC_NOT_AVAIL | 12 | /* |
| 13 | * The memset implementation below is optimized to use prefetchw and prealloc | ||
| 14 | * instruction in case of CPU with 64B L1 data cache line (L1_CACHE_SHIFT == 6) | ||
| 15 | * If you want to implement optimized memset for other possible L1 data cache | ||
| 16 | * line lengths (32B and 128B) you should rewrite code carefully checking | ||
| 17 | * we don't call any prefetchw/prealloc instruction for L1 cache lines which | ||
| 18 | * don't belongs to memset area. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #if L1_CACHE_SHIFT == 6 | ||
| 22 | |||
| 23 | .macro PREALLOC_INSTR reg, off | ||
| 24 | prealloc [\reg, \off] | ||
| 25 | .endm | ||
| 26 | |||
| 27 | .macro PREFETCHW_INSTR reg, off | ||
| 28 | prefetchw [\reg, \off] | ||
| 29 | .endm | ||
| 30 | |||
| 31 | #else | ||
| 32 | |||
| 33 | .macro PREALLOC_INSTR | ||
| 34 | .endm | ||
| 35 | |||
| 36 | .macro PREFETCHW_INSTR | ||
| 37 | .endm | ||
| 38 | |||
| 39 | #endif | ||
| 12 | 40 | ||
| 13 | ENTRY_CFI(memset) | 41 | ENTRY_CFI(memset) |
| 14 | prefetchw [r0] ; Prefetch the write location | 42 | PREFETCHW_INSTR r0, 0 ; Prefetch the first write location |
| 15 | mov.f 0, r2 | 43 | mov.f 0, r2 |
| 16 | ;;; if size is zero | 44 | ;;; if size is zero |
| 17 | jz.d [blink] | 45 | jz.d [blink] |
| @@ -48,11 +76,8 @@ ENTRY_CFI(memset) · 30 unmodified lines | |||
| 48 | 76 | ||
| 49 | lpnz @.Lset64bytes | 77 | lpnz @.Lset64bytes |
| 50 | ;; LOOP START | 78 | ;; LOOP START |
| 51 | #ifdef PREALLOC_NOT_AVAIL | 79 | PREALLOC_INSTR r3, 64 ; alloc next line w/o fetching |
| 52 | prefetchw [r3, 64] ;Prefetch the next write location | 80 | |
| 53 | #else | ||
| 54 | prealloc [r3, 64] | ||
| 55 | #endif | ||
| 56 | #ifdef CONFIG_ARC_HAS_LL64 | 81 | #ifdef CONFIG_ARC_HAS_LL64 |
| 57 | std.ab r4, [r3, 8] | 82 | std.ab r4, [r3, 8] |
| 58 | std.ab r4, [r3, 8] | 83 | std.ab r4, [r3, 8] |
| @@ -85,7 +110,6 @@ ENTRY_CFI(memset) · 26 unmodified lines | |||
| 85 | lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes | 110 | lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes |
| 86 | lpnz .Lset32bytes | 111 | lpnz .Lset32bytes |
| 87 | ;; LOOP START | 112 | ;; LOOP START |
| 88 | prefetchw [r3, 32] ;Prefetch the next write location | ||
| 89 | #ifdef CONFIG_ARC_HAS_LL64 | 113 | #ifdef CONFIG_ARC_HAS_LL64 |
| 90 | std.ab r4, [r3, 8] | 114 | std.ab r4, [r3, 8] |
| 91 | std.ab r4, [r3, 8] | 115 | std.ab r4, [r3, 8] |
| @@ -141,12 +141,17 @@ good_area: · 140 unmodified lines | |||
| 141 | */ | 141 | */ |
| 142 | fault = handle_mm_fault(vma, address, flags); | 142 | fault = handle_mm_fault(vma, address, flags); |
| 143 | 143 | ||
| 144 | /* If Pagefault was interrupted by SIGKILL, exit page fault "early" */ | ||
| 145 | if (fatal_signal_pending(current)) { | 144 | if (fatal_signal_pending(current)) { |
| 146 | if ((fault & VM_FAULT_ERROR) && !(fault & VM_FAULT_RETRY)) | 145 | |
| 147 | up_read(&mm->mmap_sem); | 146 | /* |
| 148 | if (user_mode(regs)) | 147 | * if fault retry, mmap_sem already relinquished by core mm |
| 148 | * so OK to return to user mode (with signal handled first) | ||
| 149 | */ | ||
| 150 | if (fault & VM_FAULT_RETRY) { | ||
| 151 | if (!user_mode(regs)) | ||
| 152 | goto no_context; | ||
| 149 | return; | 153 | return; |
| 154 | } | ||
| 150 | } | 155 | } |
| 151 | 156 | ||
| 152 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); | 157 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); |
| @@ -119,7 +119,8 @@ void __init setup_arch_memory(void) · 118 unmodified lines | |||
| 119 | */ | 119 | */ |
| 120 | 120 | ||
| 121 | memblock_add_node(low_mem_start, low_mem_sz, 0); | 121 | memblock_add_node(low_mem_start, low_mem_sz, 0); |
| 122 | memblock_reserve(low_mem_start, __pa(_end) - low_mem_start); | 122 | memblock_reserve(CONFIG_LINUX_LINK_BASE, |
| 123 | __pa(_end) - CONFIG_LINUX_LINK_BASE); | ||
| 123 | 124 | ||
| 124 | #ifdef CONFIG_BLK_DEV_INITRD | 125 | #ifdef CONFIG_BLK_DEV_INITRD |
| 125 | if (phys_initrd_size) { | 126 | if (phys_initrd_size) { |
| @@ -215,7 +215,7 @@ · 214 unmodified lines | |||
| 215 | pinctrl-names = "default"; | 215 | pinctrl-names = "default"; |
| 216 | pinctrl-0 = <&mmc1_pins>; | 216 | pinctrl-0 = <&mmc1_pins>; |
| 217 | bus-width = <0x4>; | 217 | bus-width = <0x4>; |
| 218 | cd-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; | 218 | cd-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; |
| 219 | cd-inverted; | 219 | cd-inverted; |
| 220 | max-frequency = <26000000>; | 220 | max-frequency = <26000000>; |
| 221 | vmmc-supply = <&vmmcsd_fixed>; | 221 | vmmc-supply = <&vmmcsd_fixed>; |
| @@ -94,6 +94,28 @@ · 93 unmodified lines | |||
| 94 | regulator-boot-on; | 94 | regulator-boot-on; |
| 95 | }; | 95 | }; |
| 96 | 96 | ||
| 97 | baseboard_3v3: fixedregulator-3v3 { | ||
| 98 | /* TPS73701DCQ */ | ||
| 99 | compatible = "regulator-fixed"; | ||
| 100 | regulator-name = "baseboard_3v3"; | ||
| 101 | regulator-min-microvolt = <3300000>; | ||
| 102 | regulator-max-microvolt = <3300000>; | ||
| 103 | vin-supply = <&vbat>; | ||
| 104 | regulator-always-on; | ||
| 105 | regulator-boot-on; | ||
| 106 | }; | ||
| 107 | |||
| 108 | baseboard_1v8: fixedregulator-1v8 { | ||
| 109 | /* TPS73701DCQ */ | ||
| 110 | compatible = "regulator-fixed"; | ||
| 111 | regulator-name = "baseboard_1v8"; | ||
| 112 | regulator-min-microvolt = <1800000>; | ||
| 113 | regulator-max-microvolt = <1800000>; | ||
| 114 | vin-supply = <&vbat>; | ||
| 115 | regulator-always-on; | ||
| 116 | regulator-boot-on; | ||
| 117 | }; | ||
| 118 | |||
| 97 | backlight_lcd: backlight-regulator { | 119 | backlight_lcd: backlight-regulator { |
| 98 | compatible = "regulator-fixed"; | 120 | compatible = "regulator-fixed"; |
| 99 | regulator-name = "lcd_backlight_pwr"; | 121 | regulator-name = "lcd_backlight_pwr"; |
| @@ -105,7 +127,7 @@ · 5 unmodified lines | |||
| 105 | 127 | ||
| 106 | sound { | 128 | sound { |
| 107 | compatible = "simple-audio-card"; | 129 | compatible = "simple-audio-card"; |
| 108 | simple-audio-card,name = "DA850/OMAP-L138 EVM"; | 130 | simple-audio-card,name = "DA850-OMAPL138 EVM"; |
| 109 | simple-audio-card,widgets = | 131 | simple-audio-card,widgets = |
| 110 | "Line", "Line In", | 132 | "Line", "Line In", |
| 111 | "Line", "Line Out"; | 133 | "Line", "Line Out"; |
| @@ -210,10 +232,9 @@ · 98 unmodified lines | |||
| 210 | 232 | ||
| 211 | /* Regulators */ | 233 | /* Regulators */ |
| 212 | IOVDD-supply = <&vdcdc2_reg>; | 234 | IOVDD-supply = <&vdcdc2_reg>; |
| 213 | /* Derived from VBAT: Baseboard 3.3V / 1.8V */ | 235 | AVDD-supply = <&baseboard_3v3>; |
| 214 | AVDD-supply = <&vbat>; | 236 | DRVDD-supply = <&baseboard_3v3>; |
| 215 | DRVDD-supply = <&vbat>; | 237 | DVDD-supply = <&baseboard_1v8>; |
| 216 | DVDD-supply = <&vbat>; | ||
| 217 | }; | 238 | }; |
| 218 | tca6416: gpio@20 { | 239 | tca6416: gpio@20 { |
| 219 | compatible = "ti,tca6416"; | 240 | compatible = "ti,tca6416"; |
| @@ -39,9 +39,39 @@ · 38 unmodified lines | |||
| 39 | }; | 39 | }; |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | vcc_5vd: fixedregulator-vcc_5vd { | ||
| 43 | compatible = "regulator-fixed"; | ||
| 44 | regulator-name = "vcc_5vd"; | ||
| 45 | regulator-min-microvolt = <5000000>; | ||
| 46 | regulator-max-microvolt = <5000000>; | ||
| 47 | regulator-boot-on; | ||
| 48 | }; | ||
| 49 | |||
| 50 | vcc_3v3d: fixedregulator-vcc_3v3d { | ||
| 51 | /* TPS650250 - VDCDC1 */ | ||
| 52 | compatible = "regulator-fixed"; | ||
| 53 | regulator-name = "vcc_3v3d"; | ||
| 54 | regulator-min-microvolt = <3300000>; | ||
| 55 | regulator-max-microvolt = <3300000>; | ||
| 56 | vin-supply = <&vcc_5vd>; | ||
| 57 | regulator-always-on; | ||
| 58 | regulator-boot-on; | ||
| 59 | }; | ||
| 60 | |||
| 61 | vcc_1v8d: fixedregulator-vcc_1v8d { | ||
| 62 | /* TPS650250 - VDCDC2 */ | ||
| 63 | compatible = "regulator-fixed"; | ||
| 64 | regulator-name = "vcc_1v8d"; | ||
| 65 | regulator-min-microvolt = <1800000>; | ||
| 66 | regulator-max-microvolt = <1800000>; | ||
| 67 | vin-supply = <&vcc_5vd>; | ||
| 68 | regulator-always-on; | ||
| 69 | regulator-boot-on; | ||
| 70 | }; | ||
| 71 | |||
| 42 | sound { | 72 | sound { |
| 43 | compatible = "simple-audio-card"; | 73 | compatible = "simple-audio-card"; |
| 44 | simple-audio-card,name = "DA850/OMAP-L138 LCDK"; | 74 | simple-audio-card,name = "DA850-OMAPL138 LCDK"; |
| 45 | simple-audio-card,widgets = | 75 | simple-audio-card,widgets = |
| 46 | "Line", "Line In", | 76 | "Line", "Line In", |
| 47 | "Line", "Line Out"; | 77 | "Line", "Line Out"; |
| @@ -221,6 +251,12 @@ · 173 unmodified lines | |||
| 221 | compatible = "ti,tlv320aic3106"; | 251 | compatible = "ti,tlv320aic3106"; |
| 222 | reg = <0x18>; | 252 | reg = <0x18>; |
| 223 | status = "okay"; | 253 | status = "okay"; |
| 254 | |||
| 255 | /* Regulators */ | ||
| 256 | IOVDD-supply = <&vcc_3v3d>; | ||
| 257 | AVDD-supply = <&vcc_3v3d>; | ||
| 258 | DRVDD-supply = <&vcc_3v3d>; | ||
| 259 | DVDD-supply = <&vcc_1v8d>; | ||
| 224 | }; | 260 | }; |
| 225 | }; | 261 | }; |
| 226 | 262 | ||
| @@ -476,7 +476,7 @@ · 475 unmodified lines | |||
| 476 | clocksource: timer@20000 { | 476 | clocksource: timer@20000 { |
| 477 | compatible = "ti,da830-timer"; | 477 | compatible = "ti,da830-timer"; |
| 478 | reg = <0x20000 0x1000>; | 478 | reg = <0x20000 0x1000>; |
| 479 | interrupts = <12>, <13>; | 479 | interrupts = <21>, <22>; |
| 480 | interrupt-names = "tint12", "tint34"; | 480 | interrupt-names = "tint12", "tint34"; |
| 481 | clocks = <&pll0_auxclk>; | 481 | clocks = <&pll0_auxclk>; |
| 482 | }; | 482 | }; |
| @@ -103,7 +103,7 @@ · 102 unmodified lines | |||
| 103 | power { | 103 | power { |
| 104 | label = "Power Button"; | 104 | label = "Power Button"; |
| 105 | gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; | 105 | gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; |
| 106 | gpio-key,wakeup; | 106 | wakeup-source; |
| 107 | linux,code = <KEY_POWER>; | 107 | linux,code = <KEY_POWER>; |
| 108 | }; | 108 | }; |
| 109 | }; | 109 | }; |
| @@ -309,7 +309,7 @@ · 308 unmodified lines | |||
| 309 | pinctrl-2 = <&pinctrl_usdhc3_200mhz>; | 309 | pinctrl-2 = <&pinctrl_usdhc3_200mhz>; |
| 310 | cd-gpios = <&gpio3 22 GPIO_ACTIVE_LOW>; | 310 | cd-gpios = <&gpio3 22 GPIO_ACTIVE_LOW>; |
| 311 | keep-power-in-suspend; | 311 | keep-power-in-suspend; |
| 312 | enable-sdio-wakeup; | 312 | wakeup-source; |
| 313 | vmmc-supply = <®_sd3_vmmc>; | 313 | vmmc-supply = <®_sd3_vmmc>; |
| 314 | status = "okay"; | 314 | status = "okay"; |
| 315 | }; | 315 | }; |
| @@ -467,7 +467,7 @@ · 466 unmodified lines | |||
| 467 | }; | 467 | }; |
| 468 | 468 | ||
| 469 | gpt: gpt@2098000 { | 469 | gpt: gpt@2098000 { |
| 470 | compatible = "fsl,imx6sx-gpt", "fsl,imx31-gpt"; | 470 | compatible = "fsl,imx6sx-gpt", "fsl,imx6dl-gpt"; |
| 471 | reg = <0x02098000 0x4000>; | 471 | reg = <0x02098000 0x4000>; |
| 472 | interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; | 472 | interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; |
| 473 | clocks = <&clks IMX6SX_CLK_GPT_BUS>, | 473 | clocks = <&clks IMX6SX_CLK_GPT_BUS>, |
| @@ -36,8 +36,8 @@ · 35 unmodified lines | |||
| 36 | compatible = "gpio-fan"; | 36 | compatible = "gpio-fan"; |
| 37 | pinctrl-0 = <&pmx_fan_high_speed &pmx_fan_low_speed>; | 37 | pinctrl-0 = <&pmx_fan_high_speed &pmx_fan_low_speed>; |
| 38 | pinctrl-names = "default"; | 38 | pinctrl-names = "default"; |
| 39 | gpios = <&gpio1 14 GPIO_ACTIVE_LOW | 39 | gpios = <&gpio1 14 GPIO_ACTIVE_HIGH |
| 40 | &gpio1 13 GPIO_ACTIVE_LOW>; | 40 | &gpio1 13 GPIO_ACTIVE_HIGH>; |
| 41 | gpio-fan,speed-map = <0 0 | 41 | gpio-fan,speed-map = <0 0 |
| 42 | 3000 1 | 42 | 3000 1 |
| 43 | 6000 2>; | 43 | 6000 2>; |
| @@ -274,7 +274,7 @@ · 273 unmodified lines | |||
| 274 | compatible = "amlogic,meson6-dwmac", "snps,dwmac"; | 274 | compatible = "amlogic,meson6-dwmac", "snps,dwmac"; |
| 275 | reg = <0xc9410000 0x10000 | 275 | reg = <0xc9410000 0x10000 |
| 276 | 0xc1108108 0x4>; | 276 | 0xc1108108 0x4>; |
| 277 | interrupts = <GIC_SPI 8 IRQ_TYPE_EDGE_RISING>; | 277 | interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>; |
| 278 | interrupt-names = "macirq"; | 278 | interrupt-names = "macirq"; |
| 279 | status = "disabled"; | 279 | status = "disabled"; |
| 280 | }; | 280 | }; |
| @@ -205,8 +205,7 @@ · 204 unmodified lines | |||
| 205 | cap-sd-highspeed; | 205 | cap-sd-highspeed; |
| 206 | disable-wp; | 206 | disable-wp; |
| 207 | 207 | ||
| 208 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 208 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 209 | cd-inverted; | ||
| 210 | 209 | ||
| 211 | vmmc-supply = <&vcc_3v3>; | 210 | vmmc-supply = <&vcc_3v3>; |
| 212 | }; | 211 | }; |
| @@ -221,7 +221,6 @@ · 220 unmodified lines | |||
| 221 | /* Realtek RTL8211F (0x001cc916) */ | 221 | /* Realtek RTL8211F (0x001cc916) */ |
| 222 | eth_phy: ethernet-phy@0 { | 222 | eth_phy: ethernet-phy@0 { |
| 223 | reg = <0>; | 223 | reg = <0>; |
| 224 | eee-broken-1000t; | ||
| 225 | interrupt-parent = <&gpio_intc>; | 224 | interrupt-parent = <&gpio_intc>; |
| 226 | /* GPIOH_3 */ | 225 | /* GPIOH_3 */ |
| 227 | interrupts = <17 IRQ_TYPE_LEVEL_LOW>; | 226 | interrupts = <17 IRQ_TYPE_LEVEL_LOW>; |
| @@ -273,8 +272,7 @@ · 45 unmodified lines | |||
| 273 | cap-sd-highspeed; | 272 | cap-sd-highspeed; |
| 274 | disable-wp; | 273 | disable-wp; |
| 275 | 274 | ||
| 276 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 275 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 277 | cd-inverted; | ||
| 278 | 276 | ||
| 279 | vmmc-supply = <&tflash_vdd>; | 277 | vmmc-supply = <&tflash_vdd>; |
| 280 | vqmmc-supply = <&tf_io>; | 278 | vqmmc-supply = <&tf_io>; |
| @@ -206,8 +206,7 @@ · 205 unmodified lines | |||
| 206 | cap-sd-highspeed; | 206 | cap-sd-highspeed; |
| 207 | disable-wp; | 207 | disable-wp; |
| 208 | 208 | ||
| 209 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 209 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 210 | cd-inverted; | ||
| 211 | 210 | ||
| 212 | vmmc-supply = <&vcc_3v3>; | 211 | vmmc-supply = <&vcc_3v3>; |
| 213 | }; | 212 | }; |
| @@ -105,7 +105,7 @@ · 104 unmodified lines | |||
| 105 | interrupts-extended = < | 105 | interrupts-extended = < |
| 106 | &cpcap 15 0 &cpcap 14 0 &cpcap 28 0 &cpcap 19 0 | 106 | &cpcap 15 0 &cpcap 14 0 &cpcap 28 0 &cpcap 19 0 |
| 107 | &cpcap 18 0 &cpcap 17 0 &cpcap 16 0 &cpcap 49 0 | 107 | &cpcap 18 0 &cpcap 17 0 &cpcap 16 0 &cpcap 49 0 |
| 108 | &cpcap 48 1 | 108 | &cpcap 48 0 |
| 109 | >; | 109 | >; |
| 110 | interrupt-names = | 110 | interrupt-names = |
| 111 | "id_ground", "id_float", "se0conn", "vbusvld", | 111 | "id_ground", "id_float", "se0conn", "vbusvld", |
| @@ -714,11 +714,7 @@ · 713 unmodified lines | |||
| 714 | 714 | ||
| 715 | vdda-supply = <&vdac>; | 715 | vdda-supply = <&vdac>; |
| 716 | 716 | ||
| 717 | #address-cells = <1>; | ||
| 718 | #size-cells = <0>; | ||
| 719 | |||
| 720 | port { | 717 | port { |
| 721 | reg = <0>; | ||
| 722 | venc_out: endpoint { | 718 | venc_out: endpoint { |
| 723 | remote-endpoint = <&opa_in>; | 719 | remote-endpoint = <&opa_in>; |
| 724 | ti,channels = <1>; | 720 | ti,channels = <1>; |
| @@ -814,7 +814,7 @@ · 813 unmodified lines | |||
| 814 | /* For debugging, it is often good idea to remove this GPIO. | 814 | /* For debugging, it is often good idea to remove this GPIO. |
| 815 | It means you can remove back cover (to reboot by removing | 815 | It means you can remove back cover (to reboot by removing |
| 816 | battery) and still use the MMC card. */ | 816 | battery) and still use the MMC card. */ |
| 817 | cd-gpios = <&gpio6 0 GPIO_ACTIVE_HIGH>; /* 160 */ | 817 | cd-gpios = <&gpio6 0 GPIO_ACTIVE_LOW>; /* 160 */ |
| 818 | }; | 818 | }; |
| 819 | 819 | ||
| 820 | /* most boards use vaux3, only some old versions use vmmc2 instead */ | 820 | /* most boards use vaux3, only some old versions use vmmc2 instead */ |
| @@ -370,6 +370,19 @@ · 369 unmodified lines | |||
| 370 | compatible = "ti,omap2-onenand"; | 370 | compatible = "ti,omap2-onenand"; |
| 371 | reg = <0 0 0x20000>; /* CS0, offset 0, IO size 128K */ | 371 | reg = <0 0 0x20000>; /* CS0, offset 0, IO size 128K */ |
| 372 | 372 | ||
| 373 | /* | ||
| 374 | * These timings are based on CONFIG_OMAP_GPMC_DEBUG=y reported | ||
| 375 | * bootloader set values when booted with v4.19 using both N950 | ||
| 376 | * and N9 devices (OneNAND Manufacturer: Samsung): | ||
| 377 | * | ||
| 378 | * gpmc cs0 before gpmc_cs_program_settings: | ||
| 379 | * cs0 GPMC_CS_CONFIG1: 0xfd001202 | ||
| 380 | * cs0 GPMC_CS_CONFIG2: 0x00181800 | ||
| 381 | * cs0 GPMC_CS_CONFIG3: 0x00030300 | ||
| 382 | * cs0 GPMC_CS_CONFIG4: 0x18001804 | ||
| 383 | * cs0 GPMC_CS_CONFIG5: 0x03171d1d | ||
| 384 | * cs0 GPMC_CS_CONFIG6: 0x97080000 | ||
| 385 | */ | ||
| 373 | gpmc,sync-read; | 386 | gpmc,sync-read; |
| 374 | gpmc,sync-write; | 387 | gpmc,sync-write; |
| 375 | gpmc,burst-length = <16>; | 388 | gpmc,burst-length = <16>; |
| @@ -379,26 +392,27 @@ · 3 unmodified lines | |||
| 379 | gpmc,device-width = <2>; | 392 | gpmc,device-width = <2>; |
| 380 | gpmc,mux-add-data = <2>; | 393 | gpmc,mux-add-data = <2>; |
| 381 | gpmc,cs-on-ns = <0>; | 394 | gpmc,cs-on-ns = <0>; |
| 382 | gpmc,cs-rd-off-ns = <87>; | 395 | gpmc,cs-rd-off-ns = <122>; |
| 383 | gpmc,cs-wr-off-ns = <87>; | 396 | gpmc,cs-wr-off-ns = <122>; |
| 384 | gpmc,adv-on-ns = <0>; | 397 | gpmc,adv-on-ns = <0>; |
| 385 | gpmc,adv-rd-off-ns = <10>; | 398 | gpmc,adv-rd-off-ns = <15>; |
| 386 | gpmc,adv-wr-off-ns = <10>; | 399 | gpmc,adv-wr-off-ns = <15>; |
| 387 | gpmc,oe-on-ns = <15>; | 400 | gpmc,oe-on-ns = <20>; |
| 388 | gpmc,oe-off-ns = <87>; | 401 | gpmc,oe-off-ns = <122>; |
| 389 | gpmc,we-on-ns = <0>; | 402 | gpmc,we-on-ns = <0>; |
| 390 | gpmc,we-off-ns = <87>; | 403 | gpmc,we-off-ns = <122>; |
| 391 | gpmc,rd-cycle-ns = <112>; | 404 | gpmc,rd-cycle-ns = <148>; |
| 392 | gpmc,wr-cycle-ns = <112>; | 405 | gpmc,wr-cycle-ns = <148>; |
| 393 | gpmc,access-ns = <81>; | 406 | gpmc,access-ns = <117>; |
| 394 | gpmc,page-burst-access-ns = <15>; | 407 | gpmc,page-burst-access-ns = <15>; |
| 395 | gpmc,bus-turnaround-ns = <0>; | 408 | gpmc,bus-turnaround-ns = <0>; |
| 396 | gpmc,cycle2cycle-delay-ns = <0>; | 409 | gpmc,cycle2cycle-delay-ns = <0>; |
| 397 | gpmc,wait-monitoring-ns = <0>; | 410 | gpmc,wait-monitoring-ns = <0>; |
| 398 | gpmc,clk-activation-ns = <5>; | 411 | gpmc,clk-activation-ns = <10>; |
| 399 | gpmc,wr-data-mux-bus-ns = <30>; | 412 | gpmc,wr-data-mux-bus-ns = <40>; |
| 400 | gpmc,wr-access-ns = <81>; | 413 | gpmc,wr-access-ns = <117>; |
| 401 | gpmc,sync-clk-ps = <15000>; | 414 | |
| 415 | gpmc,sync-clk-ps = <15000>; /* TBC; Where this value came? */ | ||
| 402 | 416 | ||
| 403 | /* | 417 | /* |
| 404 | * MTD partition table corresponding to Nokia's MeeGo 1.2 | 418 | * MTD partition table corresponding to Nokia's MeeGo 1.2 |
| @@ -1046,8 +1046,6 @@ · 1045 unmodified lines | |||
| 1046 | <SYSC_IDLE_SMART>, | 1046 | <SYSC_IDLE_SMART>, |
| 1047 | <SYSC_IDLE_SMART_WKUP>; | 1047 | <SYSC_IDLE_SMART_WKUP>; |
| 1048 | ti,syss-mask = <1>; | 1048 | ti,syss-mask = <1>; |
| 1049 | ti,no-reset-on-init; | ||
| 1050 | ti,no-idle-on-init; | ||
| 1051 | /* Domains (V, P, C): core, core_pwrdm, l4per_clkdm */ | 1049 | /* Domains (V, P, C): core, core_pwrdm, l4per_clkdm */ |
| 1052 | clocks = <&l4per_clkctrl OMAP5_UART3_CLKCTRL 0>; | 1050 | clocks = <&l4per_clkctrl OMAP5_UART3_CLKCTRL 0>; |
| 1053 | clock-names = "fck"; | 1051 | clock-names = "fck"; |
| @@ -1681,15 +1681,12 @@ · 1680 unmodified lines | |||
| 1681 | 1681 | ||
| 1682 | du: display@feb00000 { | 1682 | du: display@feb00000 { |
| 1683 | compatible = "renesas,du-r8a7743"; | 1683 | compatible = "renesas,du-r8a7743"; |
| 1684 | reg = <0 0xfeb00000 0 0x40000>, | 1684 | reg = <0 0xfeb00000 0 0x40000>; |
| 1685 | <0 0xfeb90000 0 0x1c>; | ||
| 1686 | reg-names = "du", "lvds.0"; | ||
| 1687 | interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>, | 1685 | interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>, |
| 1688 | <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>; | 1686 | <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>; |
| 1689 | clocks = <&cpg CPG_MOD 724>, | 1687 | clocks = <&cpg CPG_MOD 724>, |
| 1690 | <&cpg CPG_MOD 723>, | 1688 | <&cpg CPG_MOD 723>; |
| 1691 | <&cpg CPG_MOD 726>; | 1689 | clock-names = "du.0", "du.1"; |
| 1692 | clock-names = "du.0", "du.1", "lvds.0"; | ||
| 1693 | status = "disabled"; | 1690 | status = "disabled"; |
| 1694 | 1691 | ||
| 1695 | ports { | 1692 | ports { |
| @@ -1704,6 +1701,33 @@ · 8 unmodified lines | |||
| 1704 | port@1 { | 1701 | port@1 { |
| 1705 | reg = <1>; | 1702 | reg = <1>; |
| 1706 | du_out_lvds0: endpoint { | 1703 | du_out_lvds0: endpoint { |
| 1704 | remote-endpoint = <&lvds0_in>; | ||
| 1705 | }; | ||
| 1706 | }; | ||
| 1707 | }; | ||
| 1708 | }; | ||
| 1709 | |||
| 1710 | lvds0: lvds@feb90000 { | ||
| 1711 | compatible = "renesas,r8a7743-lvds"; | ||
| 1712 | reg = <0 0xfeb90000 0 0x1c>; | ||
| 1713 | clocks = <&cpg CPG_MOD 726>; | ||
| 1714 | power-domains = <&sysc R8A7743_PD_ALWAYS_ON>; | ||
| 1715 | resets = <&cpg 726>; | ||
| 1716 | status = "disabled"; | ||
| 1717 | |||
| 1718 | ports { | ||
| 1719 | #address-cells = <1>; | ||
| 1720 | #size-cells = <0>; | ||
| 1721 | |||
| 1722 | port@0 { | ||
| 1723 | reg = <0>; | ||
| 1724 | lvds0_in: endpoint { | ||
| 1725 | remote-endpoint = <&du_out_lvds0>; | ||
| 1726 | }; | ||
| 1727 | }; | ||
| 1728 | port@1 { | ||
| 1729 | reg = <1>; | ||
| 1730 | lvds0_out: endpoint { | ||
| 1707 | }; | 1731 | }; |
| 1708 | }; | 1732 | }; |
| 1709 | }; | 1733 | }; |
| @@ -216,6 +216,7 @@ · 215 unmodified lines | |||
| 216 | #clock-cells = <0>; | 216 | #clock-cells = <0>; |
| 217 | compatible = "fixed-clock"; | 217 | compatible = "fixed-clock"; |
| 218 | clock-frequency = <24000000>; | 218 | clock-frequency = <24000000>; |
| 219 | clock-output-names = "osc24M"; | ||
| 219 | }; | 220 | }; |
| 220 | 221 | ||
| 221 | osc32k: clk-32k { | 222 | osc32k: clk-32k { |
| @@ -53,7 +53,7 @@ · 52 unmodified lines | |||
| 53 | 53 | ||
| 54 | aliases { | 54 | aliases { |
| 55 | serial0 = &uart0; | 55 | serial0 = &uart0; |
| 56 | /* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */ | 56 | ethernet0 = &emac; |
| 57 | ethernet1 = &sdiowifi; | 57 | ethernet1 = &sdiowifi; |
| 58 | }; | 58 | }; |
| 59 | 59 | ||
| @@ -110,11 +110,11 @@ · 109 unmodified lines | |||
| 110 | bus-num = <3>; | 110 | bus-num = <3>; |
| 111 | status = "okay"; | 111 | status = "okay"; |
| 112 | spi-slave; | 112 | spi-slave; |
| 113 | #address-cells = <0>; | ||
| 113 | 114 | ||
| 114 | slave@0 { | 115 | slave { |
| 115 | compatible = "lwn,bk4"; | 116 | compatible = "lwn,bk4"; |
| 116 | spi-max-frequency = <30000000>; | 117 | spi-max-frequency = <30000000>; |
| 117 | reg = <0>; | ||
| 118 | }; | 118 | }; |
| 119 | }; | 119 | }; |
| 120 | 120 | ||
| @@ -1 +1,95 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _ASM_ARM_XEN_PAGE_COHERENT_H | ||
| 3 | #define _ASM_ARM_XEN_PAGE_COHERENT_H | ||
| 4 | |||
| 5 | #include <linux/dma-mapping.h> | ||
| 6 | #include <asm/page.h> | ||
| 1 | #include <xen/arm/page-coherent.h> | 7 | #include <xen/arm/page-coherent.h> |
| 8 | |||
| 9 | static inline const struct dma_map_ops *xen_get_dma_ops(struct device *dev) | ||
| 10 | { | ||
| 11 | if (dev && dev->archdata.dev_dma_ops) | ||
| 12 | return dev->archdata.dev_dma_ops; | ||
| 13 | return get_arch_dma_ops(NULL); | ||
| 14 | } | ||
| 15 | |||
| 16 | static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size, | ||
| 17 | dma_addr_t *dma_handle, gfp_t flags, unsigned long attrs) | ||
| 18 | { | ||
| 19 | return xen_get_dma_ops(hwdev)->alloc(hwdev, size, dma_handle, flags, attrs); | ||
| 20 | } | ||
| 21 | |||
| 22 | static inline void xen_free_coherent_pages(struct device *hwdev, size_t size, | ||
| 23 | void *cpu_addr, dma_addr_t dma_handle, unsigned long attrs) | ||
| 24 | { | ||
| 25 | xen_get_dma_ops(hwdev)->free(hwdev, size, cpu_addr, dma_handle, attrs); | ||
| 26 | } | ||
| 27 | |||
| 28 | static inline void xen_dma_map_page(struct device *hwdev, struct page *page, | ||
| 29 | dma_addr_t dev_addr, unsigned long offset, size_t size, | ||
| 30 | enum dma_data_direction dir, unsigned long attrs) | ||
| 31 | { | ||
| 32 | unsigned long page_pfn = page_to_xen_pfn(page); | ||
| 33 | unsigned long dev_pfn = XEN_PFN_DOWN(dev_addr); | ||
| 34 | unsigned long compound_pages = | ||
| 35 | (1<<compound_order(page)) * XEN_PFN_PER_PAGE; | ||
| 36 | bool local = (page_pfn <= dev_pfn) && | ||
| 37 | (dev_pfn - page_pfn < compound_pages); | ||
| 38 | |||
| 39 | /* | ||
| 40 | * Dom0 is mapped 1:1, while the Linux page can span across | ||
| 41 | * multiple Xen pages, it's not possible for it to contain a | ||
| 42 | * mix of local and foreign Xen pages. So if the first xen_pfn | ||
| 43 | * == mfn the page is local otherwise it's a foreign page | ||
| 44 | * grant-mapped in dom0. If the page is local we can safely | ||
| 45 | * call the native dma_ops function, otherwise we call the xen | ||
| 46 | * specific function. | ||
| 47 | */ | ||
| 48 | if (local) | ||
| 49 | xen_get_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs); | ||
| 50 | else | ||
| 51 | __xen_dma_map_page(hwdev, page, dev_addr, offset, size, dir, attrs); | ||
| 52 | } | ||
| 53 | |||
| 54 | static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, | ||
| 55 | size_t size, enum dma_data_direction dir, unsigned long attrs) | ||
| 56 | { | ||
| 57 | unsigned long pfn = PFN_DOWN(handle); | ||
| 58 | /* | ||
| 59 | * Dom0 is mapped 1:1, while the Linux page can be spanned accross | ||
| 60 | * multiple Xen page, it's not possible to have a mix of local and | ||
| 61 | * foreign Xen page. Dom0 is mapped 1:1, so calling pfn_valid on a | ||
| 62 | * foreign mfn will always return false. If the page is local we can | ||
| 63 | * safely call the native dma_ops function, otherwise we call the xen | ||
| 64 | * specific function. | ||
| 65 | */ | ||
| 66 | if (pfn_valid(pfn)) { | ||
| 67 | if (xen_get_dma_ops(hwdev)->unmap_page) | ||
| 68 | xen_get_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs); | ||
| 69 | } else | ||
| 70 | __xen_dma_unmap_page(hwdev, handle, size, dir, attrs); | ||
| 71 | } | ||
| 72 | |||
| 73 | static inline void xen_dma_sync_single_for_cpu(struct device *hwdev, | ||
| 74 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
| 75 | { | ||
| 76 | unsigned long pfn = PFN_DOWN(handle); | ||
| 77 | if (pfn_valid(pfn)) { | ||
| 78 | if (xen_get_dma_ops(hwdev)->sync_single_for_cpu) | ||
| 79 | xen_get_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir); | ||
| 80 | } else | ||
| 81 | __xen_dma_sync_single_for_cpu(hwdev, handle, size, dir); | ||
| 82 | } | ||
| 83 | |||
| 84 | static inline void xen_dma_sync_single_for_device(struct device *hwdev, | ||
| 85 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
| 86 | { | ||
| 87 | unsigned long pfn = PFN_DOWN(handle); | ||
| 88 | if (pfn_valid(pfn)) { | ||
| 89 | if (xen_get_dma_ops(hwdev)->sync_single_for_device) | ||
| 90 | xen_get_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir); | ||
| 91 | } else | ||
| 92 | __xen_dma_sync_single_for_device(hwdev, handle, size, dir); | ||
| 93 | } | ||
| 94 | |||
| 95 | #endif /* _ASM_ARM_XEN_PAGE_COHERENT_H */ | ||
| @@ -83,7 +83,7 @@ static void __iomem *cns3xxx_pci_map_bus(struct pci_bus *bus, · 82 unmodified lines | |||
| 83 | } else /* remote PCI bus */ | 83 | } else /* remote PCI bus */ |
| 84 | base = cnspci->cfg1_regs + ((busno & 0xf) << 20); | 84 | base = cnspci->cfg1_regs + ((busno & 0xf) << 20); |
| 85 | 85 | ||
| 86 | return base + (where & 0xffc) + (devfn << 12); | 86 | return base + where + (devfn << 12); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, | 89 | static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, |
| @@ -93,7 +93,7 @@ static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, · 3 unmodified lines | |||
| 93 | u32 mask = (0x1ull << (size * 8)) - 1; | 93 | u32 mask = (0x1ull << (size * 8)) - 1; |
| 94 | int shift = (where % 4) * 8; | 94 | int shift = (where % 4) * 8; |
| 95 | 95 | ||
| 96 | ret = pci_generic_config_read32(bus, devfn, where, size, val); | 96 | ret = pci_generic_config_read(bus, devfn, where, size, val); |
| 97 | 97 | ||
| 98 | if (ret == PCIBIOS_SUCCESSFUL && !bus->number && !devfn && | 98 | if (ret == PCIBIOS_SUCCESSFUL && !bus->number && !devfn && |
| 99 | (where & 0xffc) == PCI_CLASS_REVISION) | 99 | (where & 0xffc) == PCI_CLASS_REVISION) |
| @@ -208,9 +208,9 @@ static struct gpiod_lookup_table mmc_gpios_table = { · 207 unmodified lines | |||
| 208 | .dev_id = "da830-mmc.0", | 208 | .dev_id = "da830-mmc.0", |
| 209 | .table = { | 209 | .table = { |
| 210 | /* gpio chip 1 contains gpio range 32-63 */ | 210 | /* gpio chip 1 contains gpio range 32-63 */ |
| 211 | GPIO_LOOKUP("davinci_gpio.0", DA830_MMCSD_CD_PIN, "cd", | 211 | GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_CD_PIN, "cd", |
| 212 | GPIO_ACTIVE_LOW), | 212 | GPIO_ACTIVE_LOW), |
| 213 | GPIO_LOOKUP("davinci_gpio.0", DA830_MMCSD_WP_PIN, "wp", | 213 | GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_WP_PIN, "wp", |
| 214 | GPIO_ACTIVE_LOW), | 214 | GPIO_ACTIVE_LOW), |
| 215 | }, | 215 | }, |
| 216 | }; | 216 | }; |
| @@ -805,9 +805,9 @@ static struct gpiod_lookup_table mmc_gpios_table = { · 804 unmodified lines | |||
| 805 | .dev_id = "da830-mmc.0", | 805 | .dev_id = "da830-mmc.0", |
| 806 | .table = { | 806 | .table = { |
| 807 | /* gpio chip 2 contains gpio range 64-95 */ | 807 | /* gpio chip 2 contains gpio range 64-95 */ |
| 808 | GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_CD_PIN, "cd", | 808 | GPIO_LOOKUP("davinci_gpio", DA850_MMCSD_CD_PIN, "cd", |
| 809 | GPIO_ACTIVE_LOW), | 809 | GPIO_ACTIVE_LOW), |
| 810 | GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_WP_PIN, "wp", | 810 | GPIO_LOOKUP("davinci_gpio", DA850_MMCSD_WP_PIN, "wp", |
| 811 | GPIO_ACTIVE_HIGH), | 811 | GPIO_ACTIVE_HIGH), |
| 812 | }, | 812 | }, |
| 813 | }; | 813 | }; |
| @@ -117,9 +117,9 @@ static struct platform_device davinci_nand_device = { · 116 unmodified lines | |||
| 117 | static struct gpiod_lookup_table i2c_recovery_gpiod_table = { | 117 | static struct gpiod_lookup_table i2c_recovery_gpiod_table = { |
| 118 | .dev_id = "i2c_davinci.1", | 118 | .dev_id = "i2c_davinci.1", |
| 119 | .table = { | 119 | .table = { |
| 120 | GPIO_LOOKUP("davinci_gpio.0", DM355_I2C_SDA_PIN, "sda", | 120 | GPIO_LOOKUP("davinci_gpio", DM355_I2C_SDA_PIN, "sda", |
| 121 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), | 121 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
| 122 | GPIO_LOOKUP("davinci_gpio.0", DM355_I2C_SCL_PIN, "scl", | 122 | GPIO_LOOKUP("davinci_gpio", DM355_I2C_SCL_PIN, "scl", |
| 123 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), | 123 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
| 124 | }, | 124 | }, |
| 125 | }; | 125 | }; |
| @@ -660,9 +660,9 @@ static struct i2c_board_info __initdata i2c_info[] = { · 659 unmodified lines | |||
| 660 | static struct gpiod_lookup_table i2c_recovery_gpiod_table = { | 660 | static struct gpiod_lookup_table i2c_recovery_gpiod_table = { |
| 661 | .dev_id = "i2c_davinci.1", | 661 | .dev_id = "i2c_davinci.1", |
| 662 | .table = { | 662 | .table = { |
| 663 | GPIO_LOOKUP("davinci_gpio.0", DM644X_I2C_SDA_PIN, "sda", | 663 | GPIO_LOOKUP("davinci_gpio", DM644X_I2C_SDA_PIN, "sda", |
| 664 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), | 664 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
| 665 | GPIO_LOOKUP("davinci_gpio.0", DM644X_I2C_SCL_PIN, "scl", | 665 | GPIO_LOOKUP("davinci_gpio", DM644X_I2C_SCL_PIN, "scl", |
| 666 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), | 666 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
| 667 | }, | 667 | }, |
| 668 | }; | 668 | }; |
| @@ -134,9 +134,9 @@ static const short hawk_mmcsd0_pins[] = { · 133 unmodified lines | |||
| 134 | static struct gpiod_lookup_table mmc_gpios_table = { | 134 | static struct gpiod_lookup_table mmc_gpios_table = { |
| 135 | .dev_id = "da830-mmc.0", | 135 | .dev_id = "da830-mmc.0", |
| 136 | .table = { | 136 | .table = { |
| 137 | GPIO_LOOKUP("davinci_gpio.0", DA850_HAWK_MMCSD_CD_PIN, "cd", | 137 | GPIO_LOOKUP("davinci_gpio", DA850_HAWK_MMCSD_CD_PIN, "cd", |
| 138 | GPIO_ACTIVE_LOW), | 138 | GPIO_ACTIVE_LOW), |
| 139 | GPIO_LOOKUP("davinci_gpio.0", DA850_HAWK_MMCSD_WP_PIN, "wp", | 139 | GPIO_LOOKUP("davinci_gpio", DA850_HAWK_MMCSD_WP_PIN, "wp", |
| 140 | GPIO_ACTIVE_LOW), | 140 | GPIO_ACTIVE_LOW), |
| 141 | }, | 141 | }, |
| 142 | }; | 142 | }; |
| @@ -390,10 +390,14 @@ static int __ref impd1_probe(struct lm_device *dev) · 389 unmodified lines | |||
| 390 | char *mmciname; | 390 | char *mmciname; |
| 391 | 391 | ||
| 392 | lookup = devm_kzalloc(&dev->dev, | 392 | lookup = devm_kzalloc(&dev->dev, |
| 393 | sizeof(*lookup) + 3 * sizeof(struct gpiod_lookup), | 393 | struct_size(lookup, table, 3), |
| 394 | GFP_KERNEL); | 394 | GFP_KERNEL); |
| 395 | chipname = devm_kstrdup(&dev->dev, devname, GFP_KERNEL); | 395 | chipname = devm_kstrdup(&dev->dev, devname, GFP_KERNEL); |
| 396 | mmciname = kasprintf(GFP_KERNEL, "lm%x:00700", dev->id); | 396 | mmciname = devm_kasprintf(&dev->dev, GFP_KERNEL, |
| 397 | "lm%x:00700", dev->id); | ||
| 398 | if (!lookup || !chipname || !mmciname) | ||
| 399 | return -ENOMEM; | ||
| 400 | |||
| 397 | lookup->dev_id = mmciname; | 401 | lookup->dev_id = mmciname; |
| 398 | /* | 402 | /* |
| 399 | * Offsets on GPIO block 1: | 403 | * Offsets on GPIO block 1: |
| @@ -75,8 +75,7 @@ void __init n2100_map_io(void) · 74 unmodified lines | |||
| 75 | /* | 75 | /* |
| 76 | * N2100 PCI. | 76 | * N2100 PCI. |
| 77 | */ | 77 | */ |
| 78 | static int __init | 78 | static int n2100_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
| 79 | n2100_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
| 80 | { | 79 | { |
| 81 | int irq; | 80 | int irq; |
| 82 | 81 | ||
| @@ -32,6 +32,8 @@ void __iomem *rst_manager_base_addr; · 31 unmodified lines | |||
| 32 | void __iomem *sdr_ctl_base_addr; | 32 | void __iomem *sdr_ctl_base_addr; |
| 33 | unsigned long socfpga_cpu1start_addr; | 33 | unsigned long socfpga_cpu1start_addr; |
| 34 | 34 | ||
| 35 | extern void __init socfpga_reset_init(void); | ||
| 36 | |||
| 35 | static void __init socfpga_sysmgr_init(void) | 37 | static void __init socfpga_sysmgr_init(void) |
| 36 | { | 38 | { |
| 37 | struct device_node *np; | 39 | struct device_node *np; |
| @@ -64,6 +66,7 @@ static void __init socfpga_init_irq(void) · 26 unmodified lines | |||
| 64 | 66 | ||
| 65 | if (IS_ENABLED(CONFIG_EDAC_ALTERA_OCRAM)) | 67 | if (IS_ENABLED(CONFIG_EDAC_ALTERA_OCRAM)) |
| 66 | socfpga_init_ocram_ecc(); | 68 | socfpga_init_ocram_ecc(); |
| 69 | socfpga_reset_init(); | ||
| 67 | } | 70 | } |
| 68 | 71 | ||
| 69 | static void __init socfpga_arria10_init_irq(void) | 72 | static void __init socfpga_arria10_init_irq(void) |
| @@ -74,6 +77,7 @@ static void __init socfpga_arria10_init_irq(void) · 4 unmodified lines | |||
| 74 | socfpga_init_arria10_l2_ecc(); | 77 | socfpga_init_arria10_l2_ecc(); |
| 75 | if (IS_ENABLED(CONFIG_EDAC_ALTERA_OCRAM)) | 78 | if (IS_ENABLED(CONFIG_EDAC_ALTERA_OCRAM)) |
| 76 | socfpga_init_arria10_ocram_ecc(); | 79 | socfpga_init_arria10_ocram_ecc(); |
| 80 | socfpga_reset_init(); | ||
| 77 | } | 81 | } |
| 78 | 82 | ||
| 79 | static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd) | 83 | static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd) |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | |||
| 3 | #include <linux/suspend.h> | 3 | #include <linux/suspend.h> |
| 4 | #include <asm/suspend.h> | 4 | #include <asm/suspend.h> |
| 5 | #include "smc.h" | 5 | #include "smc.h" |
| 6 | #include "pm.h" | ||
| 6 | 7 | ||
| 7 | static int tango_pm_powerdown(unsigned long arg) | 8 | static int tango_pm_powerdown(unsigned long arg) |
| 8 | { | 9 | { |
| @@ -24,10 +25,7 @@ static const struct platform_suspend_ops tango_pm_ops = { · 15 unmodified lines | |||
| 24 | .valid = suspend_valid_only_mem, | 25 | .valid = suspend_valid_only_mem, |
| 25 | }; | 26 | }; |
| 26 | 27 | ||
| 27 | static int __init tango_pm_init(void) | 28 | void __init tango_pm_init(void) |
| 28 | { | 29 | { |
| 29 | suspend_set_ops(&tango_pm_ops); | 30 | suspend_set_ops(&tango_pm_ops); |
| 30 | return 0; | ||
| 31 | } | 31 | } |
| 32 | |||
| 33 | late_initcall(tango_pm_init); | ||
| @@ -0,0 +1,7 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | |||
| 3 | #ifdef CONFIG_SUSPEND | ||
| 4 | void __init tango_pm_init(void); | ||
| 5 | #else | ||
| 6 | #define tango_pm_init NULL | ||
| 7 | #endif | ||
| @@ -2,6 +2,7 @@ · 1 unmodified line | |||
| 2 | #include <asm/mach/arch.h> | 2 | #include <asm/mach/arch.h> |
| 3 | #include <asm/hardware/cache-l2x0.h> | 3 | #include <asm/hardware/cache-l2x0.h> |
| 4 | #include "smc.h" | 4 | #include "smc.h" |
| 5 | #include "pm.h" | ||
| 5 | 6 | ||
| 6 | static void tango_l2c_write(unsigned long val, unsigned int reg) | 7 | static void tango_l2c_write(unsigned long val, unsigned int reg) |
| 7 | { | 8 | { |
| @@ -15,4 +16,5 @@ DT_MACHINE_START(TANGO_DT, "Sigma Tango DT") · 7 unmodified lines | |||
| 15 | .dt_compat = tango_dt_compat, | 16 | .dt_compat = tango_dt_compat, |
| 16 | .l2c_aux_mask = ~0, | 17 | .l2c_aux_mask = ~0, |
| 17 | .l2c_write_sec = tango_l2c_write, | 18 | .l2c_write_sec = tango_l2c_write, |
| 19 | .init_late = tango_pm_init, | ||
| 18 | MACHINE_END | 20 | MACHINE_END |
| @@ -190,8 +190,6 @@ static int pxa_ssp_remove(struct platform_device *pdev) · 189 unmodified lines | |||
| 190 | if (ssp == NULL) | 190 | if (ssp == NULL) |
| 191 | return -ENODEV; | 191 | return -ENODEV; |
| 192 | 192 | ||
| 193 | iounmap(ssp->mmio_base); | ||
| 194 | |||
| 195 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 193 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 196 | release_mem_region(res->start, resource_size(res)); | 194 | release_mem_region(res->start, resource_size(res)); |
| 197 | 195 | ||
| @@ -201,7 +199,6 @@ static int pxa_ssp_remove(struct platform_device *pdev) · 3 unmodified lines | |||
| 201 | list_del(&ssp->node); | 199 | list_del(&ssp->node); |
| 202 | mutex_unlock(&ssp_lock); | 200 | mutex_unlock(&ssp_lock); |
| 203 | 201 | ||
| 204 | kfree(ssp); | ||
| 205 | return 0; | 202 | return 0; |
| 206 | } | 203 | } |
| 207 | 204 | ||
| @@ -7,7 +7,6 @@ · 6 unmodified lines | |||
| 7 | #include <linux/of_address.h> | 7 | #include <linux/of_address.h> |
| 8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
| 9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
| 10 | #include <linux/dma-mapping.h> | ||
| 11 | #include <linux/vmalloc.h> | 10 | #include <linux/vmalloc.h> |
| 12 | #include <linux/swiotlb.h> | 11 | #include <linux/swiotlb.h> |
| 13 | 12 | ||
| @@ -188,6 +188,7 @@ · 187 unmodified lines | |||
| 188 | reg = <0x3a3>; | 188 | reg = <0x3a3>; |
| 189 | interrupt-parent = <&r_intc>; | 189 | interrupt-parent = <&r_intc>; |
| 190 | interrupts = <0 IRQ_TYPE_LEVEL_LOW>; | 190 | interrupts = <0 IRQ_TYPE_LEVEL_LOW>; |
| 191 | x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */ | ||
| 191 | }; | 192 | }; |
| 192 | }; | 193 | }; |
| 193 | 194 | ||
| @@ -390,7 +390,7 @@ · 389 unmodified lines | |||
| 390 | }; | 390 | }; |
| 391 | 391 | ||
| 392 | video-codec@1c0e000 { | 392 | video-codec@1c0e000 { |
| 393 | compatible = "allwinner,sun50i-h5-video-engine"; | 393 | compatible = "allwinner,sun50i-a64-video-engine"; |
| 394 | reg = <0x01c0e000 0x1000>; | 394 | reg = <0x01c0e000 0x1000>; |
| 395 | clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>, | 395 | clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>, |
| 396 | <&ccu CLK_DRAM_VE>; | 396 | <&ccu CLK_DRAM_VE>; |
| @@ -187,8 +187,7 @@ · 186 unmodified lines | |||
| 187 | max-frequency = <100000000>; | 187 | max-frequency = <100000000>; |
| 188 | disable-wp; | 188 | disable-wp; |
| 189 | 189 | ||
| 190 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 190 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 191 | cd-inverted; | ||
| 192 | 191 | ||
| 193 | vmmc-supply = <&vddao_3v3>; | 192 | vmmc-supply = <&vddao_3v3>; |
| 194 | vqmmc-supply = <&vddio_boot>; | 193 | vqmmc-supply = <&vddio_boot>; |
| @@ -305,8 +305,7 @@ · 304 unmodified lines | |||
| 305 | max-frequency = <200000000>; | 305 | max-frequency = <200000000>; |
| 306 | disable-wp; | 306 | disable-wp; |
| 307 | 307 | ||
| 308 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 308 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 309 | cd-inverted; | ||
| 310 | 309 | ||
| 311 | vmmc-supply = <&vddio_ao3v3>; | 310 | vmmc-supply = <&vddio_ao3v3>; |
| 312 | vqmmc-supply = <&vddio_tf>; | 311 | vqmmc-supply = <&vddio_tf>; |
| @@ -238,8 +238,7 @@ · 237 unmodified lines | |||
| 238 | max-frequency = <100000000>; | 238 | max-frequency = <100000000>; |
| 239 | disable-wp; | 239 | disable-wp; |
| 240 | 240 | ||
| 241 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 241 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 242 | cd-inverted; | ||
| 243 | 242 | ||
| 244 | vmmc-supply = <&vddao_3v3>; | 243 | vmmc-supply = <&vddao_3v3>; |
| 245 | vqmmc-supply = <&vddio_card>; | 244 | vqmmc-supply = <&vddio_card>; |
| @@ -258,8 +258,7 @@ · 257 unmodified lines | |||
| 258 | max-frequency = <100000000>; | 258 | max-frequency = <100000000>; |
| 259 | disable-wp; | 259 | disable-wp; |
| 260 | 260 | ||
| 261 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 261 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 262 | cd-inverted; | ||
| 263 | 262 | ||
| 264 | vmmc-supply = <&tflash_vdd>; | 263 | vmmc-supply = <&tflash_vdd>; |
| 265 | vqmmc-supply = <&tf_io>; | 264 | vqmmc-supply = <&tf_io>; |
| @@ -196,8 +196,7 @@ · 195 unmodified lines | |||
| 196 | max-frequency = <100000000>; | 196 | max-frequency = <100000000>; |
| 197 | disable-wp; | 197 | disable-wp; |
| 198 | 198 | ||
| 199 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 199 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 200 | cd-inverted; | ||
| 201 | 200 | ||
| 202 | vmmc-supply = <&vddao_3v3>; | 201 | vmmc-supply = <&vddao_3v3>; |
| 203 | vqmmc-supply = <&vddio_card>; | 202 | vqmmc-supply = <&vddio_card>; |
| @@ -154,8 +154,7 @@ · 153 unmodified lines | |||
| 154 | max-frequency = <100000000>; | 154 | max-frequency = <100000000>; |
| 155 | disable-wp; | 155 | disable-wp; |
| 156 | 156 | ||
| 157 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 157 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 158 | cd-inverted; | ||
| 159 | 158 | ||
| 160 | vmmc-supply = <&vcc_3v3>; | 159 | vmmc-supply = <&vcc_3v3>; |
| 161 | }; | 160 | }; |
| @@ -211,8 +211,7 @@ · 210 unmodified lines | |||
| 211 | max-frequency = <100000000>; | 211 | max-frequency = <100000000>; |
| 212 | disable-wp; | 212 | disable-wp; |
| 213 | 213 | ||
| 214 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 214 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 215 | cd-inverted; | ||
| 216 | 215 | ||
| 217 | vmmc-supply = <&vddao_3v3>; | 216 | vmmc-supply = <&vddao_3v3>; |
| 218 | vqmmc-supply = <&vcc_3v3>; | 217 | vqmmc-supply = <&vcc_3v3>; |
| @@ -131,8 +131,7 @@ · 130 unmodified lines | |||
| 131 | max-frequency = <100000000>; | 131 | max-frequency = <100000000>; |
| 132 | disable-wp; | 132 | disable-wp; |
| 133 | 133 | ||
| 134 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 134 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 135 | cd-inverted; | ||
| 136 | 135 | ||
| 137 | vmmc-supply = <&vddao_3v3>; | 136 | vmmc-supply = <&vddao_3v3>; |
| 138 | vqmmc-supply = <&vddio_card>; | 137 | vqmmc-supply = <&vddio_card>; |
| @@ -238,8 +238,7 @@ · 237 unmodified lines | |||
| 238 | max-frequency = <100000000>; | 238 | max-frequency = <100000000>; |
| 239 | disable-wp; | 239 | disable-wp; |
| 240 | 240 | ||
| 241 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 241 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 242 | cd-inverted; | ||
| 243 | 242 | ||
| 244 | vmmc-supply = <&vcc_3v3>; | 243 | vmmc-supply = <&vcc_3v3>; |
| 245 | vqmmc-supply = <&vcc_card>; | 244 | vqmmc-supply = <&vcc_card>; |
| @@ -183,8 +183,7 @@ · 182 unmodified lines | |||
| 183 | max-frequency = <100000000>; | 183 | max-frequency = <100000000>; |
| 184 | disable-wp; | 184 | disable-wp; |
| 185 | 185 | ||
| 186 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 186 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 187 | cd-inverted; | ||
| 188 | 187 | ||
| 189 | vmmc-supply = <&vddao_3v3>; | 188 | vmmc-supply = <&vddao_3v3>; |
| 190 | vqmmc-supply = <&vddio_card>; | 189 | vqmmc-supply = <&vddio_card>; |
| @@ -137,8 +137,7 @@ · 136 unmodified lines | |||
| 137 | max-frequency = <100000000>; | 137 | max-frequency = <100000000>; |
| 138 | disable-wp; | 138 | disable-wp; |
| 139 | 139 | ||
| 140 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 140 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 141 | cd-inverted; | ||
| 142 | 141 | ||
| 143 | vmmc-supply = <&vddao_3v3>; | 142 | vmmc-supply = <&vddao_3v3>; |
| 144 | vqmmc-supply = <&vddio_boot>; | 143 | vqmmc-supply = <&vddio_boot>; |
| @@ -356,8 +356,7 @@ · 355 unmodified lines | |||
| 356 | max-frequency = <100000000>; | 356 | max-frequency = <100000000>; |
| 357 | disable-wp; | 357 | disable-wp; |
| 358 | 358 | ||
| 359 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 359 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 360 | cd-inverted; | ||
| 361 | 360 | ||
| 362 | vmmc-supply = <&vddao_3v3>; | 361 | vmmc-supply = <&vddao_3v3>; |
| 363 | vqmmc-supply = <&vddio_boot>; | 362 | vqmmc-supply = <&vddio_boot>; |
| @@ -147,8 +147,7 @@ · 146 unmodified lines | |||
| 147 | max-frequency = <100000000>; | 147 | max-frequency = <100000000>; |
| 148 | disable-wp; | 148 | disable-wp; |
| 149 | 149 | ||
| 150 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 150 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 151 | cd-inverted; | ||
| 152 | 151 | ||
| 153 | vmmc-supply = <&vddao_3v3>; | 152 | vmmc-supply = <&vddao_3v3>; |
| 154 | vqmmc-supply = <&vddio_boot>; | 153 | vqmmc-supply = <&vddio_boot>; |
| @@ -170,8 +170,7 @@ · 169 unmodified lines | |||
| 170 | max-frequency = <100000000>; | 170 | max-frequency = <100000000>; |
| 171 | disable-wp; | 171 | disable-wp; |
| 172 | 172 | ||
| 173 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 173 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 174 | cd-inverted; | ||
| 175 | 174 | ||
| 176 | vmmc-supply = <&vddao_3v3>; | 175 | vmmc-supply = <&vddao_3v3>; |
| 177 | vqmmc-supply = <&vddio_boot>; | 176 | vqmmc-supply = <&vddio_boot>; |
| @@ -183,7 +183,7 @@ · 182 unmodified lines | |||
| 183 | pinctrl-0 = <&cp0_pcie_pins>; | 183 | pinctrl-0 = <&cp0_pcie_pins>; |
| 184 | num-lanes = <4>; | 184 | num-lanes = <4>; |
| 185 | num-viewport = <8>; | 185 | num-viewport = <8>; |
| 186 | reset-gpio = <&cp0_gpio1 20 GPIO_ACTIVE_LOW>; | 186 | reset-gpios = <&cp0_gpio2 20 GPIO_ACTIVE_LOW>; |
| 187 | status = "okay"; | 187 | status = "okay"; |
| 188 | }; | 188 | }; |
| 189 | 189 | ||
| @@ -28,6 +28,23 @@ · 27 unmodified lines | |||
| 28 | method = "smc"; | 28 | method = "smc"; |
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | reserved-memory { | ||
| 32 | #address-cells = <2>; | ||
| 33 | #size-cells = <2>; | ||
| 34 | ranges; | ||
| 35 | |||
| 36 | /* | ||
| 37 | * This area matches the mapping done with a | ||
| 38 | * mainline U-Boot, and should be updated by the | ||
| 39 | * bootloader. | ||
| 40 | */ | ||
| 41 | |||
| 42 | psci-area@4000000 { | ||
| 43 | reg = <0x0 0x4000000 0x0 0x200000>; | ||
| 44 | no-map; | ||
| 45 | }; | ||
| 46 | }; | ||
| 47 | |||
| 31 | ap806 { | 48 | ap806 { |
| 32 | #address-cells = <2>; | 49 | #address-cells = <2>; |
| 33 | #size-cells = <2>; | 50 | #size-cells = <2>; |
| @@ -404,7 +404,7 @@ · 403 unmodified lines | |||
| 404 | }; | 404 | }; |
| 405 | 405 | ||
| 406 | intc: interrupt-controller@9bc0000 { | 406 | intc: interrupt-controller@9bc0000 { |
| 407 | compatible = "arm,gic-v3"; | 407 | compatible = "qcom,msm8996-gic-v3", "arm,gic-v3"; |
| 408 | #interrupt-cells = <3>; | 408 | #interrupt-cells = <3>; |
| 409 | interrupt-controller; | 409 | interrupt-controller; |
| 410 | #redistributor-regions = <1>; | 410 | #redistributor-regions = <1>; |
| @@ -1011,6 +1011,9 @@ · 1010 unmodified lines | |||
| 1011 | <&cpg CPG_CORE R8A774A1_CLK_S3D1>, | 1011 | <&cpg CPG_CORE R8A774A1_CLK_S3D1>, |
| 1012 | <&scif_clk>; | 1012 | <&scif_clk>; |
| 1013 | clock-names = "fck", "brg_int", "scif_clk"; | 1013 | clock-names = "fck", "brg_int", "scif_clk"; |
| 1014 | dmas = <&dmac1 0x13>, <&dmac1 0x12>, | ||
| 1015 | <&dmac2 0x13>, <&dmac2 0x12>; | ||
| 1016 | dma-names = "tx", "rx", "tx", "rx"; | ||
| 1014 | power-domains = <&sysc R8A774A1_PD_ALWAYS_ON>; | 1017 | power-domains = <&sysc R8A774A1_PD_ALWAYS_ON>; |
| 1015 | resets = <&cpg 310>; | 1018 | resets = <&cpg 310>; |
| 1016 | status = "disabled"; | 1019 | status = "disabled"; |
| @@ -1262,6 +1262,9 @@ · 1261 unmodified lines | |||
| 1262 | <&cpg CPG_CORE R8A7796_CLK_S3D1>, | 1262 | <&cpg CPG_CORE R8A7796_CLK_S3D1>, |
| 1263 | <&scif_clk>; | 1263 | <&scif_clk>; |
| 1264 | clock-names = "fck", "brg_int", "scif_clk"; | 1264 | clock-names = "fck", "brg_int", "scif_clk"; |
| 1265 | dmas = <&dmac1 0x13>, <&dmac1 0x12>, | ||
| 1266 | <&dmac2 0x13>, <&dmac2 0x12>; | ||
| 1267 | dma-names = "tx", "rx", "tx", "rx"; | ||
| 1265 | power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; | 1268 | power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; |
| 1266 | resets = <&cpg 310>; | 1269 | resets = <&cpg 310>; |
| 1267 | status = "disabled"; | 1270 | status = "disabled"; |
| @@ -1068,6 +1068,9 @@ · 1067 unmodified lines | |||
| 1068 | <&cpg CPG_CORE R8A77965_CLK_S3D1>, | 1068 | <&cpg CPG_CORE R8A77965_CLK_S3D1>, |
| 1069 | <&scif_clk>; | 1069 | <&scif_clk>; |
| 1070 | clock-names = "fck", "brg_int", "scif_clk"; | 1070 | clock-names = "fck", "brg_int", "scif_clk"; |
| 1071 | dmas = <&dmac1 0x13>, <&dmac1 0x12>, | ||
| 1072 | <&dmac2 0x13>, <&dmac2 0x12>; | ||
| 1073 | dma-names = "tx", "rx", "tx", "rx"; | ||
| 1071 | power-domains = <&sysc R8A77965_PD_ALWAYS_ON>; | 1074 | power-domains = <&sysc R8A77965_PD_ALWAYS_ON>; |
| 1072 | resets = <&cpg 310>; | 1075 | resets = <&cpg 310>; |
| 1073 | status = "disabled"; | 1076 | status = "disabled"; |
| @@ -506,11 +506,15 @@ CONFIG_SND_SOC_ROCKCHIP=m · 505 unmodified lines | |||
| 506 | CONFIG_SND_SOC_ROCKCHIP_SPDIF=m | 506 | CONFIG_SND_SOC_ROCKCHIP_SPDIF=m |
| 507 | CONFIG_SND_SOC_ROCKCHIP_RT5645=m | 507 | CONFIG_SND_SOC_ROCKCHIP_RT5645=m |
| 508 | CONFIG_SND_SOC_RK3399_GRU_SOUND=m | 508 | CONFIG_SND_SOC_RK3399_GRU_SOUND=m |
| 509 | CONFIG_SND_MESON_AXG_SOUND_CARD=m | ||
| 509 | CONFIG_SND_SOC_SAMSUNG=y | 510 | CONFIG_SND_SOC_SAMSUNG=y |
| 510 | CONFIG_SND_SOC_RCAR=m | 511 | CONFIG_SND_SOC_RCAR=m |
| 511 | CONFIG_SND_SOC_AK4613=m | 512 | CONFIG_SND_SOC_AK4613=m |
| 512 | CONFIG_SND_SIMPLE_CARD=m | 513 | CONFIG_SND_SIMPLE_CARD=m |
| 513 | CONFIG_SND_AUDIO_GRAPH_CARD=m | 514 | CONFIG_SND_AUDIO_GRAPH_CARD=m |
| 515 | CONFIG_SND_SOC_ES7134=m | ||
| 516 | CONFIG_SND_SOC_ES7241=m | ||
| 517 | CONFIG_SND_SOC_TAS571X=m | ||
| 514 | CONFIG_I2C_HID=m | 518 | CONFIG_I2C_HID=m |
| 515 | CONFIG_USB=y | 519 | CONFIG_USB=y |
| 516 | CONFIG_USB_OTG=y | 520 | CONFIG_USB_OTG=y |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | #ifndef __ASM_PROTOTYPES_H | 2 | #ifndef __ASM_PROTOTYPES_H |
| 3 | #define __ASM_PROTOTYPES_H | 3 | #define __ASM_PROTOTYPES_H |
| 4 | /* | 4 | /* |
| 5 | * CONFIG_MODEVERIONS requires a C declaration to generate the appropriate CRC | 5 | * CONFIG_MODVERSIONS requires a C declaration to generate the appropriate CRC |
| 6 | * for each symbol. Since commit: | 6 | * for each symbol. Since commit: |
| 7 | * | 7 | * |
| 8 | * 4efca4ed05cbdfd1 ("kbuild: modversions for EXPORT_SYMBOL() for asm") | 8 | * 4efca4ed05cbdfd1 ("kbuild: modversions for EXPORT_SYMBOL() for asm") |
| @@ -58,6 +58,10 @@ · 57 unmodified lines | |||
| 58 | */ | 58 | */ |
| 59 | #define ARCH_DMA_MINALIGN (128) | 59 | #define ARCH_DMA_MINALIGN (128) |
| 60 | 60 | ||
| 61 | #ifdef CONFIG_KASAN_SW_TAGS | ||
| 62 | #define ARCH_SLAB_MINALIGN (1ULL << KASAN_SHADOW_SCALE_SHIFT) | ||
| 63 | #endif | ||
| 64 | |||
| 61 | #ifndef __ASSEMBLY__ | 65 | #ifndef __ASSEMBLY__ |
| 62 | 66 | ||
| 63 | #include <linux/bitops.h> | 67 | #include <linux/bitops.h> |
| @@ -20,9 +20,6 @@ struct dev_archdata { · 19 unmodified lines | |||
| 20 | #ifdef CONFIG_IOMMU_API | 20 | #ifdef CONFIG_IOMMU_API |
| 21 | void *iommu; /* private IOMMU data */ | 21 | void *iommu; /* private IOMMU data */ |
| 22 | #endif | 22 | #endif |
| 23 | #ifdef CONFIG_XEN | ||
| 24 | const struct dma_map_ops *dev_dma_ops; | ||
| 25 | #endif | ||
| 26 | }; | 23 | }; |
| 27 | 24 | ||
| 28 | struct pdev_archdata { | 25 | struct pdev_archdata { |
| @@ -16,6 +16,8 @@ · 15 unmodified lines | |||
| 16 | #ifndef __ASM_MMU_H | 16 | #ifndef __ASM_MMU_H |
| 17 | #define __ASM_MMU_H | 17 | #define __ASM_MMU_H |
| 18 | 18 | ||
| 19 | #include <asm/cputype.h> | ||
| 20 | |||
| 19 | #define MMCF_AARCH32 0x1 /* mm context flag for AArch32 executables */ | 21 | #define MMCF_AARCH32 0x1 /* mm context flag for AArch32 executables */ |
| 20 | #define USER_ASID_BIT 48 | 22 | #define USER_ASID_BIT 48 |
| 21 | #define USER_ASID_FLAG (UL(1) << USER_ASID_BIT) | 23 | #define USER_ASID_FLAG (UL(1) << USER_ASID_BIT) |
| @@ -44,6 +46,48 @@ static inline bool arm64_kernel_unmapped_at_el0(void) · 22 unmodified lines | |||
| 44 | cpus_have_const_cap(ARM64_UNMAP_KERNEL_AT_EL0); | 46 | cpus_have_const_cap(ARM64_UNMAP_KERNEL_AT_EL0); |
| 45 | } | 47 | } |
| 46 | 48 | ||
| 49 | static inline bool arm64_kernel_use_ng_mappings(void) | ||
| 50 | { | ||
| 51 | bool tx1_bug; | ||
| 52 | |||
| 53 | /* What's a kpti? Use global mappings if we don't know. */ | ||
| 54 | if (!IS_ENABLED(CONFIG_UNMAP_KERNEL_AT_EL0)) | ||
| 55 | return false; | ||
| 56 | |||
| 57 | /* | ||
| 58 | * Note: this function is called before the CPU capabilities have | ||
| 59 | * been configured, so our early mappings will be global. If we | ||
| 60 | * later determine that kpti is required, then | ||
| 61 | * kpti_install_ng_mappings() will make them non-global. | ||
| 62 | */ | ||
| 63 | if (arm64_kernel_unmapped_at_el0()) | ||
| 64 | return true; | ||
| 65 | |||
| 66 | if (!IS_ENABLED(CONFIG_RANDOMIZE_BASE)) | ||
| 67 | return false; | ||
| 68 | |||
| 69 | /* | ||
| 70 | * KASLR is enabled so we're going to be enabling kpti on non-broken | ||
| 71 | * CPUs regardless of their susceptibility to Meltdown. Rather | ||
| 72 | * than force everybody to go through the G -> nG dance later on, | ||
| 73 | * just put down non-global mappings from the beginning. | ||
| 74 | */ | ||
| 75 | if (!IS_ENABLED(CONFIG_CAVIUM_ERRATUM_27456)) { | ||
| 76 | tx1_bug = false; | ||
| 77 | #ifndef MODULE | ||
| 78 | } else if (!static_branch_likely(&arm64_const_caps_ready)) { | ||
| 79 | extern const struct midr_range cavium_erratum_27456_cpus[]; | ||
| 80 | |||
| 81 | tx1_bug = is_midr_in_range_list(read_cpuid_id(), | ||
| 82 | cavium_erratum_27456_cpus); | ||
| 83 | #endif | ||
| 84 | } else { | ||
| 85 | tx1_bug = __cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_27456); | ||
| 86 | } | ||
| 87 | |||
| 88 | return !tx1_bug && kaslr_offset() > 0; | ||
| 89 | } | ||
| 90 | |||
| 47 | typedef void (*bp_hardening_cb_t)(void); | 91 | typedef void (*bp_hardening_cb_t)(void); |
| 48 | 92 | ||
| 49 | struct bp_hardening_data { | 93 | struct bp_hardening_data { |
| @@ -37,8 +37,8 @@ · 36 unmodified lines | |||
| 37 | #define _PROT_DEFAULT (PTE_TYPE_PAGE | PTE_AF | PTE_SHARED) | 37 | #define _PROT_DEFAULT (PTE_TYPE_PAGE | PTE_AF | PTE_SHARED) |
| 38 | #define _PROT_SECT_DEFAULT (PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S) | 38 | #define _PROT_SECT_DEFAULT (PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S) |
| 39 | 39 | ||
| 40 | #define PTE_MAYBE_NG (arm64_kernel_unmapped_at_el0() ? PTE_NG : 0) | 40 | #define PTE_MAYBE_NG (arm64_kernel_use_ng_mappings() ? PTE_NG : 0) |
| 41 | #define PMD_MAYBE_NG (arm64_kernel_unmapped_at_el0() ? PMD_SECT_NG : 0) | 41 | #define PMD_MAYBE_NG (arm64_kernel_use_ng_mappings() ? PMD_SECT_NG : 0) |
| 42 | 42 | ||
| 43 | #define PROT_DEFAULT (_PROT_DEFAULT | PTE_MAYBE_NG) | 43 | #define PROT_DEFAULT (_PROT_DEFAULT | PTE_MAYBE_NG) |
| 44 | #define PROT_SECT_DEFAULT (_PROT_SECT_DEFAULT | PMD_MAYBE_NG) | 44 | #define PROT_SECT_DEFAULT (_PROT_SECT_DEFAULT | PMD_MAYBE_NG) |
| @@ -1 +1,77 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _ASM_ARM64_XEN_PAGE_COHERENT_H | ||
| 3 | #define _ASM_ARM64_XEN_PAGE_COHERENT_H | ||
| 4 | |||
| 5 | #include <linux/dma-mapping.h> | ||
| 6 | #include <asm/page.h> | ||
| 1 | #include <xen/arm/page-coherent.h> | 7 | #include <xen/arm/page-coherent.h> |
| 8 | |||
| 9 | static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size, | ||
| 10 | dma_addr_t *dma_handle, gfp_t flags, unsigned long attrs) | ||
| 11 | { | ||
| 12 | return dma_direct_alloc(hwdev, size, dma_handle, flags, attrs); | ||
| 13 | } | ||
| 14 | |||
| 15 | static inline void xen_free_coherent_pages(struct device *hwdev, size_t size, | ||
| 16 | void *cpu_addr, dma_addr_t dma_handle, unsigned long attrs) | ||
| 17 | { | ||
| 18 | dma_direct_free(hwdev, size, cpu_addr, dma_handle, attrs); | ||
| 19 | } | ||
| 20 | |||
| 21 | static inline void xen_dma_sync_single_for_cpu(struct device *hwdev, | ||
| 22 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
| 23 | { | ||
| 24 | unsigned long pfn = PFN_DOWN(handle); | ||
| 25 | |||
| 26 | if (pfn_valid(pfn)) | ||
| 27 | dma_direct_sync_single_for_cpu(hwdev, handle, size, dir); | ||
| 28 | else | ||
| 29 | __xen_dma_sync_single_for_cpu(hwdev, handle, size, dir); | ||
| 30 | } | ||
| 31 | |||
| 32 | static inline void xen_dma_sync_single_for_device(struct device *hwdev, | ||
| 33 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
| 34 | { | ||
| 35 | unsigned long pfn = PFN_DOWN(handle); | ||
| 36 | if (pfn_valid(pfn)) | ||
| 37 | dma_direct_sync_single_for_device(hwdev, handle, size, dir); | ||
| 38 | else | ||
| 39 | __xen_dma_sync_single_for_device(hwdev, handle, size, dir); | ||
| 40 | } | ||
| 41 | |||
| 42 | static inline void xen_dma_map_page(struct device *hwdev, struct page *page, | ||
| 43 | dma_addr_t dev_addr, unsigned long offset, size_t size, | ||
| 44 | enum dma_data_direction dir, unsigned long attrs) | ||
| 45 | { | ||
| 46 | unsigned long page_pfn = page_to_xen_pfn(page); | ||
| 47 | unsigned long dev_pfn = XEN_PFN_DOWN(dev_addr); | ||
| 48 | unsigned long compound_pages = | ||
| 49 | (1<<compound_order(page)) * XEN_PFN_PER_PAGE; | ||
| 50 | bool local = (page_pfn <= dev_pfn) && | ||
| 51 | (dev_pfn - page_pfn < compound_pages); | ||
| 52 | |||
| 53 | if (local) | ||
| 54 | dma_direct_map_page(hwdev, page, offset, size, dir, attrs); | ||
| 55 | else | ||
| 56 | __xen_dma_map_page(hwdev, page, dev_addr, offset, size, dir, attrs); | ||
| 57 | } | ||
| 58 | |||
| 59 | static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, | ||
| 60 | size_t size, enum dma_data_direction dir, unsigned long attrs) | ||
| 61 | { | ||
| 62 | unsigned long pfn = PFN_DOWN(handle); | ||
| 63 | /* | ||
| 64 | * Dom0 is mapped 1:1, while the Linux page can be spanned accross | ||
| 65 | * multiple Xen page, it's not possible to have a mix of local and | ||
| 66 | * foreign Xen page. Dom0 is mapped 1:1, so calling pfn_valid on a | ||
| 67 | * foreign mfn will always return false. If the page is local we can | ||
| 68 | * safely call the native dma_ops function, otherwise we call the xen | ||
| 69 | * specific function. | ||
| 70 | */ | ||
| 71 | if (pfn_valid(pfn)) | ||
| 72 | dma_direct_unmap_page(hwdev, handle, size, dir, attrs); | ||
| 73 | else | ||
| 74 | __xen_dma_unmap_page(hwdev, handle, size, dir, attrs); | ||
| 75 | } | ||
| 76 | |||
| 77 | #endif /* _ASM_ARM64_XEN_PAGE_COHERENT_H */ | ||
| @@ -553,7 +553,7 @@ static const struct midr_range arm64_repeat_tlbi_cpus[] = { · 552 unmodified lines | |||
| 553 | #endif | 553 | #endif |
| 554 | 554 | ||
| 555 | #ifdef CONFIG_CAVIUM_ERRATUM_27456 | 555 | #ifdef CONFIG_CAVIUM_ERRATUM_27456 |
| 556 | static const struct midr_range cavium_erratum_27456_cpus[] = { | 556 | const struct midr_range cavium_erratum_27456_cpus[] = { |
| 557 | /* Cavium ThunderX, T88 pass 1.x - 2.1 */ | 557 | /* Cavium ThunderX, T88 pass 1.x - 2.1 */ |
| 558 | MIDR_RANGE(MIDR_THUNDERX, 0, 0, 1, 1), | 558 | MIDR_RANGE(MIDR_THUNDERX, 0, 0, 1, 1), |
| 559 | /* Cavium ThunderX, T81 pass 1.0 */ | 559 | /* Cavium ThunderX, T81 pass 1.0 */ |
| @@ -983,7 +983,7 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry, · 982 unmodified lines | |||
| 983 | 983 | ||
| 984 | /* Useful for KASLR robustness */ | 984 | /* Useful for KASLR robustness */ |
| 985 | if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) | 985 | if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) |
| 986 | return true; | 986 | return kaslr_offset() > 0; |
| 987 | 987 | ||
| 988 | /* Don't force KPTI for CPUs that are not vulnerable */ | 988 | /* Don't force KPTI for CPUs that are not vulnerable */ |
| 989 | if (is_midr_in_range_list(read_cpuid_id(), kpti_safe_list)) | 989 | if (is_midr_in_range_list(read_cpuid_id(), kpti_safe_list)) |
| @@ -1003,7 +1003,12 @@ kpti_install_ng_mappings(const struct arm64_cpu_capabilities *__unused) · 13 unmodified lines | |||
| 1003 | static bool kpti_applied = false; | 1003 | static bool kpti_applied = false; |
| 1004 | int cpu = smp_processor_id(); | 1004 | int cpu = smp_processor_id(); |
| 1005 | 1005 | ||
| 1006 | if (kpti_applied) | 1006 | /* |
| 1007 | * We don't need to rewrite the page-tables if either we've done | ||
| 1008 | * it already or we have KASLR enabled and therefore have not | ||
| 1009 | * created any global mappings at all. | ||
| 1010 | */ | ||
| 1011 | if (kpti_applied || kaslr_offset() > 0) | ||
| 1007 | return; | 1012 | return; |
| 1008 | 1013 | ||
| 1009 | remap_fn = (void *)__pa_symbol(idmap_kpti_install_ng_mappings); | 1014 | remap_fn = (void *)__pa_symbol(idmap_kpti_install_ng_mappings); |
| @@ -475,6 +475,7 @@ ENDPROC(__primary_switched) · 474 unmodified lines | |||
| 475 | 475 | ||
| 476 | ENTRY(kimage_vaddr) | 476 | ENTRY(kimage_vaddr) |
| 477 | .quad _text - TEXT_OFFSET | 477 | .quad _text - TEXT_OFFSET |
| 478 | EXPORT_SYMBOL(kimage_vaddr) | ||
| 478 | 479 | ||
| 479 | /* | 480 | /* |
| 480 | * If we're fortunate enough to boot at EL2, ensure that the world is | 481 | * If we're fortunate enough to boot at EL2, ensure that the world is |
| @@ -299,8 +299,10 @@ int swsusp_arch_suspend(void) · 298 unmodified lines | |||
| 299 | dcache_clean_range(__idmap_text_start, __idmap_text_end); | 299 | dcache_clean_range(__idmap_text_start, __idmap_text_end); |
| 300 | 300 | ||
| 301 | /* Clean kvm setup code to PoC? */ | 301 | /* Clean kvm setup code to PoC? */ |
| 302 | if (el2_reset_needed()) | 302 | if (el2_reset_needed()) { |
| 303 | dcache_clean_range(__hyp_idmap_text_start, __hyp_idmap_text_end); | 303 | dcache_clean_range(__hyp_idmap_text_start, __hyp_idmap_text_end); |
| 304 | dcache_clean_range(__hyp_text_start, __hyp_text_end); | ||
| 305 | } | ||
| 304 | 306 | ||
| 305 | /* make the crash dump kernel image protected again */ | 307 | /* make the crash dump kernel image protected again */ |
| 306 | crash_post_resume(); | 308 | crash_post_resume(); |
| @@ -28,6 +28,8 @@ · 27 unmodified lines | |||
| 28 | #include <asm/virt.h> | 28 | #include <asm/virt.h> |
| 29 | 29 | ||
| 30 | .text | 30 | .text |
| 31 | .pushsection .hyp.text, "ax" | ||
| 32 | |||
| 31 | .align 11 | 33 | .align 11 |
| 32 | 34 | ||
| 33 | ENTRY(__hyp_stub_vectors) | 35 | ENTRY(__hyp_stub_vectors) |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | |||
| 14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
| 15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
| 16 | 16 | ||
| 17 | #include <asm/cacheflush.h> | ||
| 17 | #include <asm/fixmap.h> | 18 | #include <asm/fixmap.h> |
| 18 | #include <asm/kernel-pgtable.h> | 19 | #include <asm/kernel-pgtable.h> |
| 19 | #include <asm/memory.h> | 20 | #include <asm/memory.h> |
| @@ -43,7 +44,7 @@ static __init u64 get_kaslr_seed(void *fdt) · 23 unmodified lines | |||
| 43 | return ret; | 44 | return ret; |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 46 | static __init const u8 *get_cmdline(void *fdt) | 47 | static __init const u8 *kaslr_get_cmdline(void *fdt) |
| 47 | { | 48 | { |
| 48 | static __initconst const u8 default_cmdline[] = CONFIG_CMDLINE; | 49 | static __initconst const u8 default_cmdline[] = CONFIG_CMDLINE; |
| 49 | 50 | ||
| @@ -87,6 +88,7 @@ u64 __init kaslr_early_init(u64 dt_phys) · 37 unmodified lines | |||
| 87 | * we end up running with module randomization disabled. | 88 | * we end up running with module randomization disabled. |
| 88 | */ | 89 | */ |
| 89 | module_alloc_base = (u64)_etext - MODULES_VSIZE; | 90 | module_alloc_base = (u64)_etext - MODULES_VSIZE; |
| 91 | __flush_dcache_area(&module_alloc_base, sizeof(module_alloc_base)); | ||
| 90 | 92 | ||
| 91 | /* | 93 | /* |
| 92 | * Try to map the FDT early. If this fails, we simply bail, | 94 | * Try to map the FDT early. If this fails, we simply bail, |
| @@ -109,7 +111,7 @@ u64 __init kaslr_early_init(u64 dt_phys) · 16 unmodified lines | |||
| 109 | * Check if 'nokaslr' appears on the command line, and | 111 | * Check if 'nokaslr' appears on the command line, and |
| 110 | * return 0 if that is the case. | 112 | * return 0 if that is the case. |
| 111 | */ | 113 | */ |
| 112 | cmdline = get_cmdline(fdt); | 114 | cmdline = kaslr_get_cmdline(fdt); |
| 113 | str = strstr(cmdline, "nokaslr"); | 115 | str = strstr(cmdline, "nokaslr"); |
| 114 | if (str == cmdline || (str > cmdline && *(str - 1) == ' ')) | 116 | if (str == cmdline || (str > cmdline && *(str - 1) == ' ')) |
| 115 | return 0; | 117 | return 0; |
| @@ -169,5 +171,8 @@ u64 __init kaslr_early_init(u64 dt_phys) · 53 unmodified lines | |||
| 169 | module_alloc_base += (module_range * (seed & ((1 << 21) - 1))) >> 21; | 171 | module_alloc_base += (module_range * (seed & ((1 << 21) - 1))) >> 21; |
| 170 | module_alloc_base &= PAGE_MASK; | 172 | module_alloc_base &= PAGE_MASK; |
| 171 | 173 | ||
| 174 | __flush_dcache_area(&module_alloc_base, sizeof(module_alloc_base)); | ||
| 175 | __flush_dcache_area(&memstart_offset_seed, sizeof(memstart_offset_seed)); | ||
| 176 | |||
| 172 | return offset; | 177 | return offset; |
| 173 | } | 178 | } |
| @@ -87,7 +87,9 @@ static int setup_dtb(struct kimage *image, · 86 unmodified lines | |||
| 87 | 87 | ||
| 88 | /* add kaslr-seed */ | 88 | /* add kaslr-seed */ |
| 89 | ret = fdt_delprop(dtb, off, FDT_PROP_KASLR_SEED); | 89 | ret = fdt_delprop(dtb, off, FDT_PROP_KASLR_SEED); |
| 90 | if (ret && (ret != -FDT_ERR_NOTFOUND)) | 90 | if (ret == -FDT_ERR_NOTFOUND) |
| 91 | ret = 0; | ||
| 92 | else if (ret) | ||
| 91 | goto out; | 93 | goto out; |
| 92 | 94 | ||
| 93 | if (rng_is_initialized()) { | 95 | if (rng_is_initialized()) { |
| @@ -118,10 +120,12 @@ static int create_dtb(struct kimage *image, · 24 unmodified lines | |||
| 118 | { | 120 | { |
| 119 | void *buf; | 121 | void *buf; |
| 120 | size_t buf_size; | 122 | size_t buf_size; |
| 123 | size_t cmdline_len; | ||
| 121 | int ret; | 124 | int ret; |
| 122 | 125 | ||
| 126 | cmdline_len = cmdline ? strlen(cmdline) : 0; | ||
| 123 | buf_size = fdt_totalsize(initial_boot_params) | 127 | buf_size = fdt_totalsize(initial_boot_params) |
| 124 | + strlen(cmdline) + DTB_EXTRA_SPACE; | 128 | + cmdline_len + DTB_EXTRA_SPACE; |
| 125 | 129 | ||
| 126 | for (;;) { | 130 | for (;;) { |
| 127 | buf = vmalloc(buf_size); | 131 | buf = vmalloc(buf_size); |
| @@ -478,13 +478,13 @@ bool arch_within_kprobe_blacklist(unsigned long addr) · 477 unmodified lines | |||
| 478 | addr < (unsigned long)__entry_text_end) || | 478 | addr < (unsigned long)__entry_text_end) || |
| 479 | (addr >= (unsigned long)__idmap_text_start && | 479 | (addr >= (unsigned long)__idmap_text_start && |
| 480 | addr < (unsigned long)__idmap_text_end) || | 480 | addr < (unsigned long)__idmap_text_end) || |
| 481 | (addr >= (unsigned long)__hyp_text_start && | ||
| 482 | addr < (unsigned long)__hyp_text_end) || | ||
| 481 | !!search_exception_tables(addr)) | 483 | !!search_exception_tables(addr)) |
| 482 | return true; | 484 | return true; |
| 483 | 485 | ||
| 484 | if (!is_kernel_in_hyp_mode()) { | 486 | if (!is_kernel_in_hyp_mode()) { |
| 485 | if ((addr >= (unsigned long)__hyp_text_start && | 487 | if ((addr >= (unsigned long)__hyp_idmap_text_start && |
| 486 | addr < (unsigned long)__hyp_text_end) || | ||
| 487 | (addr >= (unsigned long)__hyp_idmap_text_start && | ||
| 488 | addr < (unsigned long)__hyp_idmap_text_end)) | 488 | addr < (unsigned long)__hyp_idmap_text_end)) |
| 489 | return true; | 489 | return true; |
| 490 | } | 490 | } |
| @@ -466,9 +466,7 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, · 465 unmodified lines | |||
| 466 | __iommu_setup_dma_ops(dev, dma_base, size, iommu); | 466 | __iommu_setup_dma_ops(dev, dma_base, size, iommu); |
| 467 | 467 | ||
| 468 | #ifdef CONFIG_XEN | 468 | #ifdef CONFIG_XEN |
| 469 | if (xen_initial_domain()) { | 469 | if (xen_initial_domain()) |
| 470 | dev->archdata.dev_dma_ops = dev->dma_ops; | ||
| 471 | dev->dma_ops = xen_dma_ops; | 470 | dev->dma_ops = xen_dma_ops; |
| 472 | } | ||
| 473 | #endif | 471 | #endif |
| 474 | } | 472 | } |
| @@ -286,74 +286,73 @@ static void note_page(struct pg_state *st, unsigned long addr, unsigned level, · 285 unmodified lines | |||
| 286 | 286 | ||
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | static void walk_pte(struct pg_state *st, pmd_t *pmdp, unsigned long start) | 289 | static void walk_pte(struct pg_state *st, pmd_t *pmdp, unsigned long start, |
| 290 | unsigned long end) | ||
| 290 | { | 291 | { |
| 291 | pte_t *ptep = pte_offset_kernel(pmdp, 0UL); | 292 | unsigned long addr = start; |
| 292 | unsigned long addr; | 293 | pte_t *ptep = pte_offset_kernel(pmdp, start); |
| 293 | unsigned i; | ||
| 294 | 294 | ||
| 295 | for (i = 0; i < PTRS_PER_PTE; i++, ptep++) { | 295 | do { |
| 296 | addr = start + i * PAGE_SIZE; | ||
| 297 | note_page(st, addr, 4, READ_ONCE(pte_val(*ptep))); | 296 | note_page(st, addr, 4, READ_ONCE(pte_val(*ptep))); |
| 298 | } | 297 | } while (ptep++, addr += PAGE_SIZE, addr != end); |
| 299 | } | 298 | } |
| 300 | 299 | ||
| 301 | static void walk_pmd(struct pg_state *st, pud_t *pudp, unsigned long start) | 300 | static void walk_pmd(struct pg_state *st, pud_t *pudp, unsigned long start, |
| 301 | unsigned long end) | ||
| 302 | { | 302 | { |
| 303 | pmd_t *pmdp = pmd_offset(pudp, 0UL); | 303 | unsigned long next, addr = start; |
| 304 | unsigned long addr; | 304 | pmd_t *pmdp = pmd_offset(pudp, start); |
| 305 | unsigned i; | ||
| 306 | 305 | ||
| 307 | for (i = 0; i < PTRS_PER_PMD; i++, pmdp++) { | 306 | do { |
| 308 | pmd_t pmd = READ_ONCE(*pmdp); | 307 | pmd_t pmd = READ_ONCE(*pmdp); |
| 308 | next = pmd_addr_end(addr, end); | ||
| 309 | 309 | ||
| 310 | addr = start + i * PMD_SIZE; | ||
| 311 | if (pmd_none(pmd) || pmd_sect(pmd)) { | 310 | if (pmd_none(pmd) || pmd_sect(pmd)) { |
| 312 | note_page(st, addr, 3, pmd_val(pmd)); | 311 | note_page(st, addr, 3, pmd_val(pmd)); |
| 313 | } else { | 312 | } else { |
| 314 | BUG_ON(pmd_bad(pmd)); | 313 | BUG_ON(pmd_bad(pmd)); |
| 315 | walk_pte(st, pmdp, addr); | 314 | walk_pte(st, pmdp, addr, next); |
| 316 | } | 315 | } |
| 317 | } | 316 | } while (pmdp++, addr = next, addr != end); |
| 318 | } | 317 | } |
| 319 | 318 | ||
| 320 | static void walk_pud(struct pg_state *st, pgd_t *pgdp, unsigned long start) | 319 | static void walk_pud(struct pg_state *st, pgd_t *pgdp, unsigned long start, |
| 320 | unsigned long end) | ||
| 321 | { | 321 | { |
| 322 | pud_t *pudp = pud_offset(pgdp, 0UL); | 322 | unsigned long next, addr = start; |
| 323 | unsigned long addr; | 323 | pud_t *pudp = pud_offset(pgdp, start); |
| 324 | unsigned i; | ||
| 325 | 324 | ||
| 326 | for (i = 0; i < PTRS_PER_PUD; i++, pudp++) { | 325 | do { |
| 327 | pud_t pud = READ_ONCE(*pudp); | 326 | pud_t pud = READ_ONCE(*pudp); |
| 327 | next = pud_addr_end(addr, end); | ||
| 328 | 328 | ||
| 329 | addr = start + i * PUD_SIZE; | ||
| 330 | if (pud_none(pud) || pud_sect(pud)) { | 329 | if (pud_none(pud) || pud_sect(pud)) { |
| 331 | note_page(st, addr, 2, pud_val(pud)); | 330 | note_page(st, addr, 2, pud_val(pud)); |
| 332 | } else { | 331 | } else { |
| 333 | BUG_ON(pud_bad(pud)); | 332 | BUG_ON(pud_bad(pud)); |
| 334 | walk_pmd(st, pudp, addr); | 333 | walk_pmd(st, pudp, addr, next); |
| 335 | } | 334 | } |
| 336 | } | 335 | } while (pudp++, addr = next, addr != end); |
| 337 | } | 336 | } |
| 338 | 337 | ||
| 339 | static void walk_pgd(struct pg_state *st, struct mm_struct *mm, | 338 | static void walk_pgd(struct pg_state *st, struct mm_struct *mm, |
| 340 | unsigned long start) | 339 | unsigned long start) |
| 341 | { | 340 | { |
| 342 | pgd_t *pgdp = pgd_offset(mm, 0UL); | 341 | unsigned long end = (start < TASK_SIZE_64) ? TASK_SIZE_64 : 0; |
| 343 | unsigned i; | 342 | unsigned long next, addr = start; |
| 344 | unsigned long addr; | 343 | pgd_t *pgdp = pgd_offset(mm, start); |
| 345 | 344 | ||
| 346 | for (i = 0; i < PTRS_PER_PGD; i++, pgdp++) { | 345 | do { |
| 347 | pgd_t pgd = READ_ONCE(*pgdp); | 346 | pgd_t pgd = READ_ONCE(*pgdp); |
| 347 | next = pgd_addr_end(addr, end); | ||
| 348 | 348 | ||
| 349 | addr = start + i * PGDIR_SIZE; | ||
| 350 | if (pgd_none(pgd)) { | 349 | if (pgd_none(pgd)) { |
| 351 | note_page(st, addr, 1, pgd_val(pgd)); | 350 | note_page(st, addr, 1, pgd_val(pgd)); |
| 352 | } else { | 351 | } else { |
| 353 | BUG_ON(pgd_bad(pgd)); | 352 | BUG_ON(pgd_bad(pgd)); |
| 354 | walk_pud(st, pgdp, addr); | 353 | walk_pud(st, pgdp, addr, next); |
| 355 | } | 354 | } |
| 356 | } | 355 | } while (pgdp++, addr = next, addr != end); |
| 357 | } | 356 | } |
| 358 | 357 | ||
| 359 | void ptdump_walk_pgd(struct seq_file *m, struct ptdump_info *info) | 358 | void ptdump_walk_pgd(struct seq_file *m, struct ptdump_info *info) |
| @@ -33,7 +33,11 @@ void sync_icache_aliases(void *kaddr, unsigned long len) · 32 unmodified lines | |||
| 33 | __clean_dcache_area_pou(kaddr, len); | 33 | __clean_dcache_area_pou(kaddr, len); |
| 34 | __flush_icache_all(); | 34 | __flush_icache_all(); |
| 35 | } else { | 35 | } else { |
| 36 | flush_icache_range(addr, addr + len); | 36 | /* |
| 37 | * Don't issue kick_all_cpus_sync() after I-cache invalidation | ||
| 38 | * for user mappings. | ||
| 39 | */ | ||
| 40 | __flush_icache_range(addr, addr + len); | ||
| 37 | } | 41 | } |
| 38 | } | 42 | } |
| 39 | 43 | ||
| @@ -30,6 +30,7 @@ generic-y += pgalloc.h · 29 unmodified lines | |||
| 30 | generic-y += preempt.h | 30 | generic-y += preempt.h |
| 31 | generic-y += segment.h | 31 | generic-y += segment.h |
| 32 | generic-y += serial.h | 32 | generic-y += serial.h |
| 33 | generic-y += shmparam.h | ||
| 33 | generic-y += tlbflush.h | 34 | generic-y += tlbflush.h |
| 34 | generic-y += topology.h | 35 | generic-y += topology.h |
| 35 | generic-y += trace_clock.h | 36 | generic-y += trace_clock.h |
| @@ -15,6 +15,31 @@ extern void iounmap(void *addr); · 14 unmodified lines | |||
| 15 | extern int remap_area_pages(unsigned long address, phys_addr_t phys_addr, | 15 | extern int remap_area_pages(unsigned long address, phys_addr_t phys_addr, |
| 16 | size_t size, unsigned long flags); | 16 | size_t size, unsigned long flags); |
| 17 | 17 | ||
| 18 | /* | ||
| 19 | * I/O memory access primitives. Reads are ordered relative to any | ||
| 20 | * following Normal memory access. Writes are ordered relative to any prior | ||
| 21 | * Normal memory access. | ||
| 22 | * | ||
| 23 | * For CACHEV1 (807, 810), store instruction could fast retire, so we need | ||
| 24 | * another mb() to prevent st fast retire. | ||
| 25 | * | ||
| 26 | * For CACHEV2 (860), store instruction with PAGE_ATTR_NO_BUFFERABLE won't | ||
| 27 | * fast retire. | ||
| 28 | */ | ||
| 29 | #define readb(c) ({ u8 __v = readb_relaxed(c); rmb(); __v; }) | ||
| 30 | #define readw(c) ({ u16 __v = readw_relaxed(c); rmb(); __v; }) | ||
| 31 | #define readl(c) ({ u32 __v = readl_relaxed(c); rmb(); __v; }) | ||
| 32 | |||
| 33 | #ifdef CONFIG_CPU_HAS_CACHEV2 | ||
| 34 | #define writeb(v,c) ({ wmb(); writeb_relaxed((v),(c)); }) | ||
| 35 | #define writew(v,c) ({ wmb(); writew_relaxed((v),(c)); }) | ||
| 36 | #define writel(v,c) ({ wmb(); writel_relaxed((v),(c)); }) | ||
| 37 | #else | ||
| 38 | #define writeb(v,c) ({ wmb(); writeb_relaxed((v),(c)); mb(); }) | ||
| 39 | #define writew(v,c) ({ wmb(); writew_relaxed((v),(c)); mb(); }) | ||
| 40 | #define writel(v,c) ({ wmb(); writel_relaxed((v),(c)); mb(); }) | ||
| 41 | #endif | ||
| 42 | |||
| 18 | #define ioremap_nocache(phy, sz) ioremap(phy, sz) | 43 | #define ioremap_nocache(phy, sz) ioremap(phy, sz) |
| 19 | #define ioremap_wc ioremap_nocache | 44 | #define ioremap_wc ioremap_nocache |
| 20 | #define ioremap_wt ioremap_nocache | 45 | #define ioremap_wt ioremap_nocache |
| @@ -24,41 +24,34 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | extern void pgd_init(unsigned long *p); | 25 | extern void pgd_init(unsigned long *p); |
| 26 | 26 | ||
| 27 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | 27 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) |
| 28 | unsigned long address) | ||
| 29 | { | 28 | { |
| 30 | pte_t *pte; | 29 | pte_t *pte; |
| 31 | unsigned long *kaddr, i; | 30 | unsigned long i; |
| 32 | 31 | ||
| 33 | pte = (pte_t *) __get_free_pages(GFP_KERNEL | __GFP_RETRY_MAYFAIL, | 32 | pte = (pte_t *) __get_free_page(GFP_KERNEL); |
| 34 | PTE_ORDER); | 33 | if (!pte) |
| 35 | kaddr = (unsigned long *)pte; | 34 | return NULL; |
| 36 | if (address & 0x80000000) | 35 | |
| 37 | for (i = 0; i < (PAGE_SIZE/4); i++) | 36 | for (i = 0; i < PAGE_SIZE/sizeof(pte_t); i++) |
| 38 | *(kaddr + i) = 0x1; | 37 | (pte + i)->pte_low = _PAGE_GLOBAL; |
| 39 | else | ||
| 40 | clear_page(kaddr); | ||
| 41 | 38 | ||
| 42 | return pte; | 39 | return pte; |
| 43 | } | 40 | } |
| 44 | 41 | ||
| 45 | static inline struct page *pte_alloc_one(struct mm_struct *mm, | 42 | static inline struct page *pte_alloc_one(struct mm_struct *mm) |
| 46 | unsigned long address) | ||
| 47 | { | 43 | { |
| 48 | struct page *pte; | 44 | struct page *pte; |
| 49 | unsigned long *kaddr, i; | 45 | |
| 50 | 46 | pte = alloc_pages(GFP_KERNEL | __GFP_ZERO, 0); | |
| 51 | pte = alloc_pages(GFP_KERNEL | __GFP_RETRY_MAYFAIL, PTE_ORDER); | 47 | if (!pte) |
| 52 | if (pte) { | 48 | return NULL; |
| 53 | kaddr = kmap_atomic(pte); | 49 | |
| 54 | if (address & 0x80000000) { | 50 | if (!pgtable_page_ctor(pte)) { |
| 55 | for (i = 0; i < (PAGE_SIZE/4); i++) | 51 | __free_page(pte); |
| 56 | *(kaddr + i) = 0x1; | 52 | return NULL; |
| 57 | } else | ||
| 58 | clear_page(kaddr); | ||
| 59 | kunmap_atomic(kaddr); | ||
| 60 | pgtable_page_ctor(pte); | ||
| 61 | } | 53 | } |
| 54 | |||
| 62 | return pte; | 55 | return pte; |
| 63 | } | 56 | } |
| 64 | 57 | ||
| @@ -12,7 +12,7 @@ · 11 unmodified lines | |||
| 12 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
| 13 | #include <asm/pgtable.h> | 13 | #include <asm/pgtable.h> |
| 14 | 14 | ||
| 15 | #if defined(__CSKYABIV2__) | 15 | #ifdef CONFIG_CPU_CK810 |
| 16 | #define IS_BSR32(hi16, lo16) (((hi16) & 0xFC00) == 0xE000) | 16 | #define IS_BSR32(hi16, lo16) (((hi16) & 0xFC00) == 0xE000) |
| 17 | #define IS_JSRI32(hi16, lo16) ((hi16) == 0xEAE0) | 17 | #define IS_JSRI32(hi16, lo16) ((hi16) == 0xEAE0) |
| 18 | 18 | ||
| @@ -25,6 +25,26 @@ · 6 unmodified lines | |||
| 25 | *(uint16_t *)(addr) = 0xE8Fa; \ | 25 | *(uint16_t *)(addr) = 0xE8Fa; \ |
| 26 | *((uint16_t *)(addr) + 1) = 0x0000; \ | 26 | *((uint16_t *)(addr) + 1) = 0x0000; \ |
| 27 | } while (0) | 27 | } while (0) |
| 28 | |||
| 29 | static void jsri_2_lrw_jsr(uint32_t *location) | ||
| 30 | { | ||
| 31 | uint16_t *location_tmp = (uint16_t *)location; | ||
| 32 | |||
| 33 | if (IS_BSR32(*location_tmp, *(location_tmp + 1))) | ||
| 34 | return; | ||
| 35 | |||
| 36 | if (IS_JSRI32(*location_tmp, *(location_tmp + 1))) { | ||
| 37 | /* jsri 0x... --> lrw r26, 0x... */ | ||
| 38 | CHANGE_JSRI_TO_LRW(location); | ||
| 39 | /* lsli r0, r0 --> jsr r26 */ | ||
| 40 | SET_JSR32_R26(location + 1); | ||
| 41 | } | ||
| 42 | } | ||
| 43 | #else | ||
| 44 | static void inline jsri_2_lrw_jsr(uint32_t *location) | ||
| 45 | { | ||
| 46 | return; | ||
| 47 | } | ||
| 28 | #endif | 48 | #endif |
| 29 | 49 | ||
| 30 | int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, | 50 | int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, |
| @@ -35,9 +55,6 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, · 4 unmodified lines | |||
| 35 | Elf32_Sym *sym; | 55 | Elf32_Sym *sym; |
| 36 | uint32_t *location; | 56 | uint32_t *location; |
| 37 | short *temp; | 57 | short *temp; |
| 38 | #if defined(__CSKYABIV2__) | ||
| 39 | uint16_t *location_tmp; | ||
| 40 | #endif | ||
| 41 | 58 | ||
| 42 | for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { | 59 | for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { |
| 43 | /* This is where to make the change */ | 60 | /* This is where to make the change */ |
| @@ -59,18 +76,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, · 15 unmodified lines | |||
| 59 | case R_CSKY_PCRELJSR_IMM11BY2: | 76 | case R_CSKY_PCRELJSR_IMM11BY2: |
| 60 | break; | 77 | break; |
| 61 | case R_CSKY_PCRELJSR_IMM26BY2: | 78 | case R_CSKY_PCRELJSR_IMM26BY2: |
| 62 | #if defined(__CSKYABIV2__) | 79 | jsri_2_lrw_jsr(location); |
| 63 | location_tmp = (uint16_t *)location; | ||
| 64 | if (IS_BSR32(*location_tmp, *(location_tmp + 1))) | ||
| 65 | break; | ||
| 66 | |||
| 67 | if (IS_JSRI32(*location_tmp, *(location_tmp + 1))) { | ||
| 68 | /* jsri 0x... --> lrw r26, 0x... */ | ||
| 69 | CHANGE_JSRI_TO_LRW(location); | ||
| 70 | /* lsli r0, r0 --> jsr r26 */ | ||
| 71 | SET_JSR32_R26(location + 1); | ||
| 72 | } | ||
| 73 | #endif | ||
| 74 | break; | 80 | break; |
| 75 | case R_CSKY_ADDR_HI16: | 81 | case R_CSKY_ADDR_HI16: |
| 76 | temp = ((short *)location) + 1; | 82 | temp = ((short *)location) + 1; |
| @@ -37,8 +37,6 @@ libs-y += arch/$(ARCH)/lib/ · 36 unmodified lines | |||
| 37 | 37 | ||
| 38 | boot := arch/h8300/boot | 38 | boot := arch/h8300/boot |
| 39 | 39 | ||
| 40 | archmrproper: | ||
| 41 | |||
| 42 | archclean: | 40 | archclean: |
| 43 | $(Q)$(MAKE) $(clean)=$(boot) | 41 | $(Q)$(MAKE) $(clean)=$(boot) |
| 44 | 42 | ||
| @@ -40,6 +40,7 @@ generic-y += preempt.h · 39 unmodified lines | |||
| 40 | generic-y += scatterlist.h | 40 | generic-y += scatterlist.h |
| 41 | generic-y += sections.h | 41 | generic-y += sections.h |
| 42 | generic-y += serial.h | 42 | generic-y += serial.h |
| 43 | generic-y += shmparam.h | ||
| 43 | generic-y += sizes.h | 44 | generic-y += sizes.h |
| 44 | generic-y += spinlock.h | 45 | generic-y += spinlock.h |
| 45 | generic-y += timex.h | 46 | generic-y += timex.h |
| @@ -30,6 +30,7 @@ generic-y += rwsem.h · 29 unmodified lines | |||
| 30 | generic-y += sections.h | 30 | generic-y += sections.h |
| 31 | generic-y += segment.h | 31 | generic-y += segment.h |
| 32 | generic-y += serial.h | 32 | generic-y += serial.h |
| 33 | generic-y += shmparam.h | ||
| 33 | generic-y += sizes.h | 34 | generic-y += sizes.h |
| 34 | generic-y += topology.h | 35 | generic-y += topology.h |
| 35 | generic-y += trace_clock.h | 36 | generic-y += trace_clock.h |
| @@ -16,8 +16,6 @@ KBUILD_DEFCONFIG := generic_defconfig · 15 unmodified lines | |||
| 16 | NM := $(CROSS_COMPILE)nm -B | 16 | NM := $(CROSS_COMPILE)nm -B |
| 17 | READELF := $(CROSS_COMPILE)readelf | 17 | READELF := $(CROSS_COMPILE)readelf |
| 18 | 18 | ||
| 19 | export AWK | ||
| 20 | |||
| 21 | CHECKFLAGS += -D__ia64=1 -D__ia64__=1 -D_LP64 -D__LP64__ | 19 | CHECKFLAGS += -D__ia64=1 -D__ia64__=1 -D_LP64 -D__LP64__ |
| 22 | 20 | ||
| 23 | OBJCOPYFLAGS := --strip-all | 21 | OBJCOPYFLAGS := --strip-all |
| @@ -155,18 +155,22 @@ out: · 154 unmodified lines | |||
| 155 | static int __init nfhd_init(void) | 155 | static int __init nfhd_init(void) |
| 156 | { | 156 | { |
| 157 | u32 blocks, bsize; | 157 | u32 blocks, bsize; |
| 158 | int ret; | ||
| 158 | int i; | 159 | int i; |
| 159 | 160 | ||
| 160 | nfhd_id = nf_get_id("XHDI"); | 161 | nfhd_id = nf_get_id("XHDI"); |
| 161 | if (!nfhd_id) | 162 | if (!nfhd_id) |
| 162 | return -ENODEV; | 163 | return -ENODEV; |
| 163 | 164 | ||
| 164 | major_num = register_blkdev(major_num, "nfhd"); | 165 | ret = register_blkdev(major_num, "nfhd"); |
| 165 | if (major_num <= 0) { | 166 | if (ret < 0) { |
| 166 | pr_warn("nfhd: unable to get major number\n"); | 167 | pr_warn("nfhd: unable to get major number\n"); |
| 167 | return major_num; | 168 | return ret; |
| 168 | } | 169 | } |
| 169 | 170 | ||
| 171 | if (!major_num) | ||
| 172 | major_num = ret; | ||
| 173 | |||
| 170 | for (i = NFHD_DEV_OFFSET; i < 24; i++) { | 174 | for (i = NFHD_DEV_OFFSET; i < 24; i++) { |
| 171 | if (nfhd_get_capacity(i, 0, &blocks, &bsize)) | 175 | if (nfhd_get_capacity(i, 0, &blocks, &bsize)) |
| 172 | continue; | 176 | continue; |
| @@ -20,6 +20,7 @@ generic-y += mm-arch-hooks.h · 19 unmodified lines | |||
| 20 | generic-y += percpu.h | 20 | generic-y += percpu.h |
| 21 | generic-y += preempt.h | 21 | generic-y += preempt.h |
| 22 | generic-y += sections.h | 22 | generic-y += sections.h |
| 23 | generic-y += shmparam.h | ||
| 23 | generic-y += spinlock.h | 24 | generic-y += spinlock.h |
| 24 | generic-y += topology.h | 25 | generic-y += topology.h |
| 25 | generic-y += trace_clock.h | 26 | generic-y += trace_clock.h |
| @@ -26,6 +26,7 @@ generic-y += parport.h · 25 unmodified lines | |||
| 26 | generic-y += percpu.h | 26 | generic-y += percpu.h |
| 27 | generic-y += preempt.h | 27 | generic-y += preempt.h |
| 28 | generic-y += serial.h | 28 | generic-y += serial.h |
| 29 | generic-y += shmparam.h | ||
| 29 | generic-y += syscalls.h | 30 | generic-y += syscalls.h |
| 30 | generic-y += topology.h | 31 | generic-y += topology.h |
| 31 | generic-y += trace_clock.h | 32 | generic-y += trace_clock.h |
| @@ -1403,6 +1403,21 @@ config LOONGSON3_ENHANCEMENT · 1402 unmodified lines | |||
| 1403 | please say 'N' here. If you want a high-performance kernel to run on | 1403 | please say 'N' here. If you want a high-performance kernel to run on |
| 1404 | new Loongson 3 machines only, please say 'Y' here. | 1404 | new Loongson 3 machines only, please say 'Y' here. |
| 1405 | 1405 | ||
| 1406 | config CPU_LOONGSON3_WORKAROUNDS | ||
| 1407 | bool "Old Loongson 3 LLSC Workarounds" | ||
| 1408 | default y if SMP | ||
| 1409 | depends on CPU_LOONGSON3 | ||
| 1410 | help | ||
| 1411 | Loongson 3 processors have the llsc issues which require workarounds. | ||
| 1412 | Without workarounds the system may hang unexpectedly. | ||
| 1413 | |||
| 1414 | Newer Loongson 3 will fix these issues and no workarounds are needed. | ||
| 1415 | The workarounds have no significant side effect on them but may | ||
| 1416 | decrease the performance of the system so this option should be | ||
| 1417 | disabled unless the kernel is intended to be run on old systems. | ||
| 1418 | |||
| 1419 | If unsure, please say Y. | ||
| 1420 | |||
| 1406 | config CPU_LOONGSON2E | 1421 | config CPU_LOONGSON2E |
| 1407 | bool "Loongson 2E" | 1422 | bool "Loongson 2E" |
| 1408 | depends on SYS_HAS_CPU_LOONGSON2E | 1423 | depends on SYS_HAS_CPU_LOONGSON2E |
| @@ -3155,6 +3170,7 @@ config MIPS32_O32 · 1746 unmodified lines | |||
| 3155 | config MIPS32_N32 | 3170 | config MIPS32_N32 |
| 3156 | bool "Kernel support for n32 binaries" | 3171 | bool "Kernel support for n32 binaries" |
| 3157 | depends on 64BIT | 3172 | depends on 64BIT |
| 3173 | select ARCH_WANT_COMPAT_IPC_PARSE_VERSION | ||
| 3158 | select COMPAT | 3174 | select COMPAT |
| 3159 | select MIPS32_COMPAT | 3175 | select MIPS32_COMPAT |
| 3160 | select SYSVIPC_COMPAT if SYSVIPC | 3176 | select SYSVIPC_COMPAT if SYSVIPC |
| @@ -173,6 +173,31 @@ void __init plat_mem_setup(void) · 172 unmodified lines | |||
| 173 | pm_power_off = bcm47xx_machine_halt; | 173 | pm_power_off = bcm47xx_machine_halt; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | #ifdef CONFIG_BCM47XX_BCMA | ||
| 177 | static struct device * __init bcm47xx_setup_device(void) | ||
| 178 | { | ||
| 179 | struct device *dev; | ||
| 180 | int err; | ||
| 181 | |||
| 182 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
| 183 | if (!dev) | ||
| 184 | return NULL; | ||
| 185 | |||
| 186 | err = dev_set_name(dev, "bcm47xx_soc"); | ||
| 187 | if (err) { | ||
| 188 | pr_err("Failed to set SoC device name: %d\n", err); | ||
| 189 | kfree(dev); | ||
| 190 | return NULL; | ||
| 191 | } | ||
| 192 | |||
| 193 | err = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32)); | ||
| 194 | if (err) | ||
| 195 | pr_err("Failed to set SoC DMA mask: %d\n", err); | ||
| 196 | |||
| 197 | return dev; | ||
| 198 | } | ||
| 199 | #endif | ||
| 200 | |||
| 176 | /* | 201 | /* |
| 177 | * This finishes bus initialization doing things that were not possible without | 202 | * This finishes bus initialization doing things that were not possible without |
| 178 | * kmalloc. Make sure to call it late enough (after mm_init). | 203 | * kmalloc. Make sure to call it late enough (after mm_init). |
| @@ -183,6 +208,10 @@ void __init bcm47xx_bus_setup(void) · 4 unmodified lines | |||
| 183 | if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) { | 208 | if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) { |
| 184 | int err; | 209 | int err; |
| 185 | 210 | ||
| 211 | bcm47xx_bus.bcma.dev = bcm47xx_setup_device(); | ||
| 212 | if (!bcm47xx_bus.bcma.dev) | ||
| 213 | panic("Failed to setup SoC device\n"); | ||
| 214 | |||
| 186 | err = bcma_host_soc_init(&bcm47xx_bus.bcma); | 215 | err = bcma_host_soc_init(&bcm47xx_bus.bcma); |
| 187 | if (err) | 216 | if (err) |
| 188 | panic("Failed to initialize BCMA bus (err %d)", err); | 217 | panic("Failed to initialize BCMA bus (err %d)", err); |
| @@ -235,6 +264,8 @@ static int __init bcm47xx_register_bus_complete(void) · 46 unmodified lines | |||
| 235 | #endif | 264 | #endif |
| 236 | #ifdef CONFIG_BCM47XX_BCMA | 265 | #ifdef CONFIG_BCM47XX_BCMA |
| 237 | case BCM47XX_BUS_TYPE_BCMA: | 266 | case BCM47XX_BUS_TYPE_BCMA: |
| 267 | if (device_register(bcm47xx_bus.bcma.dev)) | ||
| 268 | pr_err("Failed to register SoC device\n"); | ||
| 238 | bcma_bus_register(&bcm47xx_bus.bcma.bus); | 269 | bcma_bus_register(&bcm47xx_bus.bcma.bus); |
| 239 | break; | 270 | break; |
| 240 | #endif | 271 | #endif |
| @@ -76,7 +76,7 @@ · 75 unmodified lines | |||
| 76 | status = "okay"; | 76 | status = "okay"; |
| 77 | 77 | ||
| 78 | pinctrl-names = "default"; | 78 | pinctrl-names = "default"; |
| 79 | pinctrl-0 = <&pins_uart2>; | 79 | pinctrl-0 = <&pins_uart3>; |
| 80 | }; | 80 | }; |
| 81 | 81 | ||
| 82 | &uart4 { | 82 | &uart4 { |
| @@ -196,9 +196,9 @@ · 113 unmodified lines | |||
| 196 | bias-disable; | 196 | bias-disable; |
| 197 | }; | 197 | }; |
| 198 | 198 | ||
| 199 | pins_uart2: uart2 { | 199 | pins_uart3: uart3 { |
| 200 | function = "uart2"; | 200 | function = "uart3"; |
| 201 | groups = "uart2-data", "uart2-hwflow"; | 201 | groups = "uart3-data", "uart3-hwflow"; |
| 202 | bias-disable; | 202 | bias-disable; |
| 203 | }; | 203 | }; |
| 204 | 204 | ||
| @@ -161,7 +161,7 @@ · 160 unmodified lines | |||
| 161 | #dma-cells = <2>; | 161 | #dma-cells = <2>; |
| 162 | 162 | ||
| 163 | interrupt-parent = <&intc>; | 163 | interrupt-parent = <&intc>; |
| 164 | interrupts = <29>; | 164 | interrupts = <20>; |
| 165 | 165 | ||
| 166 | clocks = <&cgu JZ4740_CLK_DMA>; | 166 | clocks = <&cgu JZ4740_CLK_DMA>; |
| 167 | 167 | ||
| @@ -90,11 +90,11 @@ · 89 unmodified lines | |||
| 90 | interrupts = <0>; | 90 | interrupts = <0>; |
| 91 | }; | 91 | }; |
| 92 | 92 | ||
| 93 | axi_i2c: i2c@10A00000 { | 93 | axi_i2c: i2c@10a00000 { |
| 94 | compatible = "xlnx,xps-iic-2.00.a"; | 94 | compatible = "xlnx,xps-iic-2.00.a"; |
| 95 | interrupt-parent = <&axi_intc>; | 95 | interrupt-parent = <&axi_intc>; |
| 96 | interrupts = <4>; | 96 | interrupts = <4>; |
| 97 | reg = < 0x10A00000 0x10000 >; | 97 | reg = < 0x10a00000 0x10000 >; |
| 98 | clocks = <&ext>; | 98 | clocks = <&ext>; |
| 99 | xlnx,clk-freq = <0x5f5e100>; | 99 | xlnx,clk-freq = <0x5f5e100>; |
| 100 | xlnx,family = "Artix7"; | 100 | xlnx,family = "Artix7"; |
| @@ -106,9 +106,9 @@ · 5 unmodified lines | |||
| 106 | #address-cells = <1>; | 106 | #address-cells = <1>; |
| 107 | #size-cells = <0>; | 107 | #size-cells = <0>; |
| 108 | 108 | ||
| 109 | ad7420@4B { | 109 | ad7420@4b { |
| 110 | compatible = "adi,adt7420"; | 110 | compatible = "adi,adt7420"; |
| 111 | reg = <0x4B>; | 111 | reg = <0x4b>; |
| 112 | }; | 112 | }; |
| 113 | } ; | 113 | } ; |
| 114 | }; | 114 | }; |
| @@ -98,7 +98,7 @@ static void octeon_kexec_smp_down(void *ignored) · 97 unmodified lines | |||
| 98 | " sync \n" | 98 | " sync \n" |
| 99 | " synci ($0) \n"); | 99 | " synci ($0) \n"); |
| 100 | 100 | ||
| 101 | relocated_kexec_smp_wait(NULL); | 101 | kexec_reboot(); |
| 102 | } | 102 | } |
| 103 | #endif | 103 | #endif |
| 104 | 104 | ||
| @@ -66,6 +66,7 @@ CONFIG_SERIAL_8250_CONSOLE=y · 65 unmodified lines | |||
| 66 | # CONFIG_SERIAL_8250_PCI is not set | 66 | # CONFIG_SERIAL_8250_PCI is not set |
| 67 | CONFIG_SERIAL_8250_NR_UARTS=1 | 67 | CONFIG_SERIAL_8250_NR_UARTS=1 |
| 68 | CONFIG_SERIAL_8250_RUNTIME_UARTS=1 | 68 | CONFIG_SERIAL_8250_RUNTIME_UARTS=1 |
| 69 | CONFIG_SERIAL_OF_PLATFORM=y | ||
| 69 | CONFIG_SERIAL_AR933X=y | 70 | CONFIG_SERIAL_AR933X=y |
| 70 | CONFIG_SERIAL_AR933X_CONSOLE=y | 71 | CONFIG_SERIAL_AR933X_CONSOLE=y |
| 71 | # CONFIG_HW_RANDOM is not set | 72 | # CONFIG_HW_RANDOM is not set |
| @@ -58,6 +58,7 @@ static __inline__ void atomic_##op(int i, atomic_t * v) \ · 57 unmodified lines | |||
| 58 | if (kernel_uses_llsc) { \ | 58 | if (kernel_uses_llsc) { \ |
| 59 | int temp; \ | 59 | int temp; \ |
| 60 | \ | 60 | \ |
| 61 | loongson_llsc_mb(); \ | ||
| 61 | __asm__ __volatile__( \ | 62 | __asm__ __volatile__( \ |
| 62 | " .set push \n" \ | 63 | " .set push \n" \ |
| 63 | " .set "MIPS_ISA_LEVEL" \n" \ | 64 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -85,6 +86,7 @@ static __inline__ int atomic_##op##_return_relaxed(int i, atomic_t * v) \ · 21 unmodified lines | |||
| 85 | if (kernel_uses_llsc) { \ | 86 | if (kernel_uses_llsc) { \ |
| 86 | int temp; \ | 87 | int temp; \ |
| 87 | \ | 88 | \ |
| 89 | loongson_llsc_mb(); \ | ||
| 88 | __asm__ __volatile__( \ | 90 | __asm__ __volatile__( \ |
| 89 | " .set push \n" \ | 91 | " .set push \n" \ |
| 90 | " .set "MIPS_ISA_LEVEL" \n" \ | 92 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -118,6 +120,7 @@ static __inline__ int atomic_fetch_##op##_relaxed(int i, atomic_t * v) \ · 27 unmodified lines | |||
| 118 | if (kernel_uses_llsc) { \ | 120 | if (kernel_uses_llsc) { \ |
| 119 | int temp; \ | 121 | int temp; \ |
| 120 | \ | 122 | \ |
| 123 | loongson_llsc_mb(); \ | ||
| 121 | __asm__ __volatile__( \ | 124 | __asm__ __volatile__( \ |
| 122 | " .set push \n" \ | 125 | " .set push \n" \ |
| 123 | " .set "MIPS_ISA_LEVEL" \n" \ | 126 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -256,6 +259,7 @@ static __inline__ void atomic64_##op(long i, atomic64_t * v) \ · 132 unmodified lines | |||
| 256 | if (kernel_uses_llsc) { \ | 259 | if (kernel_uses_llsc) { \ |
| 257 | long temp; \ | 260 | long temp; \ |
| 258 | \ | 261 | \ |
| 262 | loongson_llsc_mb(); \ | ||
| 259 | __asm__ __volatile__( \ | 263 | __asm__ __volatile__( \ |
| 260 | " .set push \n" \ | 264 | " .set push \n" \ |
| 261 | " .set "MIPS_ISA_LEVEL" \n" \ | 265 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -283,6 +287,7 @@ static __inline__ long atomic64_##op##_return_relaxed(long i, atomic64_t * v) \ · 21 unmodified lines | |||
| 283 | if (kernel_uses_llsc) { \ | 287 | if (kernel_uses_llsc) { \ |
| 284 | long temp; \ | 288 | long temp; \ |
| 285 | \ | 289 | \ |
| 290 | loongson_llsc_mb(); \ | ||
| 286 | __asm__ __volatile__( \ | 291 | __asm__ __volatile__( \ |
| 287 | " .set push \n" \ | 292 | " .set push \n" \ |
| 288 | " .set "MIPS_ISA_LEVEL" \n" \ | 293 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -316,6 +321,7 @@ static __inline__ long atomic64_fetch_##op##_relaxed(long i, atomic64_t * v) \ · 27 unmodified lines | |||
| 316 | if (kernel_uses_llsc) { \ | 321 | if (kernel_uses_llsc) { \ |
| 317 | long temp; \ | 322 | long temp; \ |
| 318 | \ | 323 | \ |
| 324 | loongson_llsc_mb(); \ | ||
| 319 | __asm__ __volatile__( \ | 325 | __asm__ __volatile__( \ |
| 320 | " .set push \n" \ | 326 | " .set push \n" \ |
| 321 | " .set "MIPS_ISA_LEVEL" \n" \ | 327 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -222,6 +222,42 @@ · 221 unmodified lines | |||
| 222 | #define __smp_mb__before_atomic() __smp_mb__before_llsc() | 222 | #define __smp_mb__before_atomic() __smp_mb__before_llsc() |
| 223 | #define __smp_mb__after_atomic() smp_llsc_mb() | 223 | #define __smp_mb__after_atomic() smp_llsc_mb() |
| 224 | 224 | ||
| 225 | /* | ||
| 226 | * Some Loongson 3 CPUs have a bug wherein execution of a memory access (load, | ||
| 227 | * store or pref) in between an ll & sc can cause the sc instruction to | ||
| 228 | * erroneously succeed, breaking atomicity. Whilst it's unusual to write code | ||
| 229 | * containing such sequences, this bug bites harder than we might otherwise | ||
| 230 | * expect due to reordering & speculation: | ||
| 231 | * | ||
| 232 | * 1) A memory access appearing prior to the ll in program order may actually | ||
| 233 | * be executed after the ll - this is the reordering case. | ||
| 234 | * | ||
| 235 | * In order to avoid this we need to place a memory barrier (ie. a sync | ||
| 236 | * instruction) prior to every ll instruction, in between it & any earlier | ||
| 237 | * memory access instructions. Many of these cases are already covered by | ||
| 238 | * smp_mb__before_llsc() but for the remaining cases, typically ones in | ||
| 239 | * which multiple CPUs may operate on a memory location but ordering is not | ||
| 240 | * usually guaranteed, we use loongson_llsc_mb() below. | ||
| 241 | * | ||
| 242 | * This reordering case is fixed by 3A R2 CPUs, ie. 3A2000 models and later. | ||
| 243 | * | ||
| 244 | * 2) If a conditional branch exists between an ll & sc with a target outside | ||
| 245 | * of the ll-sc loop, for example an exit upon value mismatch in cmpxchg() | ||
| 246 | * or similar, then misprediction of the branch may allow speculative | ||
| 247 | * execution of memory accesses from outside of the ll-sc loop. | ||
| 248 | * | ||
| 249 | * In order to avoid this we need a memory barrier (ie. a sync instruction) | ||
| 250 | * at each affected branch target, for which we also use loongson_llsc_mb() | ||
| 251 | * defined below. | ||
| 252 | * | ||
| 253 | * This case affects all current Loongson 3 CPUs. | ||
| 254 | */ | ||
| 255 | #ifdef CONFIG_CPU_LOONGSON3_WORKAROUNDS /* Loongson-3's LLSC workaround */ | ||
| 256 | #define loongson_llsc_mb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory") | ||
| 257 | #else | ||
| 258 | #define loongson_llsc_mb() do { } while (0) | ||
| 259 | #endif | ||
| 260 | |||
| 225 | #include <asm-generic/barrier.h> | 261 | #include <asm-generic/barrier.h> |
| 226 | 262 | ||
| 227 | #endif /* __ASM_BARRIER_H */ | 263 | #endif /* __ASM_BARRIER_H */ |
| @@ -69,6 +69,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr) · 68 unmodified lines | |||
| 69 | : "ir" (1UL << bit), GCC_OFF_SMALL_ASM() (*m)); | 69 | : "ir" (1UL << bit), GCC_OFF_SMALL_ASM() (*m)); |
| 70 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) | 70 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) |
| 71 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { | 71 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { |
| 72 | loongson_llsc_mb(); | ||
| 72 | do { | 73 | do { |
| 73 | __asm__ __volatile__( | 74 | __asm__ __volatile__( |
| 74 | " " __LL "%0, %1 # set_bit \n" | 75 | " " __LL "%0, %1 # set_bit \n" |
| @@ -79,6 +80,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr) · 4 unmodified lines | |||
| 79 | } while (unlikely(!temp)); | 80 | } while (unlikely(!temp)); |
| 80 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ | 81 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ |
| 81 | } else if (kernel_uses_llsc) { | 82 | } else if (kernel_uses_llsc) { |
| 83 | loongson_llsc_mb(); | ||
| 82 | do { | 84 | do { |
| 83 | __asm__ __volatile__( | 85 | __asm__ __volatile__( |
| 84 | " .set push \n" | 86 | " .set push \n" |
| @@ -123,6 +125,7 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) · 38 unmodified lines | |||
| 123 | : "ir" (~(1UL << bit))); | 125 | : "ir" (~(1UL << bit))); |
| 124 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) | 126 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) |
| 125 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { | 127 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { |
| 128 | loongson_llsc_mb(); | ||
| 126 | do { | 129 | do { |
| 127 | __asm__ __volatile__( | 130 | __asm__ __volatile__( |
| 128 | " " __LL "%0, %1 # clear_bit \n" | 131 | " " __LL "%0, %1 # clear_bit \n" |
| @@ -133,6 +136,7 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) · 4 unmodified lines | |||
| 133 | } while (unlikely(!temp)); | 136 | } while (unlikely(!temp)); |
| 134 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ | 137 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ |
| 135 | } else if (kernel_uses_llsc) { | 138 | } else if (kernel_uses_llsc) { |
| 139 | loongson_llsc_mb(); | ||
| 136 | do { | 140 | do { |
| 137 | __asm__ __volatile__( | 141 | __asm__ __volatile__( |
| 138 | " .set push \n" | 142 | " .set push \n" |
| @@ -193,6 +197,7 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr) · 54 unmodified lines | |||
| 193 | unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); | 197 | unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); |
| 194 | unsigned long temp; | 198 | unsigned long temp; |
| 195 | 199 | ||
| 200 | loongson_llsc_mb(); | ||
| 196 | do { | 201 | do { |
| 197 | __asm__ __volatile__( | 202 | __asm__ __volatile__( |
| 198 | " .set push \n" | 203 | " .set push \n" |
| @@ -50,6 +50,7 @@ · 49 unmodified lines | |||
| 50 | "i" (-EFAULT) \ | 50 | "i" (-EFAULT) \ |
| 51 | : "memory"); \ | 51 | : "memory"); \ |
| 52 | } else if (cpu_has_llsc) { \ | 52 | } else if (cpu_has_llsc) { \ |
| 53 | loongson_llsc_mb(); \ | ||
| 53 | __asm__ __volatile__( \ | 54 | __asm__ __volatile__( \ |
| 54 | " .set push \n" \ | 55 | " .set push \n" \ |
| 55 | " .set noat \n" \ | 56 | " .set noat \n" \ |
| @@ -163,6 +164,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, · 107 unmodified lines | |||
| 163 | "i" (-EFAULT) | 164 | "i" (-EFAULT) |
| 164 | : "memory"); | 165 | : "memory"); |
| 165 | } else if (cpu_has_llsc) { | 166 | } else if (cpu_has_llsc) { |
| 167 | loongson_llsc_mb(); | ||
| 166 | __asm__ __volatile__( | 168 | __asm__ __volatile__( |
| 167 | "# futex_atomic_cmpxchg_inatomic \n" | 169 | "# futex_atomic_cmpxchg_inatomic \n" |
| 168 | " .set push \n" | 170 | " .set push \n" |
| @@ -192,6 +194,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, · 23 unmodified lines | |||
| 192 | : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval), | 194 | : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval), |
| 193 | "i" (-EFAULT) | 195 | "i" (-EFAULT) |
| 194 | : "memory"); | 196 | : "memory"); |
| 197 | loongson_llsc_mb(); | ||
| 195 | } else | 198 | } else |
| 196 | return -ENOSYS; | 199 | return -ENOSYS; |
| 197 | 200 | ||
| @@ -18,8 +18,6 @@ · 17 unmodified lines | |||
| 18 | #define INT_NUM_EXTRA_START (INT_NUM_IM4_IRL0 + 32) | 18 | #define INT_NUM_EXTRA_START (INT_NUM_IM4_IRL0 + 32) |
| 19 | #define INT_NUM_IM_OFFSET (INT_NUM_IM1_IRL0 - INT_NUM_IM0_IRL0) | 19 | #define INT_NUM_IM_OFFSET (INT_NUM_IM1_IRL0 - INT_NUM_IM0_IRL0) |
| 20 | 20 | ||
| 21 | #define MIPS_CPU_TIMER_IRQ 7 | ||
| 22 | |||
| 23 | #define MAX_IM 5 | 21 | #define MAX_IM 5 |
| 24 | 22 | ||
| 25 | #endif /* _FALCON_IRQ__ */ | 23 | #endif /* _FALCON_IRQ__ */ |
| @@ -19,8 +19,6 @@ · 18 unmodified lines | |||
| 19 | 19 | ||
| 20 | #define LTQ_DMA_CH0_INT (INT_NUM_IM2_IRL0) | 20 | #define LTQ_DMA_CH0_INT (INT_NUM_IM2_IRL0) |
| 21 | 21 | ||
| 22 | #define MIPS_CPU_TIMER_IRQ 7 | ||
| 23 | |||
| 24 | #define MAX_IM 5 | 22 | #define MAX_IM 5 |
| 25 | 23 | ||
| 26 | #endif | 24 | #endif |
| @@ -228,6 +228,7 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) · 227 unmodified lines | |||
| 228 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) | 228 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) |
| 229 | : [global] "r" (page_global)); | 229 | : [global] "r" (page_global)); |
| 230 | } else if (kernel_uses_llsc) { | 230 | } else if (kernel_uses_llsc) { |
| 231 | loongson_llsc_mb(); | ||
| 231 | __asm__ __volatile__ ( | 232 | __asm__ __volatile__ ( |
| 232 | " .set push \n" | 233 | " .set push \n" |
| 233 | " .set "MIPS_ISA_ARCH_LEVEL" \n" | 234 | " .set "MIPS_ISA_ARCH_LEVEL" \n" |
| @@ -242,6 +243,7 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) · 8 unmodified lines | |||
| 242 | " .set pop \n" | 243 | " .set pop \n" |
| 243 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) | 244 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) |
| 244 | : [global] "r" (page_global)); | 245 | : [global] "r" (page_global)); |
| 246 | loongson_llsc_mb(); | ||
| 245 | } | 247 | } |
| 246 | #else /* !CONFIG_SMP */ | 248 | #else /* !CONFIG_SMP */ |
| 247 | if (pte_none(*buddy)) | 249 | if (pte_none(*buddy)) |
| @@ -74,14 +74,15 @@ static int __init vdma_init(void) · 73 unmodified lines | |||
| 74 | get_order(VDMA_PGTBL_SIZE)); | 74 | get_order(VDMA_PGTBL_SIZE)); |
| 75 | BUG_ON(!pgtbl); | 75 | BUG_ON(!pgtbl); |
| 76 | dma_cache_wback_inv((unsigned long)pgtbl, VDMA_PGTBL_SIZE); | 76 | dma_cache_wback_inv((unsigned long)pgtbl, VDMA_PGTBL_SIZE); |
| 77 | pgtbl = (VDMA_PGTBL_ENTRY *)KSEG1ADDR(pgtbl); | 77 | pgtbl = (VDMA_PGTBL_ENTRY *)CKSEG1ADDR((unsigned long)pgtbl); |
| 78 | 78 | ||
| 79 | /* | 79 | /* |
| 80 | * Clear the R4030 translation table | 80 | * Clear the R4030 translation table |
| 81 | */ | 81 | */ |
| 82 | vdma_pgtbl_init(); | 82 | vdma_pgtbl_init(); |
| 83 | 83 | ||
| 84 | r4030_write_reg32(JAZZ_R4030_TRSTBL_BASE, CPHYSADDR(pgtbl)); | 84 | r4030_write_reg32(JAZZ_R4030_TRSTBL_BASE, |
| 85 | CPHYSADDR((unsigned long)pgtbl)); | ||
| 85 | r4030_write_reg32(JAZZ_R4030_TRSTBL_LIM, VDMA_PGTBL_SIZE); | 86 | r4030_write_reg32(JAZZ_R4030_TRSTBL_LIM, VDMA_PGTBL_SIZE); |
| 86 | r4030_write_reg32(JAZZ_R4030_TRSTBL_INV, 0); | 87 | r4030_write_reg32(JAZZ_R4030_TRSTBL_INV, 0); |
| 87 | 88 | ||
| @@ -457,5 +457,5 @@ void mips_cm_error_report(void) · 456 unmodified lines | |||
| 457 | } | 457 | } |
| 458 | 458 | ||
| 459 | /* reprime cause register */ | 459 | /* reprime cause register */ |
| 460 | write_gcr_error_cause(0); | 460 | write_gcr_error_cause(cm_error); |
| 461 | } | 461 | } |
| @@ -371,7 +371,7 @@ static inline int is_sp_move_ins(union mips_instruction *ip, int *frame_size) · 370 unmodified lines | |||
| 371 | static int get_frame_info(struct mips_frame_info *info) | 371 | static int get_frame_info(struct mips_frame_info *info) |
| 372 | { | 372 | { |
| 373 | bool is_mmips = IS_ENABLED(CONFIG_CPU_MICROMIPS); | 373 | bool is_mmips = IS_ENABLED(CONFIG_CPU_MICROMIPS); |
| 374 | union mips_instruction insn, *ip, *ip_end; | 374 | union mips_instruction insn, *ip; |
| 375 | const unsigned int max_insns = 128; | 375 | const unsigned int max_insns = 128; |
| 376 | unsigned int last_insn_size = 0; | 376 | unsigned int last_insn_size = 0; |
| 377 | unsigned int i; | 377 | unsigned int i; |
| @@ -384,10 +384,9 @@ static int get_frame_info(struct mips_frame_info *info) · 6 unmodified lines | |||
| 384 | if (!ip) | 384 | if (!ip) |
| 385 | goto err; | 385 | goto err; |
| 386 | 386 | ||
| 387 | ip_end = (void *)ip + info->func_size; | 387 | for (i = 0; i < max_insns; i++) { |
| 388 | |||
| 389 | for (i = 0; i < max_insns && ip < ip_end; i++) { | ||
| 390 | ip = (void *)ip + last_insn_size; | 388 | ip = (void *)ip + last_insn_size; |
| 389 | |||
| 391 | if (is_mmips && mm_insn_16bit(ip->halfword[0])) { | 390 | if (is_mmips && mm_insn_16bit(ip->halfword[0])) { |
| 392 | insn.word = ip->halfword[0] << 16; | 391 | insn.word = ip->halfword[0] << 16; |
| 393 | last_insn_size = 2; | 392 | last_insn_size = 2; |
| @@ -224,9 +224,11 @@ static struct irq_chip ltq_eiu_type = { · 223 unmodified lines | |||
| 224 | .irq_set_type = ltq_eiu_settype, | 224 | .irq_set_type = ltq_eiu_settype, |
| 225 | }; | 225 | }; |
| 226 | 226 | ||
| 227 | static void ltq_hw_irqdispatch(int module) | 227 | static void ltq_hw_irq_handler(struct irq_desc *desc) |
| 228 | { | 228 | { |
| 229 | int module = irq_desc_get_irq(desc) - 2; | ||
| 229 | u32 irq; | 230 | u32 irq; |
| 231 | int hwirq; | ||
| 230 | 232 | ||
| 231 | irq = ltq_icu_r32(module, LTQ_ICU_IM0_IOSR); | 233 | irq = ltq_icu_r32(module, LTQ_ICU_IM0_IOSR); |
| 232 | if (irq == 0) | 234 | if (irq == 0) |
| @@ -237,7 +239,8 @@ static void ltq_hw_irqdispatch(int module) · 4 unmodified lines | |||
| 237 | * other bits might be bogus | 239 | * other bits might be bogus |
| 238 | */ | 240 | */ |
| 239 | irq = __fls(irq); | 241 | irq = __fls(irq); |
| 240 | do_IRQ((int)irq + MIPS_CPU_IRQ_CASCADE + (INT_NUM_IM_OFFSET * module)); | 242 | hwirq = irq + MIPS_CPU_IRQ_CASCADE + (INT_NUM_IM_OFFSET * module); |
| 243 | generic_handle_irq(irq_linear_revmap(ltq_domain, hwirq)); | ||
| 241 | 244 | ||
| 242 | /* if this is a EBU irq, we need to ack it or get a deadlock */ | 245 | /* if this is a EBU irq, we need to ack it or get a deadlock */ |
| 243 | if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT) | 246 | if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT) |
| @@ -245,49 +248,6 @@ static void ltq_hw_irqdispatch(int module) · 1 unmodified line | |||
| 245 | LTQ_EBU_PCC_ISTAT); | 248 | LTQ_EBU_PCC_ISTAT); |
| 246 | } | 249 | } |
| 247 | 250 | ||
| 248 | #define DEFINE_HWx_IRQDISPATCH(x) \ | ||
| 249 | static void ltq_hw ## x ## _irqdispatch(void) \ | ||
| 250 | { \ | ||
| 251 | ltq_hw_irqdispatch(x); \ | ||
| 252 | } | ||
| 253 | DEFINE_HWx_IRQDISPATCH(0) | ||
| 254 | DEFINE_HWx_IRQDISPATCH(1) | ||
| 255 | DEFINE_HWx_IRQDISPATCH(2) | ||
| 256 | DEFINE_HWx_IRQDISPATCH(3) | ||
| 257 | DEFINE_HWx_IRQDISPATCH(4) | ||
| 258 | |||
| 259 | #if MIPS_CPU_TIMER_IRQ == 7 | ||
| 260 | static void ltq_hw5_irqdispatch(void) | ||
| 261 | { | ||
| 262 | do_IRQ(MIPS_CPU_TIMER_IRQ); | ||
| 263 | } | ||
| 264 | #else | ||
| 265 | DEFINE_HWx_IRQDISPATCH(5) | ||
| 266 | #endif | ||
| 267 | |||
| 268 | static void ltq_hw_irq_handler(struct irq_desc *desc) | ||
| 269 | { | ||
| 270 | ltq_hw_irqdispatch(irq_desc_get_irq(desc) - 2); | ||
| 271 | } | ||
| 272 | |||
| 273 | asmlinkage void plat_irq_dispatch(void) | ||
| 274 | { | ||
| 275 | unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; | ||
| 276 | int irq; | ||
| 277 | |||
| 278 | if (!pending) { | ||
| 279 | spurious_interrupt(); | ||
| 280 | return; | ||
| 281 | } | ||
| 282 | |||
| 283 | pending >>= CAUSEB_IP; | ||
| 284 | while (pending) { | ||
| 285 | irq = fls(pending) - 1; | ||
| 286 | do_IRQ(MIPS_CPU_IRQ_BASE + irq); | ||
| 287 | pending &= ~BIT(irq); | ||
| 288 | } | ||
| 289 | } | ||
| 290 | |||
| 291 | static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) | 251 | static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) |
| 292 | { | 252 | { |
| 293 | struct irq_chip *chip = <q_irq_type; | 253 | struct irq_chip *chip = <q_irq_type; |
| @@ -343,38 +303,13 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent) · 49 unmodified lines | |||
| 343 | for (i = 0; i < MAX_IM; i++) | 303 | for (i = 0; i < MAX_IM; i++) |
| 344 | irq_set_chained_handler(i + 2, ltq_hw_irq_handler); | 304 | irq_set_chained_handler(i + 2, ltq_hw_irq_handler); |
| 345 | 305 | ||
| 346 | if (cpu_has_vint) { | ||
| 347 | pr_info("Setting up vectored interrupts\n"); | ||
| 348 | set_vi_handler(2, ltq_hw0_irqdispatch); | ||
| 349 | set_vi_handler(3, ltq_hw1_irqdispatch); | ||
| 350 | set_vi_handler(4, ltq_hw2_irqdispatch); | ||
| 351 | set_vi_handler(5, ltq_hw3_irqdispatch); | ||
| 352 | set_vi_handler(6, ltq_hw4_irqdispatch); | ||
| 353 | set_vi_handler(7, ltq_hw5_irqdispatch); | ||
| 354 | } | ||
| 355 | |||
| 356 | ltq_domain = irq_domain_add_linear(node, | 306 | ltq_domain = irq_domain_add_linear(node, |
| 357 | (MAX_IM * INT_NUM_IM_OFFSET) + MIPS_CPU_IRQ_CASCADE, | 307 | (MAX_IM * INT_NUM_IM_OFFSET) + MIPS_CPU_IRQ_CASCADE, |
| 358 | &irq_domain_ops, 0); | 308 | &irq_domain_ops, 0); |
| 359 | 309 | ||
| 360 | #ifndef CONFIG_MIPS_MT_SMP | ||
| 361 | set_c0_status(IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | | ||
| 362 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5); | ||
| 363 | #else | ||
| 364 | set_c0_status(IE_SW0 | IE_SW1 | IE_IRQ0 | IE_IRQ1 | | ||
| 365 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5); | ||
| 366 | #endif | ||
| 367 | |||
| 368 | /* tell oprofile which irq to use */ | 310 | /* tell oprofile which irq to use */ |
| 369 | ltq_perfcount_irq = irq_create_mapping(ltq_domain, LTQ_PERF_IRQ); | 311 | ltq_perfcount_irq = irq_create_mapping(ltq_domain, LTQ_PERF_IRQ); |
| 370 | 312 | ||
| 371 | /* | ||
| 372 | * if the timer irq is not one of the mips irqs we need to | ||
| 373 | * create a mapping | ||
| 374 | */ | ||
| 375 | if (MIPS_CPU_TIMER_IRQ != 7) | ||
| 376 | irq_create_mapping(ltq_domain, MIPS_CPU_TIMER_IRQ); | ||
| 377 | |||
| 378 | /* the external interrupts are optional and xway only */ | 313 | /* the external interrupts are optional and xway only */ |
| 379 | eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway"); | 314 | eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway"); |
| 380 | if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) { | 315 | if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) { |
| @@ -411,7 +346,7 @@ EXPORT_SYMBOL_GPL(get_c0_perfcount_int); · 30 unmodified lines | |||
| 411 | 346 | ||
| 412 | unsigned int get_c0_compare_int(void) | 347 | unsigned int get_c0_compare_int(void) |
| 413 | { | 348 | { |
| 414 | return MIPS_CPU_TIMER_IRQ; | 349 | return CP0_LEGACY_COMPARE_IRQ; |
| 415 | } | 350 | } |
| 416 | 351 | ||
| 417 | static struct of_device_id __initdata of_irq_ids[] = { | 352 | static struct of_device_id __initdata of_irq_ids[] = { |
| @@ -129,9 +129,9 @@ ltq_dma_alloc(struct ltq_dma_channel *ch) · 128 unmodified lines | |||
| 129 | unsigned long flags; | 129 | unsigned long flags; |
| 130 | 130 | ||
| 131 | ch->desc = 0; | 131 | ch->desc = 0; |
| 132 | ch->desc_base = dma_zalloc_coherent(ch->dev, | 132 | ch->desc_base = dma_alloc_coherent(ch->dev, |
| 133 | LTQ_DESC_NUM * LTQ_DESC_SIZE, | 133 | LTQ_DESC_NUM * LTQ_DESC_SIZE, |
| 134 | &ch->phys, GFP_ATOMIC); | 134 | &ch->phys, GFP_ATOMIC); |
| 135 | 135 | ||
| 136 | spin_lock_irqsave(<q_dma_lock, flags); | 136 | spin_lock_irqsave(<q_dma_lock, flags); |
| 137 | ltq_dma_w32(ch->nr, LTQ_DMA_CS); | 137 | ltq_dma_w32(ch->nr, LTQ_DMA_CS); |
| @@ -23,6 +23,29 @@ ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS · 22 unmodified lines | |||
| 23 | endif | 23 | endif |
| 24 | 24 | ||
| 25 | cflags-$(CONFIG_CPU_LOONGSON3) += -Wa,--trap | 25 | cflags-$(CONFIG_CPU_LOONGSON3) += -Wa,--trap |
| 26 | |||
| 27 | # | ||
| 28 | # Some versions of binutils, not currently mainline as of 2019/02/04, support | ||
| 29 | # an -mfix-loongson3-llsc flag which emits a sync prior to each ll instruction | ||
| 30 | # to work around a CPU bug (see loongson_llsc_mb() in asm/barrier.h for a | ||
| 31 | # description). | ||
| 32 | # | ||
| 33 | # We disable this in order to prevent the assembler meddling with the | ||
| 34 | # instruction that labels refer to, ie. if we label an ll instruction: | ||
| 35 | # | ||
| 36 | # 1: ll v0, 0(a0) | ||
| 37 | # | ||
| 38 | # ...then with the assembler fix applied the label may actually point at a sync | ||
| 39 | # instruction inserted by the assembler, and if we were using the label in an | ||
| 40 | # exception table the table would no longer contain the address of the ll | ||
| 41 | # instruction. | ||
| 42 | # | ||
| 43 | # Avoid this by explicitly disabling that assembler behaviour. If upstream | ||
| 44 | # binutils does not merge support for the flag then we can revisit & remove | ||
| 45 | # this later - for now it ensures vendor toolchains don't cause problems. | ||
| 46 | # | ||
| 47 | cflags-$(CONFIG_CPU_LOONGSON3) += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,) | ||
| 48 | |||
| 26 | # | 49 | # |
| 27 | # binutils from v2.25 on and gcc starting from v4.9.0 treat -march=loongson3a | 50 | # binutils from v2.25 on and gcc starting from v4.9.0 treat -march=loongson3a |
| 28 | # as MIPS64 R2; older versions as just R1. This leaves the possibility open | 51 | # as MIPS64 R2; older versions as just R1. This leaves the possibility open |
| @@ -59,7 +59,12 @@ static void loongson_poweroff(void) · 58 unmodified lines | |||
| 59 | { | 59 | { |
| 60 | #ifndef CONFIG_LEFI_FIRMWARE_INTERFACE | 60 | #ifndef CONFIG_LEFI_FIRMWARE_INTERFACE |
| 61 | mach_prepare_shutdown(); | 61 | mach_prepare_shutdown(); |
| 62 | unreachable(); | 62 | |
| 63 | /* | ||
| 64 | * It needs a wait loop here, but mips/kernel/reset.c already calls | ||
| 65 | * a generic delay loop, machine_hang(), so simply return. | ||
| 66 | */ | ||
| 67 | return; | ||
| 63 | #else | 68 | #else |
| 64 | void (*fw_poweroff)(void) = (void *)loongson_sysconf.poweroff_addr; | 69 | void (*fw_poweroff)(void) = (void *)loongson_sysconf.poweroff_addr; |
| 65 | 70 | ||
| @@ -932,6 +932,8 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, · 931 unmodified lines | |||
| 932 | * to mimic that here by taking a load/istream page | 932 | * to mimic that here by taking a load/istream page |
| 933 | * fault. | 933 | * fault. |
| 934 | */ | 934 | */ |
| 935 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
| 936 | uasm_i_sync(p, 0); | ||
| 935 | UASM_i_LA(p, ptr, (unsigned long)tlb_do_page_fault_0); | 937 | UASM_i_LA(p, ptr, (unsigned long)tlb_do_page_fault_0); |
| 936 | uasm_i_jr(p, ptr); | 938 | uasm_i_jr(p, ptr); |
| 937 | 939 | ||
| @@ -1646,6 +1648,8 @@ static void · 708 unmodified lines | |||
| 1646 | iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr) | 1648 | iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr) |
| 1647 | { | 1649 | { |
| 1648 | #ifdef CONFIG_SMP | 1650 | #ifdef CONFIG_SMP |
| 1651 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
| 1652 | uasm_i_sync(p, 0); | ||
| 1649 | # ifdef CONFIG_PHYS_ADDR_T_64BIT | 1653 | # ifdef CONFIG_PHYS_ADDR_T_64BIT |
| 1650 | if (cpu_has_64bits) | 1654 | if (cpu_has_64bits) |
| 1651 | uasm_i_lld(p, pte, 0, ptr); | 1655 | uasm_i_lld(p, pte, 0, ptr); |
| @@ -2259,6 +2263,8 @@ static void build_r4000_tlb_load_handler(void) · 607 unmodified lines | |||
| 2259 | #endif | 2263 | #endif |
| 2260 | 2264 | ||
| 2261 | uasm_l_nopage_tlbl(&l, p); | 2265 | uasm_l_nopage_tlbl(&l, p); |
| 2266 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
| 2267 | uasm_i_sync(&p, 0); | ||
| 2262 | build_restore_work_registers(&p); | 2268 | build_restore_work_registers(&p); |
| 2263 | #ifdef CONFIG_CPU_MICROMIPS | 2269 | #ifdef CONFIG_CPU_MICROMIPS |
| 2264 | if ((unsigned long)tlb_do_page_fault_0 & 1) { | 2270 | if ((unsigned long)tlb_do_page_fault_0 & 1) { |
| @@ -2313,6 +2319,8 @@ static void build_r4000_tlb_store_handler(void) · 48 unmodified lines | |||
| 2313 | #endif | 2319 | #endif |
| 2314 | 2320 | ||
| 2315 | uasm_l_nopage_tlbs(&l, p); | 2321 | uasm_l_nopage_tlbs(&l, p); |
| 2322 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
| 2323 | uasm_i_sync(&p, 0); | ||
| 2316 | build_restore_work_registers(&p); | 2324 | build_restore_work_registers(&p); |
| 2317 | #ifdef CONFIG_CPU_MICROMIPS | 2325 | #ifdef CONFIG_CPU_MICROMIPS |
| 2318 | if ((unsigned long)tlb_do_page_fault_1 & 1) { | 2326 | if ((unsigned long)tlb_do_page_fault_1 & 1) { |
| @@ -2368,6 +2376,8 @@ static void build_r4000_tlb_modify_handler(void) · 49 unmodified lines | |||
| 2368 | #endif | 2376 | #endif |
| 2369 | 2377 | ||
| 2370 | uasm_l_nopage_tlbm(&l, p); | 2378 | uasm_l_nopage_tlbm(&l, p); |
| 2379 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
| 2380 | uasm_i_sync(&p, 0); | ||
| 2371 | build_restore_work_registers(&p); | 2381 | build_restore_work_registers(&p); |
| 2372 | #ifdef CONFIG_CPU_MICROMIPS | 2382 | #ifdef CONFIG_CPU_MICROMIPS |
| 2373 | if ((unsigned long)tlb_do_page_fault_1 & 1) { | 2383 | if ((unsigned long)tlb_do_page_fault_1 & 1) { |
| @@ -369,7 +369,9 @@ int __init octeon_msi_initialize(void) · 368 unmodified lines | |||
| 369 | int irq; | 369 | int irq; |
| 370 | struct irq_chip *msi; | 370 | struct irq_chip *msi; |
| 371 | 371 | ||
| 372 | if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_PCIE) { | 372 | if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_INVALID) { |
| 373 | return 0; | ||
| 374 | } else if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_PCIE) { | ||
| 373 | msi_rcv_reg[0] = CVMX_PEXP_NPEI_MSI_RCV0; | 375 | msi_rcv_reg[0] = CVMX_PEXP_NPEI_MSI_RCV0; |
| 374 | msi_rcv_reg[1] = CVMX_PEXP_NPEI_MSI_RCV1; | 376 | msi_rcv_reg[1] = CVMX_PEXP_NPEI_MSI_RCV1; |
| 375 | msi_rcv_reg[2] = CVMX_PEXP_NPEI_MSI_RCV2; | 377 | msi_rcv_reg[2] = CVMX_PEXP_NPEI_MSI_RCV2; |
| @@ -568,6 +568,11 @@ static int __init octeon_pci_setup(void) · 567 unmodified lines | |||
| 568 | if (octeon_has_feature(OCTEON_FEATURE_PCIE)) | 568 | if (octeon_has_feature(OCTEON_FEATURE_PCIE)) |
| 569 | return 0; | 569 | return 0; |
| 570 | 570 | ||
| 571 | if (!octeon_is_pci_host()) { | ||
| 572 | pr_notice("Not in host mode, PCI Controller not initialized\n"); | ||
| 573 | return 0; | ||
| 574 | } | ||
| 575 | |||
| 571 | /* Point pcibios_map_irq() to the PCI version of it */ | 576 | /* Point pcibios_map_irq() to the PCI version of it */ |
| 572 | octeon_pcibios_map_irq = octeon_pci_pcibios_map_irq; | 577 | octeon_pcibios_map_irq = octeon_pci_pcibios_map_irq; |
| 573 | 578 | ||
| @@ -579,11 +584,6 @@ static int __init octeon_pci_setup(void) · 5 unmodified lines | |||
| 579 | else | 584 | else |
| 580 | octeon_dma_bar_type = OCTEON_DMA_BAR_TYPE_BIG; | 585 | octeon_dma_bar_type = OCTEON_DMA_BAR_TYPE_BIG; |
| 581 | 586 | ||
| 582 | if (!octeon_is_pci_host()) { | ||
| 583 | pr_notice("Not in host mode, PCI Controller not initialized\n"); | ||
| 584 | return 0; | ||
| 585 | } | ||
| 586 | |||
| 587 | /* PCI I/O and PCI MEM values */ | 587 | /* PCI I/O and PCI MEM values */ |
| 588 | set_io_port_base(OCTEON_PCI_IOSPACE_BASE); | 588 | set_io_port_base(OCTEON_PCI_IOSPACE_BASE); |
| 589 | ioport_resource.start = 0; | 589 | ioport_resource.start = 0; |
| @@ -8,6 +8,7 @@ ccflags-vdso := \ · 7 unmodified lines | |||
| 8 | $(filter -E%,$(KBUILD_CFLAGS)) \ | 8 | $(filter -E%,$(KBUILD_CFLAGS)) \ |
| 9 | $(filter -mmicromips,$(KBUILD_CFLAGS)) \ | 9 | $(filter -mmicromips,$(KBUILD_CFLAGS)) \ |
| 10 | $(filter -march=%,$(KBUILD_CFLAGS)) \ | 10 | $(filter -march=%,$(KBUILD_CFLAGS)) \ |
| 11 | $(filter -m%-float,$(KBUILD_CFLAGS)) \ | ||
| 11 | -D__VDSO__ | 12 | -D__VDSO__ |
| 12 | 13 | ||
| 13 | ifdef CONFIG_CC_IS_CLANG | 14 | ifdef CONFIG_CC_IS_CLANG |
| @@ -129,7 +130,7 @@ $(obj)/%-o32.o: $(src)/%.c FORCE · 115 unmodified lines | |||
| 129 | $(call cmd,force_checksrc) | 130 | $(call cmd,force_checksrc) |
| 130 | $(call if_changed_rule,cc_o_c) | 131 | $(call if_changed_rule,cc_o_c) |
| 131 | 132 | ||
| 132 | $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := -mabi=32 | 133 | $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=32 |
| 133 | $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE | 134 | $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE |
| 134 | $(call if_changed_dep,cpp_lds_S) | 135 | $(call if_changed_dep,cpp_lds_S) |
| 135 | 136 | ||
| @@ -169,7 +170,7 @@ $(obj)/%-n32.o: $(src)/%.c FORCE · 33 unmodified lines | |||
| 169 | $(call cmd,force_checksrc) | 170 | $(call cmd,force_checksrc) |
| 170 | $(call if_changed_rule,cc_o_c) | 171 | $(call if_changed_rule,cc_o_c) |
| 171 | 172 | ||
| 172 | $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := -mabi=n32 | 173 | $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=n32 |
| 173 | $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE | 174 | $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE |
| 174 | $(call if_changed_dep,cpp_lds_S) | 175 | $(call if_changed_dep,cpp_lds_S) |
| 175 | 176 | ||
| @@ -3,9 +3,6 @@ OBJCOPYFLAGS := -O binary -R .note -R .note.gnu.build-id -R .comment -S · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | KBUILD_DEFCONFIG := defconfig | 4 | KBUILD_DEFCONFIG := defconfig |
| 5 | 5 | ||
| 6 | comma = , | ||
| 7 | |||
| 8 | |||
| 9 | ifdef CONFIG_FUNCTION_TRACER | 6 | ifdef CONFIG_FUNCTION_TRACER |
| 10 | arch-y += -malways-save-lp -mno-relax | 7 | arch-y += -malways-save-lp -mno-relax |
| 11 | endif | 8 | endif |
| @@ -54,8 +51,6 @@ endif · 42 unmodified lines | |||
| 54 | boot := arch/nds32/boot | 51 | boot := arch/nds32/boot |
| 55 | core-y += $(boot)/dts/ | 52 | core-y += $(boot)/dts/ |
| 56 | 53 | ||
| 57 | .PHONY: FORCE | ||
| 58 | |||
| 59 | Image: vmlinux | 54 | Image: vmlinux |
| 60 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ | 55 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
| 61 | 56 | ||
| @@ -68,9 +63,6 @@ prepare: vdso_prepare · 6 unmodified lines | |||
| 68 | vdso_prepare: prepare0 | 63 | vdso_prepare: prepare0 |
| 69 | $(Q)$(MAKE) $(build)=arch/nds32/kernel/vdso include/generated/vdso-offsets.h | 64 | $(Q)$(MAKE) $(build)=arch/nds32/kernel/vdso include/generated/vdso-offsets.h |
| 70 | 65 | ||
| 71 | CLEAN_FILES += include/asm-nds32/constants.h* | ||
| 72 | |||
| 73 | # We use MRPROPER_FILES and CLEAN_FILES now | ||
| 74 | archclean: | 66 | archclean: |
| 75 | $(Q)$(MAKE) $(clean)=$(boot) | 67 | $(Q)$(MAKE) $(clean)=$(boot) |
| 76 | 68 | ||
| @@ -20,7 +20,6 @@ · 19 unmodified lines | |||
| 20 | KBUILD_DEFCONFIG := or1ksim_defconfig | 20 | KBUILD_DEFCONFIG := or1ksim_defconfig |
| 21 | 21 | ||
| 22 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S | 22 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S |
| 23 | LDFLAGS_vmlinux := | ||
| 24 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) | 23 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
| 25 | 24 | ||
| 26 | KBUILD_CFLAGS += -pipe -ffixed-r10 -D__linux__ | 25 | KBUILD_CFLAGS += -pipe -ffixed-r10 -D__linux__ |
| @@ -50,5 +49,3 @@ else · 23 unmodified lines | |||
| 50 | BUILTIN_DTB := n | 49 | BUILTIN_DTB := n |
| 51 | endif | 50 | endif |
| 52 | core-$(BUILTIN_DTB) += arch/openrisc/boot/dts/ | 51 | core-$(BUILTIN_DTB) += arch/openrisc/boot/dts/ |
| 53 | |||
| 54 | all: vmlinux | ||
| @@ -34,6 +34,7 @@ generic-y += qrwlock_types.h · 33 unmodified lines | |||
| 34 | generic-y += qrwlock.h | 34 | generic-y += qrwlock.h |
| 35 | generic-y += sections.h | 35 | generic-y += sections.h |
| 36 | generic-y += segment.h | 36 | generic-y += segment.h |
| 37 | generic-y += shmparam.h | ||
| 37 | generic-y += string.h | 38 | generic-y += string.h |
| 38 | generic-y += switch_to.h | 39 | generic-y += switch_to.h |
| 39 | generic-y += topology.h | 40 | generic-y += topology.h |
| @@ -58,8 +58,12 @@ · 57 unmodified lines | |||
| 58 | /* Ensure that addr is below task's addr_limit */ | 58 | /* Ensure that addr is below task's addr_limit */ |
| 59 | #define __addr_ok(addr) ((unsigned long) addr < get_fs()) | 59 | #define __addr_ok(addr) ((unsigned long) addr < get_fs()) |
| 60 | 60 | ||
| 61 | #define access_ok(addr, size) \ | 61 | #define access_ok(addr, size) \ |
| 62 | __range_ok((unsigned long)addr, (unsigned long)size) | 62 | ({ \ |
| 63 | unsigned long __ao_addr = (unsigned long)(addr); \ | ||
| 64 | unsigned long __ao_size = (unsigned long)(size); \ | ||
| 65 | __range_ok(__ao_addr, __ao_size); \ | ||
| 66 | }) | ||
| 63 | 67 | ||
| 64 | /* | 68 | /* |
| 65 | * These are the main single-value transfer routines. They automatically | 69 | * These are the main single-value transfer routines. They automatically |
| @@ -1258,21 +1258,13 @@ extern pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, · 1257 unmodified lines | |||
| 1258 | 1258 | ||
| 1259 | #define pmd_move_must_withdraw pmd_move_must_withdraw | 1259 | #define pmd_move_must_withdraw pmd_move_must_withdraw |
| 1260 | struct spinlock; | 1260 | struct spinlock; |
| 1261 | static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, | 1261 | extern int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, |
| 1262 | struct spinlock *old_pmd_ptl, | 1262 | struct spinlock *old_pmd_ptl, |
| 1263 | struct vm_area_struct *vma) | 1263 | struct vm_area_struct *vma); |
| 1264 | { | 1264 | /* |
| 1265 | if (radix_enabled()) | 1265 | * Hash translation mode use the deposited table to store hash pte |
| 1266 | return false; | 1266 | * slot information. |
| 1267 | /* | 1267 | */ |
| 1268 | * Archs like ppc64 use pgtable to store per pmd | ||
| 1269 | * specific information. So when we switch the pmd, | ||
| 1270 | * we should also withdraw and deposit the pgtable | ||
| 1271 | */ | ||
| 1272 | return true; | ||
| 1273 | } | ||
| 1274 | |||
| 1275 | |||
| 1276 | #define arch_needs_pgtable_deposit arch_needs_pgtable_deposit | 1268 | #define arch_needs_pgtable_deposit arch_needs_pgtable_deposit |
| 1277 | static inline bool arch_needs_pgtable_deposit(void) | 1269 | static inline bool arch_needs_pgtable_deposit(void) |
| 1278 | { | 1270 | { |
| @@ -47,6 +47,7 @@ enum perf_event_powerpc_regs { · 46 unmodified lines | |||
| 47 | PERF_REG_POWERPC_DAR, | 47 | PERF_REG_POWERPC_DAR, |
| 48 | PERF_REG_POWERPC_DSISR, | 48 | PERF_REG_POWERPC_DSISR, |
| 49 | PERF_REG_POWERPC_SIER, | 49 | PERF_REG_POWERPC_SIER, |
| 50 | PERF_REG_POWERPC_MMCRA, | ||
| 50 | PERF_REG_POWERPC_MAX, | 51 | PERF_REG_POWERPC_MAX, |
| 51 | }; | 52 | }; |
| 52 | #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */ | 53 | #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */ |
| @@ -852,11 +852,12 @@ start_here: · 851 unmodified lines | |||
| 852 | 852 | ||
| 853 | /* set up the PTE pointers for the Abatron bdiGDB. | 853 | /* set up the PTE pointers for the Abatron bdiGDB. |
| 854 | */ | 854 | */ |
| 855 | tovirt(r6,r6) | ||
| 856 | lis r5, abatron_pteptrs@h | 855 | lis r5, abatron_pteptrs@h |
| 857 | ori r5, r5, abatron_pteptrs@l | 856 | ori r5, r5, abatron_pteptrs@l |
| 858 | stw r5, 0xf0(0) /* Must match your Abatron config file */ | 857 | stw r5, 0xf0(0) /* Must match your Abatron config file */ |
| 859 | tophys(r5,r5) | 858 | tophys(r5,r5) |
| 859 | lis r6, swapper_pg_dir@h | ||
| 860 | ori r6, r6, swapper_pg_dir@l | ||
| 860 | stw r6, 0(r5) | 861 | stw r6, 0(r5) |
| 861 | 862 | ||
| 862 | /* Now turn on the MMU for real! */ | 863 | /* Now turn on the MMU for real! */ |
| @@ -755,11 +755,12 @@ SYSCALL_DEFINE0(rt_sigreturn) · 754 unmodified lines | |||
| 755 | if (restore_tm_sigcontexts(current, &uc->uc_mcontext, | 755 | if (restore_tm_sigcontexts(current, &uc->uc_mcontext, |
| 756 | &uc_transact->uc_mcontext)) | 756 | &uc_transact->uc_mcontext)) |
| 757 | goto badframe; | 757 | goto badframe; |
| 758 | } | 758 | } else |
| 759 | #endif | 759 | #endif |
| 760 | /* Fall through, for non-TM restore */ | 760 | { |
| 761 | if (!MSR_TM_ACTIVE(msr)) { | ||
| 762 | /* | 761 | /* |
| 762 | * Fall through, for non-TM restore | ||
| 763 | * | ||
| 763 | * Unset MSR[TS] on the thread regs since MSR from user | 764 | * Unset MSR[TS] on the thread regs since MSR from user |
| 764 | * context does not have MSR active, and recheckpoint was | 765 | * context does not have MSR active, and recheckpoint was |
| 765 | * not called since restore_tm_sigcontexts() was not called | 766 | * not called since restore_tm_sigcontexts() was not called |
| @@ -967,13 +967,6 @@ out: · 966 unmodified lines | |||
| 967 | } | 967 | } |
| 968 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | 968 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
| 969 | 969 | ||
| 970 | #if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_PPC64) | ||
| 971 | unsigned long __init arch_syscall_addr(int nr) | ||
| 972 | { | ||
| 973 | return sys_call_table[nr*2]; | ||
| 974 | } | ||
| 975 | #endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_PPC64 */ | ||
| 976 | |||
| 977 | #ifdef PPC64_ELF_ABI_v1 | 970 | #ifdef PPC64_ELF_ABI_v1 |
| 978 | char *arch_ftrace_match_adjust(char *str, const char *search) | 971 | char *arch_ftrace_match_adjust(char *str, const char *search) |
| 979 | { | 972 | { |
| @@ -400,3 +400,25 @@ void arch_report_meminfo(struct seq_file *m) · 399 unmodified lines | |||
| 400 | atomic_long_read(&direct_pages_count[MMU_PAGE_1G]) << 20); | 400 | atomic_long_read(&direct_pages_count[MMU_PAGE_1G]) << 20); |
| 401 | } | 401 | } |
| 402 | #endif /* CONFIG_PROC_FS */ | 402 | #endif /* CONFIG_PROC_FS */ |
| 403 | |||
| 404 | /* | ||
| 405 | * For hash translation mode, we use the deposited table to store hash slot | ||
| 406 | * information and they are stored at PTRS_PER_PMD offset from related pmd | ||
| 407 | * location. Hence a pmd move requires deposit and withdraw. | ||
| 408 | * | ||
| 409 | * For radix translation with split pmd ptl, we store the deposited table in the | ||
| 410 | * pmd page. Hence if we have different pmd page we need to withdraw during pmd | ||
| 411 | * move. | ||
| 412 | * | ||
| 413 | * With hash we use deposited table always irrespective of anon or not. | ||
| 414 | * With radix we use deposited table only for anonymous mapping. | ||
| 415 | */ | ||
| 416 | int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, | ||
| 417 | struct spinlock *old_pmd_ptl, | ||
| 418 | struct vm_area_struct *vma) | ||
| 419 | { | ||
| 420 | if (radix_enabled()) | ||
| 421 | return (new_pmd_ptl != old_pmd_ptl) && vma_is_anonymous(vma); | ||
| 422 | |||
| 423 | return true; | ||
| 424 | } | ||
| @@ -70,6 +70,7 @@ static unsigned int pt_regs_offset[PERF_REG_POWERPC_MAX] = { · 69 unmodified lines | |||
| 70 | PT_REGS_OFFSET(PERF_REG_POWERPC_DAR, dar), | 70 | PT_REGS_OFFSET(PERF_REG_POWERPC_DAR, dar), |
| 71 | PT_REGS_OFFSET(PERF_REG_POWERPC_DSISR, dsisr), | 71 | PT_REGS_OFFSET(PERF_REG_POWERPC_DSISR, dsisr), |
| 72 | PT_REGS_OFFSET(PERF_REG_POWERPC_SIER, dar), | 72 | PT_REGS_OFFSET(PERF_REG_POWERPC_SIER, dar), |
| 73 | PT_REGS_OFFSET(PERF_REG_POWERPC_MMCRA, dsisr), | ||
| 73 | }; | 74 | }; |
| 74 | 75 | ||
| 75 | u64 perf_reg_value(struct pt_regs *regs, int idx) | 76 | u64 perf_reg_value(struct pt_regs *regs, int idx) |
| @@ -83,6 +84,11 @@ u64 perf_reg_value(struct pt_regs *regs, int idx) · 7 unmodified lines | |||
| 83 | !is_sier_available())) | 84 | !is_sier_available())) |
| 84 | return 0; | 85 | return 0; |
| 85 | 86 | ||
| 87 | if (idx == PERF_REG_POWERPC_MMCRA && | ||
| 88 | (IS_ENABLED(CONFIG_FSL_EMB_PERF_EVENT) || | ||
| 89 | IS_ENABLED(CONFIG_PPC32))) | ||
| 90 | return 0; | ||
| 91 | |||
| 86 | return regs_get_register(regs, pt_regs_offset[idx]); | 92 | return regs_get_register(regs, pt_regs_offset[idx]); |
| 87 | } | 93 | } |
| 88 | 94 | ||
| @@ -237,12 +237,12 @@ static int ocm_debugfs_show(struct seq_file *m, void *v) · 236 unmodified lines | |||
| 237 | continue; | 237 | continue; |
| 238 | 238 | ||
| 239 | seq_printf(m, "PPC4XX OCM : %d\n", ocm->index); | 239 | seq_printf(m, "PPC4XX OCM : %d\n", ocm->index); |
| 240 | seq_printf(m, "PhysAddr : %pa[p]\n", &(ocm->phys)); | 240 | seq_printf(m, "PhysAddr : %pa\n", &(ocm->phys)); |
| 241 | seq_printf(m, "MemTotal : %d Bytes\n", ocm->memtotal); | 241 | seq_printf(m, "MemTotal : %d Bytes\n", ocm->memtotal); |
| 242 | seq_printf(m, "MemTotal(NC) : %d Bytes\n", ocm->nc.memtotal); | 242 | seq_printf(m, "MemTotal(NC) : %d Bytes\n", ocm->nc.memtotal); |
| 243 | seq_printf(m, "MemTotal(C) : %d Bytes\n\n", ocm->c.memtotal); | 243 | seq_printf(m, "MemTotal(C) : %d Bytes\n\n", ocm->c.memtotal); |
| 244 | 244 | ||
| 245 | seq_printf(m, "NC.PhysAddr : %pa[p]\n", &(ocm->nc.phys)); | 245 | seq_printf(m, "NC.PhysAddr : %pa\n", &(ocm->nc.phys)); |
| 246 | seq_printf(m, "NC.VirtAddr : 0x%p\n", ocm->nc.virt); | 246 | seq_printf(m, "NC.VirtAddr : 0x%p\n", ocm->nc.virt); |
| 247 | seq_printf(m, "NC.MemTotal : %d Bytes\n", ocm->nc.memtotal); | 247 | seq_printf(m, "NC.MemTotal : %d Bytes\n", ocm->nc.memtotal); |
| 248 | seq_printf(m, "NC.MemFree : %d Bytes\n", ocm->nc.memfree); | 248 | seq_printf(m, "NC.MemFree : %d Bytes\n", ocm->nc.memfree); |
| @@ -252,7 +252,7 @@ static int ocm_debugfs_show(struct seq_file *m, void *v) · 3 unmodified lines | |||
| 252 | blk->size, blk->owner); | 252 | blk->size, blk->owner); |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | seq_printf(m, "\nC.PhysAddr : %pa[p]\n", &(ocm->c.phys)); | 255 | seq_printf(m, "\nC.PhysAddr : %pa\n", &(ocm->c.phys)); |
| 256 | seq_printf(m, "C.VirtAddr : 0x%p\n", ocm->c.virt); | 256 | seq_printf(m, "C.VirtAddr : 0x%p\n", ocm->c.virt); |
| 257 | seq_printf(m, "C.MemTotal : %d Bytes\n", ocm->c.memtotal); | 257 | seq_printf(m, "C.MemTotal : %d Bytes\n", ocm->c.memtotal); |
| 258 | seq_printf(m, "C.MemFree : %d Bytes\n", ocm->c.memfree); | 258 | seq_printf(m, "C.MemFree : %d Bytes\n", ocm->c.memfree); |
| @@ -538,8 +538,7 @@ static void __init chrp_init_IRQ(void) · 537 unmodified lines | |||
| 538 | /* see if there is a keyboard in the device tree | 538 | /* see if there is a keyboard in the device tree |
| 539 | with a parent of type "adb" */ | 539 | with a parent of type "adb" */ |
| 540 | for_each_node_by_name(kbd, "keyboard") | 540 | for_each_node_by_name(kbd, "keyboard") |
| 541 | if (kbd->parent && kbd->parent->type | 541 | if (of_node_is_type(kbd->parent, "adb")) |
| 542 | && strcmp(kbd->parent->type, "adb") == 0) | ||
| 543 | break; | 542 | break; |
| 544 | of_node_put(kbd); | 543 | of_node_put(kbd); |
| 545 | if (kbd) | 544 | if (kbd) |
| @@ -255,7 +255,7 @@ int pasemi_dma_alloc_ring(struct pasemi_dmachan *chan, int ring_size) · 254 unmodified lines | |||
| 255 | 255 | ||
| 256 | chan->ring_size = ring_size; | 256 | chan->ring_size = ring_size; |
| 257 | 257 | ||
| 258 | chan->ring_virt = dma_zalloc_coherent(&dma_pdev->dev, | 258 | chan->ring_virt = dma_alloc_coherent(&dma_pdev->dev, |
| 259 | ring_size * sizeof(u64), | 259 | ring_size * sizeof(u64), |
| 260 | &chan->ring_dma, GFP_KERNEL); | 260 | &chan->ring_dma, GFP_KERNEL); |
| 261 | 261 | ||
| @@ -564,7 +564,7 @@ struct iommu_table_group *pnv_try_setup_npu_table_group(struct pnv_ioda_pe *pe) · 563 unmodified lines | |||
| 564 | } | 564 | } |
| 565 | } else { | 565 | } else { |
| 566 | /* Create a group for 1 GPU and attached NPUs for POWER8 */ | 566 | /* Create a group for 1 GPU and attached NPUs for POWER8 */ |
| 567 | pe->npucomp = kzalloc(sizeof(pe->npucomp), GFP_KERNEL); | 567 | pe->npucomp = kzalloc(sizeof(*pe->npucomp), GFP_KERNEL); |
| 568 | table_group = &pe->npucomp->table_group; | 568 | table_group = &pe->npucomp->table_group; |
| 569 | table_group->ops = &pnv_npu_peers_ops; | 569 | table_group->ops = &pnv_npu_peers_ops; |
| 570 | iommu_register_group(table_group, hose->global_number, | 570 | iommu_register_group(table_group, hose->global_number, |
| @@ -2681,7 +2681,8 @@ static void pnv_pci_ioda_setup_iommu_api(void) · 2680 unmodified lines | |||
| 2681 | list_for_each_entry(hose, &hose_list, list_node) { | 2681 | list_for_each_entry(hose, &hose_list, list_node) { |
| 2682 | phb = hose->private_data; | 2682 | phb = hose->private_data; |
| 2683 | 2683 | ||
| 2684 | if (phb->type == PNV_PHB_NPU_NVLINK) | 2684 | if (phb->type == PNV_PHB_NPU_NVLINK || |
| 2685 | phb->type == PNV_PHB_NPU_OCAPI) | ||
| 2685 | continue; | 2686 | continue; |
| 2686 | 2687 | ||
| 2687 | list_for_each_entry(pe, &phb->ioda.pe_list, list) { | 2688 | list_for_each_entry(pe, &phb->ioda.pe_list, list) { |
| @@ -43,6 +43,7 @@ static int drc_pmem_bind(struct papr_scm_priv *p) · 42 unmodified lines | |||
| 43 | { | 43 | { |
| 44 | unsigned long ret[PLPAR_HCALL_BUFSIZE]; | 44 | unsigned long ret[PLPAR_HCALL_BUFSIZE]; |
| 45 | uint64_t rc, token; | 45 | uint64_t rc, token; |
| 46 | uint64_t saved = 0; | ||
| 46 | 47 | ||
| 47 | /* | 48 | /* |
| 48 | * When the hypervisor cannot map all the requested memory in a single | 49 | * When the hypervisor cannot map all the requested memory in a single |
| @@ -56,6 +57,8 @@ static int drc_pmem_bind(struct papr_scm_priv *p) · 7 unmodified lines | |||
| 56 | rc = plpar_hcall(H_SCM_BIND_MEM, ret, p->drc_index, 0, | 57 | rc = plpar_hcall(H_SCM_BIND_MEM, ret, p->drc_index, 0, |
| 57 | p->blocks, BIND_ANY_ADDR, token); | 58 | p->blocks, BIND_ANY_ADDR, token); |
| 58 | token = ret[0]; | 59 | token = ret[0]; |
| 60 | if (!saved) | ||
| 61 | saved = ret[1]; | ||
| 59 | cond_resched(); | 62 | cond_resched(); |
| 60 | } while (rc == H_BUSY); | 63 | } while (rc == H_BUSY); |
| 61 | 64 | ||
| @@ -64,7 +67,7 @@ static int drc_pmem_bind(struct papr_scm_priv *p) · 2 unmodified lines | |||
| 64 | return -ENXIO; | 67 | return -ENXIO; |
| 65 | } | 68 | } |
| 66 | 69 | ||
| 67 | p->bound_addr = ret[1]; | 70 | p->bound_addr = saved; |
| 68 | 71 | ||
| 69 | dev_dbg(&p->pdev->dev, "bound drc %x to %pR\n", p->drc_index, &p->res); | 72 | dev_dbg(&p->pdev->dev, "bound drc %x to %pR\n", p->drc_index, &p->res); |
| 70 | 73 | ||
| @@ -264,7 +264,9 @@ void __init pSeries_final_fixup(void) · 263 unmodified lines | |||
| 264 | if (!of_device_is_compatible(nvdn->parent, | 264 | if (!of_device_is_compatible(nvdn->parent, |
| 265 | "ibm,power9-npu")) | 265 | "ibm,power9-npu")) |
| 266 | continue; | 266 | continue; |
| 267 | #ifdef CONFIG_PPC_POWERNV | ||
| 267 | WARN_ON_ONCE(pnv_npu2_init(hose)); | 268 | WARN_ON_ONCE(pnv_npu2_init(hose)); |
| 269 | #endif | ||
| 268 | break; | 270 | break; |
| 269 | } | 271 | } |
| 270 | } | 272 | } |
| @@ -756,9 +756,10 @@ fsl_open_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries) · 755 unmodified lines | |||
| 756 | } | 756 | } |
| 757 | 757 | ||
| 758 | /* Initialize outbound message descriptor ring */ | 758 | /* Initialize outbound message descriptor ring */ |
| 759 | rmu->msg_tx_ring.virt = dma_zalloc_coherent(priv->dev, | 759 | rmu->msg_tx_ring.virt = dma_alloc_coherent(priv->dev, |
| 760 | rmu->msg_tx_ring.size * RIO_MSG_DESC_SIZE, | 760 | rmu->msg_tx_ring.size * RIO_MSG_DESC_SIZE, |
| 761 | &rmu->msg_tx_ring.phys, GFP_KERNEL); | 761 | &rmu->msg_tx_ring.phys, |
| 762 | GFP_KERNEL); | ||
| 762 | if (!rmu->msg_tx_ring.virt) { | 763 | if (!rmu->msg_tx_ring.virt) { |
| 763 | rc = -ENOMEM; | 764 | rc = -ENOMEM; |
| 764 | goto out_dma; | 765 | goto out_dma; |
| @@ -28,11 +28,13 @@ config RISCV · 27 unmodified lines | |||
| 28 | select GENERIC_STRNLEN_USER | 28 | select GENERIC_STRNLEN_USER |
| 29 | select GENERIC_SMP_IDLE_THREAD | 29 | select GENERIC_SMP_IDLE_THREAD |
| 30 | select GENERIC_ATOMIC64 if !64BIT || !RISCV_ISA_A | 30 | select GENERIC_ATOMIC64 if !64BIT || !RISCV_ISA_A |
| 31 | select HAVE_ARCH_AUDITSYSCALL | ||
| 31 | select HAVE_MEMBLOCK_NODE_MAP | 32 | select HAVE_MEMBLOCK_NODE_MAP |
| 32 | select HAVE_DMA_CONTIGUOUS | 33 | select HAVE_DMA_CONTIGUOUS |
| 33 | select HAVE_FUTEX_CMPXCHG if FUTEX | 34 | select HAVE_FUTEX_CMPXCHG if FUTEX |
| 34 | select HAVE_GENERIC_DMA_COHERENT | 35 | select HAVE_GENERIC_DMA_COHERENT |
| 35 | select HAVE_PERF_EVENTS | 36 | select HAVE_PERF_EVENTS |
| 37 | select HAVE_SYSCALL_TRACEPOINTS | ||
| 36 | select IRQ_DOMAIN | 38 | select IRQ_DOMAIN |
| 37 | select RISCV_ISA_A if SMP | 39 | select RISCV_ISA_A if SMP |
| 38 | select SPARSE_IRQ | 40 | select SPARSE_IRQ |
| @@ -40,6 +42,7 @@ config RISCV · 1 unmodified line | |||
| 40 | select HAVE_ARCH_TRACEHOOK | 42 | select HAVE_ARCH_TRACEHOOK |
| 41 | select HAVE_PCI | 43 | select HAVE_PCI |
| 42 | select MODULES_USE_ELF_RELA if MODULES | 44 | select MODULES_USE_ELF_RELA if MODULES |
| 45 | select MODULE_SECTIONS if MODULES | ||
| 43 | select THREAD_INFO_IN_TASK | 46 | select THREAD_INFO_IN_TASK |
| 44 | select PCI_DOMAINS_GENERIC if PCI | 47 | select PCI_DOMAINS_GENERIC if PCI |
| 45 | select PCI_MSI if PCI | 48 | select PCI_MSI if PCI |
| @@ -100,7 +103,7 @@ choice · 54 unmodified lines | |||
| 100 | prompt "Base ISA" | 103 | prompt "Base ISA" |
| 101 | default ARCH_RV64I | 104 | default ARCH_RV64I |
| 102 | help | 105 | help |
| 103 | This selects the base ISA that this kernel will traget and must match | 106 | This selects the base ISA that this kernel will target and must match |
| 104 | the target platform. | 107 | the target platform. |
| 105 | 108 | ||
| 106 | config ARCH_RV32I | 109 | config ARCH_RV32I |
| @@ -152,7 +155,6 @@ choice · 45 unmodified lines | |||
| 152 | bool "2GiB" | 155 | bool "2GiB" |
| 153 | config MAXPHYSMEM_128GB | 156 | config MAXPHYSMEM_128GB |
| 154 | depends on 64BIT && CMODEL_MEDANY | 157 | depends on 64BIT && CMODEL_MEDANY |
| 155 | select MODULE_SECTIONS if MODULES | ||
| 156 | bool "128GiB" | 158 | bool "128GiB" |
| 157 | endchoice | 159 | endchoice |
| 158 | 160 | ||
| @@ -13,8 +13,6 @@ CONFIG_BLK_DEV_INITRD=y · 12 unmodified lines | |||
| 13 | CONFIG_EXPERT=y | 13 | CONFIG_EXPERT=y |
| 14 | CONFIG_BPF_SYSCALL=y | 14 | CONFIG_BPF_SYSCALL=y |
| 15 | CONFIG_SMP=y | 15 | CONFIG_SMP=y |
| 16 | CONFIG_PCI=y | ||
| 17 | CONFIG_PCIE_XILINX=y | ||
| 18 | CONFIG_MODULES=y | 16 | CONFIG_MODULES=y |
| 19 | CONFIG_MODULE_UNLOAD=y | 17 | CONFIG_MODULE_UNLOAD=y |
| 20 | CONFIG_NET=y | 18 | CONFIG_NET=y |
| @@ -28,6 +26,10 @@ CONFIG_IP_PNP_DHCP=y · 7 unmodified lines | |||
| 28 | CONFIG_IP_PNP_BOOTP=y | 26 | CONFIG_IP_PNP_BOOTP=y |
| 29 | CONFIG_IP_PNP_RARP=y | 27 | CONFIG_IP_PNP_RARP=y |
| 30 | CONFIG_NETLINK_DIAG=y | 28 | CONFIG_NETLINK_DIAG=y |
| 29 | CONFIG_PCI=y | ||
| 30 | CONFIG_PCIEPORTBUS=y | ||
| 31 | CONFIG_PCI_HOST_GENERIC=y | ||
| 32 | CONFIG_PCIE_XILINX=y | ||
| 31 | CONFIG_DEVTMPFS=y | 33 | CONFIG_DEVTMPFS=y |
| 32 | CONFIG_BLK_DEV_LOOP=y | 34 | CONFIG_BLK_DEV_LOOP=y |
| 33 | CONFIG_VIRTIO_BLK=y | 35 | CONFIG_VIRTIO_BLK=y |
| @@ -63,7 +65,6 @@ CONFIG_USB_STORAGE=y · 29 unmodified lines | |||
| 63 | CONFIG_USB_UAS=y | 65 | CONFIG_USB_UAS=y |
| 64 | CONFIG_VIRTIO_MMIO=y | 66 | CONFIG_VIRTIO_MMIO=y |
| 65 | CONFIG_SIFIVE_PLIC=y | 67 | CONFIG_SIFIVE_PLIC=y |
| 66 | CONFIG_RAS=y | ||
| 67 | CONFIG_EXT4_FS=y | 68 | CONFIG_EXT4_FS=y |
| 68 | CONFIG_EXT4_FS_POSIX_ACL=y | 69 | CONFIG_EXT4_FS_POSIX_ACL=y |
| 69 | CONFIG_AUTOFS4_FS=y | 70 | CONFIG_AUTOFS4_FS=y |
| @@ -77,5 +78,6 @@ CONFIG_NFS_V4_1=y · 7 unmodified lines | |||
| 77 | CONFIG_NFS_V4_2=y | 78 | CONFIG_NFS_V4_2=y |
| 78 | CONFIG_ROOT_NFS=y | 79 | CONFIG_ROOT_NFS=y |
| 79 | CONFIG_CRYPTO_USER_API_HASH=y | 80 | CONFIG_CRYPTO_USER_API_HASH=y |
| 81 | CONFIG_CRYPTO_DEV_VIRTIO=y | ||
| 80 | CONFIG_PRINTK_TIME=y | 82 | CONFIG_PRINTK_TIME=y |
| 81 | # CONFIG_RCU_TRACE is not set | 83 | # CONFIG_RCU_TRACE is not set |
| @@ -9,12 +9,12 @@ · 8 unmodified lines | |||
| 9 | #define MODULE_ARCH_VERMAGIC "riscv" | 9 | #define MODULE_ARCH_VERMAGIC "riscv" |
| 10 | 10 | ||
| 11 | struct module; | 11 | struct module; |
| 12 | u64 module_emit_got_entry(struct module *mod, u64 val); | 12 | unsigned long module_emit_got_entry(struct module *mod, unsigned long val); |
| 13 | u64 module_emit_plt_entry(struct module *mod, u64 val); | 13 | unsigned long module_emit_plt_entry(struct module *mod, unsigned long val); |
| 14 | 14 | ||
| 15 | #ifdef CONFIG_MODULE_SECTIONS | 15 | #ifdef CONFIG_MODULE_SECTIONS |
| 16 | struct mod_section { | 16 | struct mod_section { |
| 17 | struct elf64_shdr *shdr; | 17 | Elf_Shdr *shdr; |
| 18 | int num_entries; | 18 | int num_entries; |
| 19 | int max_entries; | 19 | int max_entries; |
| 20 | }; | 20 | }; |
| @@ -26,18 +26,18 @@ struct mod_arch_specific { · 5 unmodified lines | |||
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | struct got_entry { | 28 | struct got_entry { |
| 29 | u64 symbol_addr; /* the real variable address */ | 29 | unsigned long symbol_addr; /* the real variable address */ |
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | static inline struct got_entry emit_got_entry(u64 val) | 32 | static inline struct got_entry emit_got_entry(unsigned long val) |
| 33 | { | 33 | { |
| 34 | return (struct got_entry) {val}; | 34 | return (struct got_entry) {val}; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | static inline struct got_entry *get_got_entry(u64 val, | 37 | static inline struct got_entry *get_got_entry(unsigned long val, |
| 38 | const struct mod_section *sec) | 38 | const struct mod_section *sec) |
| 39 | { | 39 | { |
| 40 | struct got_entry *got = (struct got_entry *)sec->shdr->sh_addr; | 40 | struct got_entry *got = (struct got_entry *)(sec->shdr->sh_addr); |
| 41 | int i; | 41 | int i; |
| 42 | for (i = 0; i < sec->num_entries; i++) { | 42 | for (i = 0; i < sec->num_entries; i++) { |
| 43 | if (got[i].symbol_addr == val) | 43 | if (got[i].symbol_addr == val) |
| @@ -62,7 +62,9 @@ struct plt_entry { · 18 unmodified lines | |||
| 62 | #define REG_T0 0x5 | 62 | #define REG_T0 0x5 |
| 63 | #define REG_T1 0x6 | 63 | #define REG_T1 0x6 |
| 64 | 64 | ||
| 65 | static inline struct plt_entry emit_plt_entry(u64 val, u64 plt, u64 got_plt) | 65 | static inline struct plt_entry emit_plt_entry(unsigned long val, |
| 66 | unsigned long plt, | ||
| 67 | unsigned long got_plt) | ||
| 66 | { | 68 | { |
| 67 | /* | 69 | /* |
| 68 | * U-Type encoding: | 70 | * U-Type encoding: |
| @@ -76,7 +78,7 @@ static inline struct plt_entry emit_plt_entry(u64 val, u64 plt, u64 got_plt) · 7 unmodified lines | |||
| 76 | * +------------+------------+--------+----------+----------+ | 78 | * +------------+------------+--------+----------+----------+ |
| 77 | * | 79 | * |
| 78 | */ | 80 | */ |
| 79 | u64 offset = got_plt - plt; | 81 | unsigned long offset = got_plt - plt; |
| 80 | u32 hi20 = (offset + 0x800) & 0xfffff000; | 82 | u32 hi20 = (offset + 0x800) & 0xfffff000; |
| 81 | u32 lo12 = (offset - hi20); | 83 | u32 lo12 = (offset - hi20); |
| 82 | return (struct plt_entry) { | 84 | return (struct plt_entry) { |
| @@ -86,7 +88,7 @@ static inline struct plt_entry emit_plt_entry(u64 val, u64 plt, u64 got_plt) · 3 unmodified lines | |||
| 86 | }; | 88 | }; |
| 87 | } | 89 | } |
| 88 | 90 | ||
| 89 | static inline int get_got_plt_idx(u64 val, const struct mod_section *sec) | 91 | static inline int get_got_plt_idx(unsigned long val, const struct mod_section *sec) |
| 90 | { | 92 | { |
| 91 | struct got_entry *got_plt = (struct got_entry *)sec->shdr->sh_addr; | 93 | struct got_entry *got_plt = (struct got_entry *)sec->shdr->sh_addr; |
| 92 | int i; | 94 | int i; |
| @@ -97,9 +99,9 @@ static inline int get_got_plt_idx(u64 val, const struct mod_section *sec) · 4 unmodified lines | |||
| 97 | return -1; | 99 | return -1; |
| 98 | } | 100 | } |
| 99 | 101 | ||
| 100 | static inline struct plt_entry *get_plt_entry(u64 val, | 102 | static inline struct plt_entry *get_plt_entry(unsigned long val, |
| 101 | const struct mod_section *sec_plt, | 103 | const struct mod_section *sec_plt, |
| 102 | const struct mod_section *sec_got_plt) | 104 | const struct mod_section *sec_got_plt) |
| 103 | { | 105 | { |
| 104 | struct plt_entry *plt = (struct plt_entry *)sec_plt->shdr->sh_addr; | 106 | struct plt_entry *plt = (struct plt_entry *)sec_plt->shdr->sh_addr; |
| 105 | int got_plt_idx = get_got_plt_idx(val, sec_got_plt); | 107 | int got_plt_idx = get_got_plt_idx(val, sec_got_plt); |
| @@ -80,7 +80,7 @@ typedef struct page *pgtable_t; · 79 unmodified lines | |||
| 80 | #define __pgd(x) ((pgd_t) { (x) }) | 80 | #define __pgd(x) ((pgd_t) { (x) }) |
| 81 | #define __pgprot(x) ((pgprot_t) { (x) }) | 81 | #define __pgprot(x) ((pgprot_t) { (x) }) |
| 82 | 82 | ||
| 83 | #ifdef CONFIG_64BITS | 83 | #ifdef CONFIG_64BIT |
| 84 | #define PTE_FMT "%016lx" | 84 | #define PTE_FMT "%016lx" |
| 85 | #else | 85 | #else |
| 86 | #define PTE_FMT "%08lx" | 86 | #define PTE_FMT "%08lx" |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | * This decides where the kernel will search for a free chunk of vm | 22 | * This decides where the kernel will search for a free chunk of vm |
| 23 | * space during mmap's. | 23 | * space during mmap's. |
| 24 | */ | 24 | */ |
| 25 | #define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE >> 1) | 25 | #define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3) |
| 26 | 26 | ||
| 27 | #define STACK_TOP TASK_SIZE | 27 | #define STACK_TOP TASK_SIZE |
| 28 | #define STACK_TOP_MAX STACK_TOP | 28 | #define STACK_TOP_MAX STACK_TOP |
| @@ -113,6 +113,11 @@ static inline void frame_pointer_set(struct pt_regs *regs, · 112 unmodified lines | |||
| 113 | SET_FP(regs, val); | 113 | SET_FP(regs, val); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | static inline unsigned long regs_return_value(struct pt_regs *regs) | ||
| 117 | { | ||
| 118 | return regs->a0; | ||
| 119 | } | ||
| 120 | |||
| 116 | #endif /* __ASSEMBLY__ */ | 121 | #endif /* __ASSEMBLY__ */ |
| 117 | 122 | ||
| 118 | #endif /* _ASM_RISCV_PTRACE_H */ | 123 | #endif /* _ASM_RISCV_PTRACE_H */ |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | |||
| 18 | #ifndef _ASM_RISCV_SYSCALL_H | 18 | #ifndef _ASM_RISCV_SYSCALL_H |
| 19 | #define _ASM_RISCV_SYSCALL_H | 19 | #define _ASM_RISCV_SYSCALL_H |
| 20 | 20 | ||
| 21 | #include <uapi/linux/audit.h> | ||
| 21 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
| 22 | #include <linux/err.h> | 23 | #include <linux/err.h> |
| 23 | 24 | ||
| @@ -99,4 +100,13 @@ static inline void syscall_set_arguments(struct task_struct *task, · 75 unmodified lines | |||
| 99 | memcpy(®s->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0)); | 100 | memcpy(®s->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0)); |
| 100 | } | 101 | } |
| 101 | 102 | ||
| 103 | static inline int syscall_get_arch(void) | ||
| 104 | { | ||
| 105 | #ifdef CONFIG_64BIT | ||
| 106 | return AUDIT_ARCH_RISCV64; | ||
| 107 | #else | ||
| 108 | return AUDIT_ARCH_RISCV32; | ||
| 109 | #endif | ||
| 110 | } | ||
| 111 | |||
| 102 | #endif /* _ASM_RISCV_SYSCALL_H */ | 112 | #endif /* _ASM_RISCV_SYSCALL_H */ |
| @@ -80,13 +80,19 @@ struct thread_info { · 79 unmodified lines | |||
| 80 | #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ | 80 | #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ |
| 81 | #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ | 81 | #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ |
| 82 | #define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */ | 82 | #define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */ |
| 83 | #define TIF_SYSCALL_AUDIT 7 /* syscall auditing */ | ||
| 83 | 84 | ||
| 84 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | 85 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
| 85 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | 86 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) |
| 86 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | 87 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
| 87 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | 88 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) |
| 89 | #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) | ||
| 90 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) | ||
| 88 | 91 | ||
| 89 | #define _TIF_WORK_MASK \ | 92 | #define _TIF_WORK_MASK \ |
| 90 | (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED) | 93 | (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED) |
| 91 | 94 | ||
| 95 | #define _TIF_SYSCALL_WORK \ | ||
| 96 | (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_TRACEPOINT | _TIF_SYSCALL_AUDIT) | ||
| 97 | |||
| 92 | #endif /* _ASM_RISCV_THREAD_INFO_H */ | 98 | #endif /* _ASM_RISCV_THREAD_INFO_H */ |
| @@ -19,3 +19,5 @@ · 18 unmodified lines | |||
| 19 | #define __ARCH_WANT_SYS_CLONE | 19 | #define __ARCH_WANT_SYS_CLONE |
| 20 | 20 | ||
| 21 | #include <uapi/asm/unistd.h> | 21 | #include <uapi/asm/unistd.h> |
| 22 | |||
| 23 | #define NR_syscalls (__NR_syscalls) | ||
| @@ -39,6 +39,7 @@ void asm_offsets(void) · 38 unmodified lines | |||
| 39 | OFFSET(TASK_STACK, task_struct, stack); | 39 | OFFSET(TASK_STACK, task_struct, stack); |
| 40 | OFFSET(TASK_TI, task_struct, thread_info); | 40 | OFFSET(TASK_TI, task_struct, thread_info); |
| 41 | OFFSET(TASK_TI_FLAGS, task_struct, thread_info.flags); | 41 | OFFSET(TASK_TI_FLAGS, task_struct, thread_info.flags); |
| 42 | OFFSET(TASK_TI_PREEMPT_COUNT, task_struct, thread_info.preempt_count); | ||
| 42 | OFFSET(TASK_TI_KERNEL_SP, task_struct, thread_info.kernel_sp); | 43 | OFFSET(TASK_TI_KERNEL_SP, task_struct, thread_info.kernel_sp); |
| 43 | OFFSET(TASK_TI_USER_SP, task_struct, thread_info.user_sp); | 44 | OFFSET(TASK_TI_USER_SP, task_struct, thread_info.user_sp); |
| 44 | OFFSET(TASK_TI_CPU, task_struct, thread_info.cpu); | 45 | OFFSET(TASK_TI_CPU, task_struct, thread_info.cpu); |
| @@ -144,6 +144,10 @@ _save_context: · 143 unmodified lines | |||
| 144 | REG_L x2, PT_SP(sp) | 144 | REG_L x2, PT_SP(sp) |
| 145 | .endm | 145 | .endm |
| 146 | 146 | ||
| 147 | #if !IS_ENABLED(CONFIG_PREEMPT) | ||
| 148 | .set resume_kernel, restore_all | ||
| 149 | #endif | ||
| 150 | |||
| 147 | ENTRY(handle_exception) | 151 | ENTRY(handle_exception) |
| 148 | SAVE_ALL | 152 | SAVE_ALL |
| 149 | 153 | ||
| @@ -201,7 +205,7 @@ handle_syscall: · 51 unmodified lines | |||
| 201 | REG_S s2, PT_SEPC(sp) | 205 | REG_S s2, PT_SEPC(sp) |
| 202 | /* Trace syscalls, but only if requested by the user. */ | 206 | /* Trace syscalls, but only if requested by the user. */ |
| 203 | REG_L t0, TASK_TI_FLAGS(tp) | 207 | REG_L t0, TASK_TI_FLAGS(tp) |
| 204 | andi t0, t0, _TIF_SYSCALL_TRACE | 208 | andi t0, t0, _TIF_SYSCALL_WORK |
| 205 | bnez t0, handle_syscall_trace_enter | 209 | bnez t0, handle_syscall_trace_enter |
| 206 | check_syscall_nr: | 210 | check_syscall_nr: |
| 207 | /* Check to make sure we don't jump to a bogus syscall number. */ | 211 | /* Check to make sure we don't jump to a bogus syscall number. */ |
| @@ -221,14 +225,14 @@ ret_from_syscall: · 13 unmodified lines | |||
| 221 | REG_S a0, PT_A0(sp) | 225 | REG_S a0, PT_A0(sp) |
| 222 | /* Trace syscalls, but only if requested by the user. */ | 226 | /* Trace syscalls, but only if requested by the user. */ |
| 223 | REG_L t0, TASK_TI_FLAGS(tp) | 227 | REG_L t0, TASK_TI_FLAGS(tp) |
| 224 | andi t0, t0, _TIF_SYSCALL_TRACE | 228 | andi t0, t0, _TIF_SYSCALL_WORK |
| 225 | bnez t0, handle_syscall_trace_exit | 229 | bnez t0, handle_syscall_trace_exit |
| 226 | 230 | ||
| 227 | ret_from_exception: | 231 | ret_from_exception: |
| 228 | REG_L s0, PT_SSTATUS(sp) | 232 | REG_L s0, PT_SSTATUS(sp) |
| 229 | csrc sstatus, SR_SIE | 233 | csrc sstatus, SR_SIE |
| 230 | andi s0, s0, SR_SPP | 234 | andi s0, s0, SR_SPP |
| 231 | bnez s0, restore_all | 235 | bnez s0, resume_kernel |
| 232 | 236 | ||
| 233 | resume_userspace: | 237 | resume_userspace: |
| 234 | /* Interrupts must be disabled here so flags are checked atomically */ | 238 | /* Interrupts must be disabled here so flags are checked atomically */ |
| @@ -250,6 +254,18 @@ restore_all: · 15 unmodified lines | |||
| 250 | RESTORE_ALL | 254 | RESTORE_ALL |
| 251 | sret | 255 | sret |
| 252 | 256 | ||
| 257 | #if IS_ENABLED(CONFIG_PREEMPT) | ||
| 258 | resume_kernel: | ||
| 259 | REG_L s0, TASK_TI_PREEMPT_COUNT(tp) | ||
| 260 | bnez s0, restore_all | ||
| 261 | need_resched: | ||
| 262 | REG_L s0, TASK_TI_FLAGS(tp) | ||
| 263 | andi s0, s0, _TIF_NEED_RESCHED | ||
| 264 | beqz s0, restore_all | ||
| 265 | call preempt_schedule_irq | ||
| 266 | j need_resched | ||
| 267 | #endif | ||
| 268 | |||
| 253 | work_pending: | 269 | work_pending: |
| 254 | /* Enter slow path for supplementary processing */ | 270 | /* Enter slow path for supplementary processing */ |
| 255 | la ra, ret_from_exception | 271 | la ra, ret_from_exception |
| @@ -9,14 +9,14 @@ · 8 unmodified lines | |||
| 9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
| 10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| 11 | 11 | ||
| 12 | u64 module_emit_got_entry(struct module *mod, u64 val) | 12 | unsigned long module_emit_got_entry(struct module *mod, unsigned long val) |
| 13 | { | 13 | { |
| 14 | struct mod_section *got_sec = &mod->arch.got; | 14 | struct mod_section *got_sec = &mod->arch.got; |
| 15 | int i = got_sec->num_entries; | 15 | int i = got_sec->num_entries; |
| 16 | struct got_entry *got = get_got_entry(val, got_sec); | 16 | struct got_entry *got = get_got_entry(val, got_sec); |
| 17 | 17 | ||
| 18 | if (got) | 18 | if (got) |
| 19 | return (u64)got; | 19 | return (unsigned long)got; |
| 20 | 20 | ||
| 21 | /* There is no duplicate entry, create a new one */ | 21 | /* There is no duplicate entry, create a new one */ |
| 22 | got = (struct got_entry *)got_sec->shdr->sh_addr; | 22 | got = (struct got_entry *)got_sec->shdr->sh_addr; |
| @@ -25,10 +25,10 @@ u64 module_emit_got_entry(struct module *mod, u64 val) · 2 unmodified lines | |||
| 25 | got_sec->num_entries++; | 25 | got_sec->num_entries++; |
| 26 | BUG_ON(got_sec->num_entries > got_sec->max_entries); | 26 | BUG_ON(got_sec->num_entries > got_sec->max_entries); |
| 27 | 27 | ||
| 28 | return (u64)&got[i]; | 28 | return (unsigned long)&got[i]; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | u64 module_emit_plt_entry(struct module *mod, u64 val) | 31 | unsigned long module_emit_plt_entry(struct module *mod, unsigned long val) |
| 32 | { | 32 | { |
| 33 | struct mod_section *got_plt_sec = &mod->arch.got_plt; | 33 | struct mod_section *got_plt_sec = &mod->arch.got_plt; |
| 34 | struct got_entry *got_plt; | 34 | struct got_entry *got_plt; |
| @@ -37,27 +37,29 @@ u64 module_emit_plt_entry(struct module *mod, u64 val) · 2 unmodified lines | |||
| 37 | int i = plt_sec->num_entries; | 37 | int i = plt_sec->num_entries; |
| 38 | 38 | ||
| 39 | if (plt) | 39 | if (plt) |
| 40 | return (u64)plt; | 40 | return (unsigned long)plt; |
| 41 | 41 | ||
| 42 | /* There is no duplicate entry, create a new one */ | 42 | /* There is no duplicate entry, create a new one */ |
| 43 | got_plt = (struct got_entry *)got_plt_sec->shdr->sh_addr; | 43 | got_plt = (struct got_entry *)got_plt_sec->shdr->sh_addr; |
| 44 | got_plt[i] = emit_got_entry(val); | 44 | got_plt[i] = emit_got_entry(val); |
| 45 | plt = (struct plt_entry *)plt_sec->shdr->sh_addr; | 45 | plt = (struct plt_entry *)plt_sec->shdr->sh_addr; |
| 46 | plt[i] = emit_plt_entry(val, (u64)&plt[i], (u64)&got_plt[i]); | 46 | plt[i] = emit_plt_entry(val, |
| 47 | (unsigned long)&plt[i], | ||
| 48 | (unsigned long)&got_plt[i]); | ||
| 47 | 49 | ||
| 48 | plt_sec->num_entries++; | 50 | plt_sec->num_entries++; |
| 49 | got_plt_sec->num_entries++; | 51 | got_plt_sec->num_entries++; |
| 50 | BUG_ON(plt_sec->num_entries > plt_sec->max_entries); | 52 | BUG_ON(plt_sec->num_entries > plt_sec->max_entries); |
| 51 | 53 | ||
| 52 | return (u64)&plt[i]; | 54 | return (unsigned long)&plt[i]; |
| 53 | } | 55 | } |
| 54 | 56 | ||
| 55 | static int is_rela_equal(const Elf64_Rela *x, const Elf64_Rela *y) | 57 | static int is_rela_equal(const Elf_Rela *x, const Elf_Rela *y) |
| 56 | { | 58 | { |
| 57 | return x->r_info == y->r_info && x->r_addend == y->r_addend; | 59 | return x->r_info == y->r_info && x->r_addend == y->r_addend; |
| 58 | } | 60 | } |
| 59 | 61 | ||
| 60 | static bool duplicate_rela(const Elf64_Rela *rela, int idx) | 62 | static bool duplicate_rela(const Elf_Rela *rela, int idx) |
| 61 | { | 63 | { |
| 62 | int i; | 64 | int i; |
| 63 | for (i = 0; i < idx; i++) { | 65 | for (i = 0; i < idx; i++) { |
| @@ -67,13 +69,13 @@ static bool duplicate_rela(const Elf64_Rela *rela, int idx) · 3 unmodified lines | |||
| 67 | return false; | 69 | return false; |
| 68 | } | 70 | } |
| 69 | 71 | ||
| 70 | static void count_max_entries(Elf64_Rela *relas, int num, | 72 | static void count_max_entries(Elf_Rela *relas, int num, |
| 71 | unsigned int *plts, unsigned int *gots) | 73 | unsigned int *plts, unsigned int *gots) |
| 72 | { | 74 | { |
| 73 | unsigned int type, i; | 75 | unsigned int type, i; |
| 74 | 76 | ||
| 75 | for (i = 0; i < num; i++) { | 77 | for (i = 0; i < num; i++) { |
| 76 | type = ELF64_R_TYPE(relas[i].r_info); | 78 | type = ELF_RISCV_R_TYPE(relas[i].r_info); |
| 77 | if (type == R_RISCV_CALL_PLT) { | 79 | if (type == R_RISCV_CALL_PLT) { |
| 78 | if (!duplicate_rela(relas, i)) | 80 | if (!duplicate_rela(relas, i)) |
| 79 | (*plts)++; | 81 | (*plts)++; |
| @@ -118,9 +120,9 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, · 38 unmodified lines | |||
| 118 | 120 | ||
| 119 | /* Calculate the maxinum number of entries */ | 121 | /* Calculate the maxinum number of entries */ |
| 120 | for (i = 0; i < ehdr->e_shnum; i++) { | 122 | for (i = 0; i < ehdr->e_shnum; i++) { |
| 121 | Elf64_Rela *relas = (void *)ehdr + sechdrs[i].sh_offset; | 123 | Elf_Rela *relas = (void *)ehdr + sechdrs[i].sh_offset; |
| 122 | int num_rela = sechdrs[i].sh_size / sizeof(Elf64_Rela); | 124 | int num_rela = sechdrs[i].sh_size / sizeof(Elf_Rela); |
| 123 | Elf64_Shdr *dst_sec = sechdrs + sechdrs[i].sh_info; | 125 | Elf_Shdr *dst_sec = sechdrs + sechdrs[i].sh_info; |
| 124 | 126 | ||
| 125 | if (sechdrs[i].sh_type != SHT_RELA) | 127 | if (sechdrs[i].sh_type != SHT_RELA) |
| 126 | continue; | 128 | continue; |
| @@ -18,12 +18,15 @@ · 17 unmodified lines | |||
| 18 | #include <asm/ptrace.h> | 18 | #include <asm/ptrace.h> |
| 19 | #include <asm/syscall.h> | 19 | #include <asm/syscall.h> |
| 20 | #include <asm/thread_info.h> | 20 | #include <asm/thread_info.h> |
| 21 | #include <linux/audit.h> | ||
| 21 | #include <linux/ptrace.h> | 22 | #include <linux/ptrace.h> |
| 22 | #include <linux/elf.h> | 23 | #include <linux/elf.h> |
| 23 | #include <linux/regset.h> | 24 | #include <linux/regset.h> |
| 24 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
| 25 | #include <linux/sched/task_stack.h> | 26 | #include <linux/sched/task_stack.h> |
| 26 | #include <linux/tracehook.h> | 27 | #include <linux/tracehook.h> |
| 28 | |||
| 29 | #define CREATE_TRACE_POINTS | ||
| 27 | #include <trace/events/syscalls.h> | 30 | #include <trace/events/syscalls.h> |
| 28 | 31 | ||
| 29 | enum riscv_regset { | 32 | enum riscv_regset { |
| @@ -163,15 +166,19 @@ void do_syscall_trace_enter(struct pt_regs *regs) · 133 unmodified lines | |||
| 163 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) | 166 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) |
| 164 | trace_sys_enter(regs, syscall_get_nr(current, regs)); | 167 | trace_sys_enter(regs, syscall_get_nr(current, regs)); |
| 165 | #endif | 168 | #endif |
| 169 | |||
| 170 | audit_syscall_entry(regs->a7, regs->a0, regs->a1, regs->a2, regs->a3); | ||
| 166 | } | 171 | } |
| 167 | 172 | ||
| 168 | void do_syscall_trace_exit(struct pt_regs *regs) | 173 | void do_syscall_trace_exit(struct pt_regs *regs) |
| 169 | { | 174 | { |
| 175 | audit_syscall_exit(regs); | ||
| 176 | |||
| 170 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | 177 | if (test_thread_flag(TIF_SYSCALL_TRACE)) |
| 171 | tracehook_report_syscall_exit(regs, 0); | 178 | tracehook_report_syscall_exit(regs, 0); |
| 172 | 179 | ||
| 173 | #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS | 180 | #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS |
| 174 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) | 181 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) |
| 175 | trace_sys_exit(regs, regs->regs[0]); | 182 | trace_sys_exit(regs, regs_return_value(regs)); |
| 176 | #endif | 183 | #endif |
| 177 | } | 184 | } |
| @@ -149,7 +149,14 @@ asmlinkage void __init setup_vm(void) · 148 unmodified lines | |||
| 149 | 149 | ||
| 150 | void __init parse_dtb(unsigned int hartid, void *dtb) | 150 | void __init parse_dtb(unsigned int hartid, void *dtb) |
| 151 | { | 151 | { |
| 152 | early_init_dt_scan(__va(dtb)); | 152 | if (!early_init_dt_scan(__va(dtb))) |
| 153 | return; | ||
| 154 | |||
| 155 | pr_err("No DTB passed to the kernel\n"); | ||
| 156 | #ifdef CONFIG_CMDLINE_FORCE | ||
| 157 | strlcpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); | ||
| 158 | pr_info("Forcing kernel command line to: %s\n", boot_command_line); | ||
| 159 | #endif | ||
| 153 | } | 160 | } |
| 154 | 161 | ||
| 155 | static void __init setup_bootmem(void) | 162 | static void __init setup_bootmem(void) |
| @@ -174,7 +181,7 @@ static void __init setup_bootmem(void) · 18 unmodified lines | |||
| 174 | BUG_ON(mem_size == 0); | 181 | BUG_ON(mem_size == 0); |
| 175 | 182 | ||
| 176 | set_max_mapnr(PFN_DOWN(mem_size)); | 183 | set_max_mapnr(PFN_DOWN(mem_size)); |
| 177 | max_low_pfn = memblock_end_of_DRAM(); | 184 | max_low_pfn = PFN_DOWN(memblock_end_of_DRAM()); |
| 178 | 185 | ||
| 179 | #ifdef CONFIG_BLK_DEV_INITRD | 186 | #ifdef CONFIG_BLK_DEV_INITRD |
| 180 | setup_initrd(); | 187 | setup_initrd(); |
| @@ -23,6 +23,7 @@ · 22 unmodified lines | |||
| 23 | #include <linux/smp.h> | 23 | #include <linux/smp.h> |
| 24 | #include <linux/sched.h> | 24 | #include <linux/sched.h> |
| 25 | #include <linux/seq_file.h> | 25 | #include <linux/seq_file.h> |
| 26 | #include <linux/delay.h> | ||
| 26 | 27 | ||
| 27 | #include <asm/sbi.h> | 28 | #include <asm/sbi.h> |
| 28 | #include <asm/tlbflush.h> | 29 | #include <asm/tlbflush.h> |
| @@ -31,6 +32,7 @@ · 2 unmodified lines | |||
| 31 | enum ipi_message_type { | 32 | enum ipi_message_type { |
| 32 | IPI_RESCHEDULE, | 33 | IPI_RESCHEDULE, |
| 33 | IPI_CALL_FUNC, | 34 | IPI_CALL_FUNC, |
| 35 | IPI_CPU_STOP, | ||
| 34 | IPI_MAX | 36 | IPI_MAX |
| 35 | }; | 37 | }; |
| 36 | 38 | ||
| @@ -66,6 +68,13 @@ int setup_profiling_timer(unsigned int multiplier) · 29 unmodified lines | |||
| 66 | return -EINVAL; | 68 | return -EINVAL; |
| 67 | } | 69 | } |
| 68 | 70 | ||
| 71 | static void ipi_stop(void) | ||
| 72 | { | ||
| 73 | set_cpu_online(smp_processor_id(), false); | ||
| 74 | while (1) | ||
| 75 | wait_for_interrupt(); | ||
| 76 | } | ||
| 77 | |||
| 69 | void riscv_software_interrupt(void) | 78 | void riscv_software_interrupt(void) |
| 70 | { | 79 | { |
| 71 | unsigned long *pending_ipis = &ipi_data[smp_processor_id()].bits; | 80 | unsigned long *pending_ipis = &ipi_data[smp_processor_id()].bits; |
| @@ -94,6 +103,11 @@ void riscv_software_interrupt(void) · 22 unmodified lines | |||
| 94 | generic_smp_call_function_interrupt(); | 103 | generic_smp_call_function_interrupt(); |
| 95 | } | 104 | } |
| 96 | 105 | ||
| 106 | if (ops & (1 << IPI_CPU_STOP)) { | ||
| 107 | stats[IPI_CPU_STOP]++; | ||
| 108 | ipi_stop(); | ||
| 109 | } | ||
| 110 | |||
| 97 | BUG_ON((ops >> IPI_MAX) != 0); | 111 | BUG_ON((ops >> IPI_MAX) != 0); |
| 98 | 112 | ||
| 99 | /* Order data access and bit testing. */ | 113 | /* Order data access and bit testing. */ |
| @@ -121,6 +135,7 @@ send_ipi_message(const struct cpumask *to_whom, enum ipi_message_type operation) · 21 unmodified lines | |||
| 121 | static const char * const ipi_names[] = { | 135 | static const char * const ipi_names[] = { |
| 122 | [IPI_RESCHEDULE] = "Rescheduling interrupts", | 136 | [IPI_RESCHEDULE] = "Rescheduling interrupts", |
| 123 | [IPI_CALL_FUNC] = "Function call interrupts", | 137 | [IPI_CALL_FUNC] = "Function call interrupts", |
| 138 | [IPI_CPU_STOP] = "CPU stop interrupts", | ||
| 124 | }; | 139 | }; |
| 125 | 140 | ||
| 126 | void show_ipi_stats(struct seq_file *p, int prec) | 141 | void show_ipi_stats(struct seq_file *p, int prec) |
| @@ -146,15 +161,29 @@ void arch_send_call_function_single_ipi(int cpu) · 19 unmodified lines | |||
| 146 | send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC); | 161 | send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC); |
| 147 | } | 162 | } |
| 148 | 163 | ||
| 149 | static void ipi_stop(void *unused) | ||
| 150 | { | ||
| 151 | while (1) | ||
| 152 | wait_for_interrupt(); | ||
| 153 | } | ||
| 154 | |||
| 155 | void smp_send_stop(void) | 164 | void smp_send_stop(void) |
| 156 | { | 165 | { |
| 157 | on_each_cpu(ipi_stop, NULL, 1); | 166 | unsigned long timeout; |
| 167 | |||
| 168 | if (num_online_cpus() > 1) { | ||
| 169 | cpumask_t mask; | ||
| 170 | |||
| 171 | cpumask_copy(&mask, cpu_online_mask); | ||
| 172 | cpumask_clear_cpu(smp_processor_id(), &mask); | ||
| 173 | |||
| 174 | if (system_state <= SYSTEM_RUNNING) | ||
| 175 | pr_crit("SMP: stopping secondary CPUs\n"); | ||
| 176 | send_ipi_message(&mask, IPI_CPU_STOP); | ||
| 177 | } | ||
| 178 | |||
| 179 | /* Wait up to one second for other CPUs to stop */ | ||
| 180 | timeout = USEC_PER_SEC; | ||
| 181 | while (num_online_cpus() > 1 && timeout--) | ||
| 182 | udelay(1); | ||
| 183 | |||
| 184 | if (num_online_cpus() > 1) | ||
| 185 | pr_warn("SMP: failed to stop secondary CPUs %*pbl\n", | ||
| 186 | cpumask_pr_args(cpu_online_mask)); | ||
| 158 | } | 187 | } |
| 159 | 188 | ||
| 160 | void smp_send_reschedule(int cpu) | 189 | void smp_send_reschedule(int cpu) |
| @@ -57,15 +57,12 @@ void __init setup_smp(void) · 56 unmodified lines | |||
| 57 | 57 | ||
| 58 | while ((dn = of_find_node_by_type(dn, "cpu"))) { | 58 | while ((dn = of_find_node_by_type(dn, "cpu"))) { |
| 59 | hart = riscv_of_processor_hartid(dn); | 59 | hart = riscv_of_processor_hartid(dn); |
| 60 | if (hart < 0) { | 60 | if (hart < 0) |
| 61 | of_node_put(dn); | ||
| 62 | continue; | 61 | continue; |
| 63 | } | ||
| 64 | 62 | ||
| 65 | if (hart == cpuid_to_hartid_map(0)) { | 63 | if (hart == cpuid_to_hartid_map(0)) { |
| 66 | BUG_ON(found_boot_cpu); | 64 | BUG_ON(found_boot_cpu); |
| 67 | found_boot_cpu = 1; | 65 | found_boot_cpu = 1; |
| 68 | of_node_put(dn); | ||
| 69 | continue; | 66 | continue; |
| 70 | } | 67 | } |
| 71 | 68 | ||
| @@ -73,7 +70,6 @@ void __init setup_smp(void) · 1 unmodified line | |||
| 73 | set_cpu_possible(cpuid, true); | 70 | set_cpu_possible(cpuid, true); |
| 74 | set_cpu_present(cpuid, true); | 71 | set_cpu_present(cpuid, true); |
| 75 | cpuid++; | 72 | cpuid++; |
| 76 | of_node_put(dn); | ||
| 77 | } | 73 | } |
| 78 | 74 | ||
| 79 | BUG_ON(!found_boot_cpu); | 75 | BUG_ON(!found_boot_cpu); |
| @@ -18,6 +18,8 @@ · 17 unmodified lines | |||
| 18 | #include <asm/cache.h> | 18 | #include <asm/cache.h> |
| 19 | #include <asm/thread_info.h> | 19 | #include <asm/thread_info.h> |
| 20 | 20 | ||
| 21 | #define MAX_BYTES_PER_LONG 0x10 | ||
| 22 | |||
| 21 | OUTPUT_ARCH(riscv) | 23 | OUTPUT_ARCH(riscv) |
| 22 | ENTRY(_start) | 24 | ENTRY(_start) |
| 23 | 25 | ||
| @@ -74,8 +76,6 @@ SECTIONS · 50 unmodified lines | |||
| 74 | *(.sbss*) | 76 | *(.sbss*) |
| 75 | } | 77 | } |
| 76 | 78 | ||
| 77 | BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0) | ||
| 78 | |||
| 79 | EXCEPTION_TABLE(0x10) | 79 | EXCEPTION_TABLE(0x10) |
| 80 | NOTES | 80 | NOTES |
| 81 | 81 | ||
| @@ -83,6 +83,10 @@ SECTIONS · 1 unmodified line | |||
| 83 | *(.rel.dyn*) | 83 | *(.rel.dyn*) |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | BSS_SECTION(MAX_BYTES_PER_LONG, | ||
| 87 | MAX_BYTES_PER_LONG, | ||
| 88 | MAX_BYTES_PER_LONG) | ||
| 89 | |||
| 86 | _end = .; | 90 | _end = .; |
| 87 | 91 | ||
| 88 | STABS_DEBUG | 92 | STABS_DEBUG |
| @@ -28,7 +28,8 @@ static void __init zone_sizes_init(void) · 27 unmodified lines | |||
| 28 | unsigned long max_zone_pfns[MAX_NR_ZONES] = { 0, }; | 28 | unsigned long max_zone_pfns[MAX_NR_ZONES] = { 0, }; |
| 29 | 29 | ||
| 30 | #ifdef CONFIG_ZONE_DMA32 | 30 | #ifdef CONFIG_ZONE_DMA32 |
| 31 | max_zone_pfns[ZONE_DMA32] = PFN_DOWN(min(4UL * SZ_1G, max_low_pfn)); | 31 | max_zone_pfns[ZONE_DMA32] = PFN_DOWN(min(4UL * SZ_1G, |
| 32 | (unsigned long) PFN_PHYS(max_low_pfn))); | ||
| 32 | #endif | 33 | #endif |
| 33 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; | 34 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; |
| 34 | 35 | ||
| @@ -25,7 +25,7 @@ static inline int init_new_context(struct task_struct *tsk, · 24 unmodified lines | |||
| 25 | atomic_set(&mm->context.flush_count, 0); | 25 | atomic_set(&mm->context.flush_count, 0); |
| 26 | mm->context.gmap_asce = 0; | 26 | mm->context.gmap_asce = 0; |
| 27 | mm->context.flush_mm = 0; | 27 | mm->context.flush_mm = 0; |
| 28 | mm->context.compat_mm = 0; | 28 | mm->context.compat_mm = test_thread_flag(TIF_31BIT); |
| 29 | #ifdef CONFIG_PGSTE | 29 | #ifdef CONFIG_PGSTE |
| 30 | mm->context.alloc_pgste = page_table_allocate_pgste || | 30 | mm->context.alloc_pgste = page_table_allocate_pgste || |
| 31 | test_thread_flag(TIF_PGSTE) || | 31 | test_thread_flag(TIF_PGSTE) || |
| @@ -90,8 +90,6 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, · 58 unmodified lines | |||
| 90 | { | 90 | { |
| 91 | int cpu = smp_processor_id(); | 91 | int cpu = smp_processor_id(); |
| 92 | 92 | ||
| 93 | if (prev == next) | ||
| 94 | return; | ||
| 95 | S390_lowcore.user_asce = next->context.asce; | 93 | S390_lowcore.user_asce = next->context.asce; |
| 96 | cpumask_set_cpu(cpu, &next->context.cpu_attach_mask); | 94 | cpumask_set_cpu(cpu, &next->context.cpu_attach_mask); |
| 97 | /* Clear previous user-ASCE from CR1 and CR7 */ | 95 | /* Clear previous user-ASCE from CR1 and CR7 */ |
| @@ -103,7 +101,8 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, · 5 unmodified lines | |||
| 103 | __ctl_load(S390_lowcore.vdso_asce, 7, 7); | 101 | __ctl_load(S390_lowcore.vdso_asce, 7, 7); |
| 104 | clear_cpu_flag(CIF_ASCE_SECONDARY); | 102 | clear_cpu_flag(CIF_ASCE_SECONDARY); |
| 105 | } | 103 | } |
| 106 | cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask); | 104 | if (prev != next) |
| 105 | cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask); | ||
| 107 | } | 106 | } |
| 108 | 107 | ||
| 109 | #define finish_arch_post_lock_switch finish_arch_post_lock_switch | 108 | #define finish_arch_post_lock_switch finish_arch_post_lock_switch |
| @@ -63,10 +63,10 @@ static noinline __init void detect_machine_type(void) · 62 unmodified lines | |||
| 63 | if (stsi(vmms, 3, 2, 2) || !vmms->count) | 63 | if (stsi(vmms, 3, 2, 2) || !vmms->count) |
| 64 | return; | 64 | return; |
| 65 | 65 | ||
| 66 | /* Running under KVM? If not we assume z/VM */ | 66 | /* Detect known hypervisors */ |
| 67 | if (!memcmp(vmms->vm[0].cpi, "\xd2\xe5\xd4", 3)) | 67 | if (!memcmp(vmms->vm[0].cpi, "\xd2\xe5\xd4", 3)) |
| 68 | S390_lowcore.machine_flags |= MACHINE_FLAG_KVM; | 68 | S390_lowcore.machine_flags |= MACHINE_FLAG_KVM; |
| 69 | else | 69 | else if (!memcmp(vmms->vm[0].cpi, "\xa9\x61\xe5\xd4", 4)) |
| 70 | S390_lowcore.machine_flags |= MACHINE_FLAG_VM; | 70 | S390_lowcore.machine_flags |= MACHINE_FLAG_VM; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| @@ -1006,6 +1006,8 @@ void __init setup_arch(char **cmdline_p) · 1005 unmodified lines | |||
| 1006 | pr_info("Linux is running under KVM in 64-bit mode\n"); | 1006 | pr_info("Linux is running under KVM in 64-bit mode\n"); |
| 1007 | else if (MACHINE_IS_LPAR) | 1007 | else if (MACHINE_IS_LPAR) |
| 1008 | pr_info("Linux is running natively in 64-bit mode\n"); | 1008 | pr_info("Linux is running natively in 64-bit mode\n"); |
| 1009 | else | ||
| 1010 | pr_info("Linux is running as a guest in 64-bit mode\n"); | ||
| 1009 | 1011 | ||
| 1010 | /* Have one command line that is parsed and saved in /proc/cmdline */ | 1012 | /* Have one command line that is parsed and saved in /proc/cmdline */ |
| 1011 | /* boot_command_line has been already set up in early.c */ | 1013 | /* boot_command_line has been already set up in early.c */ |
| @@ -381,8 +381,13 @@ void smp_call_online_cpu(void (*func)(void *), void *data) · 380 unmodified lines | |||
| 381 | */ | 381 | */ |
| 382 | void smp_call_ipl_cpu(void (*func)(void *), void *data) | 382 | void smp_call_ipl_cpu(void (*func)(void *), void *data) |
| 383 | { | 383 | { |
| 384 | struct lowcore *lc = pcpu_devices->lowcore; | ||
| 385 | |||
| 386 | if (pcpu_devices[0].address == stap()) | ||
| 387 | lc = &S390_lowcore; | ||
| 388 | |||
| 384 | pcpu_delegate(&pcpu_devices[0], func, data, | 389 | pcpu_delegate(&pcpu_devices[0], func, data, |
| 385 | pcpu_devices->lowcore->nodat_stack); | 390 | lc->nodat_stack); |
| 386 | } | 391 | } |
| 387 | 392 | ||
| 388 | int smp_find_processor_id(u16 address) | 393 | int smp_find_processor_id(u16 address) |
| @@ -1166,7 +1171,11 @@ static ssize_t __ref rescan_store(struct device *dev, · 777 unmodified lines | |||
| 1166 | { | 1171 | { |
| 1167 | int rc; | 1172 | int rc; |
| 1168 | 1173 | ||
| 1174 | rc = lock_device_hotplug_sysfs(); | ||
| 1175 | if (rc) | ||
| 1176 | return rc; | ||
| 1169 | rc = smp_rescan_cpus(); | 1177 | rc = smp_rescan_cpus(); |
| 1178 | unlock_device_hotplug(); | ||
| 1170 | return rc ? rc : count; | 1179 | return rc ? rc : count; |
| 1171 | } | 1180 | } |
| 1172 | static DEVICE_ATTR_WO(rescan); | 1181 | static DEVICE_ATTR_WO(rescan); |
| @@ -224,10 +224,9 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) · 223 unmodified lines | |||
| 224 | 224 | ||
| 225 | vdso_pages = vdso64_pages; | 225 | vdso_pages = vdso64_pages; |
| 226 | #ifdef CONFIG_COMPAT | 226 | #ifdef CONFIG_COMPAT |
| 227 | if (is_compat_task()) { | 227 | mm->context.compat_mm = is_compat_task(); |
| 228 | if (mm->context.compat_mm) | ||
| 228 | vdso_pages = vdso32_pages; | 229 | vdso_pages = vdso32_pages; |
| 229 | mm->context.compat_mm = 1; | ||
| 230 | } | ||
| 231 | #endif | 230 | #endif |
| 232 | /* | 231 | /* |
| 233 | * vDSO has a problem and was disabled, just don't "enable" it for | 232 | * vDSO has a problem and was disabled, just don't "enable" it for |
| @@ -28,6 +28,7 @@ generic-y += preempt.h · 27 unmodified lines | |||
| 28 | generic-y += sections.h | 28 | generic-y += sections.h |
| 29 | generic-y += segment.h | 29 | generic-y += segment.h |
| 30 | generic-y += serial.h | 30 | generic-y += serial.h |
| 31 | generic-y += shmparam.h | ||
| 31 | generic-y += sizes.h | 32 | generic-y += sizes.h |
| 32 | generic-y += syscalls.h | 33 | generic-y += syscalls.h |
| 33 | generic-y += topology.h | 34 | generic-y += topology.h |
| @@ -198,7 +198,7 @@ config X86 · 197 unmodified lines | |||
| 198 | select IRQ_FORCED_THREADING | 198 | select IRQ_FORCED_THREADING |
| 199 | select NEED_SG_DMA_LENGTH | 199 | select NEED_SG_DMA_LENGTH |
| 200 | select PCI_DOMAINS if PCI | 200 | select PCI_DOMAINS if PCI |
| 201 | select PCI_LOCKLESS_CONFIG | 201 | select PCI_LOCKLESS_CONFIG if PCI |
| 202 | select PERF_EVENTS | 202 | select PERF_EVENTS |
| 203 | select RTC_LIB | 203 | select RTC_LIB |
| 204 | select RTC_MC146818_LIB | 204 | select RTC_MC146818_LIB |
| @@ -446,12 +446,12 @@ config RETPOLINE · 241 unmodified lines | |||
| 446 | branches. Requires a compiler with -mindirect-branch=thunk-extern | 446 | branches. Requires a compiler with -mindirect-branch=thunk-extern |
| 447 | support for full protection. The kernel may run slower. | 447 | support for full protection. The kernel may run slower. |
| 448 | 448 | ||
| 449 | config RESCTRL | 449 | config X86_CPU_RESCTRL |
| 450 | bool "Resource Control support" | 450 | bool "x86 CPU resource control support" |
| 451 | depends on X86 && (CPU_SUP_INTEL || CPU_SUP_AMD) | 451 | depends on X86 && (CPU_SUP_INTEL || CPU_SUP_AMD) |
| 452 | select KERNFS | 452 | select KERNFS |
| 453 | help | 453 | help |
| 454 | Enable Resource Control support. | 454 | Enable x86 CPU resource control support. |
| 455 | 455 | ||
| 456 | Provide support for the allocation and monitoring of system resources | 456 | Provide support for the allocation and monitoring of system resources |
| 457 | usage by the CPU. | 457 | usage by the CPU. |
| @@ -617,7 +617,7 @@ config X86_INTEL_QUARK · 159 unmodified lines | |||
| 617 | 617 | ||
| 618 | config X86_INTEL_LPSS | 618 | config X86_INTEL_LPSS |
| 619 | bool "Intel Low Power Subsystem Support" | 619 | bool "Intel Low Power Subsystem Support" |
| 620 | depends on X86 && ACPI | 620 | depends on X86 && ACPI && PCI |
| 621 | select COMMON_CLK | 621 | select COMMON_CLK |
| 622 | select PINCTRL | 622 | select PINCTRL |
| 623 | select IOSF_MBI | 623 | select IOSF_MBI |
| @@ -600,6 +600,16 @@ ENTRY(trampoline_32bit_src) · 599 unmodified lines | |||
| 600 | leal TRAMPOLINE_32BIT_PGTABLE_OFFSET(%ecx), %eax | 600 | leal TRAMPOLINE_32BIT_PGTABLE_OFFSET(%ecx), %eax |
| 601 | movl %eax, %cr3 | 601 | movl %eax, %cr3 |
| 602 | 3: | 602 | 3: |
| 603 | /* Set EFER.LME=1 as a precaution in case hypervsior pulls the rug */ | ||
| 604 | pushl %ecx | ||
| 605 | pushl %edx | ||
| 606 | movl $MSR_EFER, %ecx | ||
| 607 | rdmsr | ||
| 608 | btsl $_EFER_LME, %eax | ||
| 609 | wrmsr | ||
| 610 | popl %edx | ||
| 611 | popl %ecx | ||
| 612 | |||
| 603 | /* Enable PAE and LA57 (if required) paging modes */ | 613 | /* Enable PAE and LA57 (if required) paging modes */ |
| 604 | movl $X86_CR4_PAE, %eax | 614 | movl $X86_CR4_PAE, %eax |
| 605 | cmpl $0, %edx | 615 | cmpl $0, %edx |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | #define TRAMPOLINE_32BIT_PGTABLE_OFFSET 0 | 6 | #define TRAMPOLINE_32BIT_PGTABLE_OFFSET 0 |
| 7 | 7 | ||
| 8 | #define TRAMPOLINE_32BIT_CODE_OFFSET PAGE_SIZE | 8 | #define TRAMPOLINE_32BIT_CODE_OFFSET PAGE_SIZE |
| 9 | #define TRAMPOLINE_32BIT_CODE_SIZE 0x60 | 9 | #define TRAMPOLINE_32BIT_CODE_SIZE 0x70 |
| 10 | 10 | ||
| 11 | #define TRAMPOLINE_32BIT_STACK_END TRAMPOLINE_32BIT_SIZE | 11 | #define TRAMPOLINE_32BIT_STACK_END TRAMPOLINE_32BIT_SIZE |
| 12 | 12 | ||
| @@ -361,7 +361,8 @@ ENTRY(entry_INT80_compat) · 360 unmodified lines | |||
| 361 | 361 | ||
| 362 | /* Need to switch before accessing the thread stack. */ | 362 | /* Need to switch before accessing the thread stack. */ |
| 363 | SWITCH_TO_KERNEL_CR3 scratch_reg=%rdi | 363 | SWITCH_TO_KERNEL_CR3 scratch_reg=%rdi |
| 364 | movq %rsp, %rdi | 364 | /* In the Xen PV case we already run on the thread stack. */ |
| 365 | ALTERNATIVE "movq %rsp, %rdi", "jmp .Lint80_keep_stack", X86_FEATURE_XENPV | ||
| 365 | movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp | 366 | movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp |
| 366 | 367 | ||
| 367 | pushq 6*8(%rdi) /* regs->ss */ | 368 | pushq 6*8(%rdi) /* regs->ss */ |
| @@ -370,8 +371,9 @@ ENTRY(entry_INT80_compat) · 2 unmodified lines | |||
| 370 | pushq 3*8(%rdi) /* regs->cs */ | 371 | pushq 3*8(%rdi) /* regs->cs */ |
| 371 | pushq 2*8(%rdi) /* regs->ip */ | 372 | pushq 2*8(%rdi) /* regs->ip */ |
| 372 | pushq 1*8(%rdi) /* regs->orig_ax */ | 373 | pushq 1*8(%rdi) /* regs->orig_ax */ |
| 373 | |||
| 374 | pushq (%rdi) /* pt_regs->di */ | 374 | pushq (%rdi) /* pt_regs->di */ |
| 375 | .Lint80_keep_stack: | ||
| 376 | |||
| 375 | pushq %rsi /* pt_regs->si */ | 377 | pushq %rsi /* pt_regs->si */ |
| 376 | xorl %esi, %esi /* nospec si */ | 378 | xorl %esi, %esi /* nospec si */ |
| 377 | pushq %rdx /* pt_regs->dx */ | 379 | pushq %rdx /* pt_regs->dx */ |
| @@ -3558,6 +3558,14 @@ static void free_excl_cntrs(int cpu) · 3557 unmodified lines | |||
| 3558 | } | 3558 | } |
| 3559 | 3559 | ||
| 3560 | static void intel_pmu_cpu_dying(int cpu) | 3560 | static void intel_pmu_cpu_dying(int cpu) |
| 3561 | { | ||
| 3562 | fini_debug_store_on_cpu(cpu); | ||
| 3563 | |||
| 3564 | if (x86_pmu.counter_freezing) | ||
| 3565 | disable_counter_freeze(); | ||
| 3566 | } | ||
| 3567 | |||
| 3568 | static void intel_pmu_cpu_dead(int cpu) | ||
| 3561 | { | 3569 | { |
| 3562 | struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); | 3570 | struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); |
| 3563 | struct intel_shared_regs *pc; | 3571 | struct intel_shared_regs *pc; |
| @@ -3570,11 +3578,6 @@ static void intel_pmu_cpu_dying(int cpu) · 6 unmodified lines | |||
| 3570 | } | 3578 | } |
| 3571 | 3579 | ||
| 3572 | free_excl_cntrs(cpu); | 3580 | free_excl_cntrs(cpu); |
| 3573 | |||
| 3574 | fini_debug_store_on_cpu(cpu); | ||
| 3575 | |||
| 3576 | if (x86_pmu.counter_freezing) | ||
| 3577 | disable_counter_freeze(); | ||
| 3578 | } | 3581 | } |
| 3579 | 3582 | ||
| 3580 | static void intel_pmu_sched_task(struct perf_event_context *ctx, | 3583 | static void intel_pmu_sched_task(struct perf_event_context *ctx, |
| @@ -3663,6 +3666,7 @@ static __initconst const struct x86_pmu core_pmu = { · 82 unmodified lines | |||
| 3663 | .cpu_prepare = intel_pmu_cpu_prepare, | 3666 | .cpu_prepare = intel_pmu_cpu_prepare, |
| 3664 | .cpu_starting = intel_pmu_cpu_starting, | 3667 | .cpu_starting = intel_pmu_cpu_starting, |
| 3665 | .cpu_dying = intel_pmu_cpu_dying, | 3668 | .cpu_dying = intel_pmu_cpu_dying, |
| 3669 | .cpu_dead = intel_pmu_cpu_dead, | ||
| 3666 | }; | 3670 | }; |
| 3667 | 3671 | ||
| 3668 | static struct attribute *intel_pmu_attrs[]; | 3672 | static struct attribute *intel_pmu_attrs[]; |
| @@ -3703,6 +3707,8 @@ static __initconst const struct x86_pmu intel_pmu = { · 34 unmodified lines | |||
| 3703 | .cpu_prepare = intel_pmu_cpu_prepare, | 3707 | .cpu_prepare = intel_pmu_cpu_prepare, |
| 3704 | .cpu_starting = intel_pmu_cpu_starting, | 3708 | .cpu_starting = intel_pmu_cpu_starting, |
| 3705 | .cpu_dying = intel_pmu_cpu_dying, | 3709 | .cpu_dying = intel_pmu_cpu_dying, |
| 3710 | .cpu_dead = intel_pmu_cpu_dead, | ||
| 3711 | |||
| 3706 | .guest_get_msrs = intel_guest_get_msrs, | 3712 | .guest_get_msrs = intel_guest_get_msrs, |
| 3707 | .sched_task = intel_pmu_sched_task, | 3713 | .sched_task = intel_pmu_sched_task, |
| 3708 | }; | 3714 | }; |
| @@ -1222,6 +1222,8 @@ static struct pci_driver snbep_uncore_pci_driver = { · 1221 unmodified lines | |||
| 1222 | .id_table = snbep_uncore_pci_ids, | 1222 | .id_table = snbep_uncore_pci_ids, |
| 1223 | }; | 1223 | }; |
| 1224 | 1224 | ||
| 1225 | #define NODE_ID_MASK 0x7 | ||
| 1226 | |||
| 1225 | /* | 1227 | /* |
| 1226 | * build pci bus to socket mapping | 1228 | * build pci bus to socket mapping |
| 1227 | */ | 1229 | */ |
| @@ -1243,7 +1245,7 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool · 15 unmodified lines | |||
| 1243 | err = pci_read_config_dword(ubox_dev, nodeid_loc, &config); | 1245 | err = pci_read_config_dword(ubox_dev, nodeid_loc, &config); |
| 1244 | if (err) | 1246 | if (err) |
| 1245 | break; | 1247 | break; |
| 1246 | nodeid = config; | 1248 | nodeid = config & NODE_ID_MASK; |
| 1247 | /* get the Node ID mapping */ | 1249 | /* get the Node ID mapping */ |
| 1248 | err = pci_read_config_dword(ubox_dev, idmap_loc, &config); | 1250 | err = pci_read_config_dword(ubox_dev, idmap_loc, &config); |
| 1249 | if (err) | 1251 | if (err) |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | * "Big Core" Processors (Branded as Core, Xeon, etc...) | 6 | * "Big Core" Processors (Branded as Core, Xeon, etc...) |
| 7 | * | 7 | * |
| 8 | * The "_X" parts are generally the EP and EX Xeons, or the | 8 | * The "_X" parts are generally the EP and EX Xeons, or the |
| 9 | * "Extreme" ones, like Broadwell-E. | 9 | * "Extreme" ones, like Broadwell-E, or Atom microserver. |
| 10 | * | 10 | * |
| 11 | * While adding a new CPUID for a new microarchitecture, add a new | 11 | * While adding a new CPUID for a new microarchitecture, add a new |
| 12 | * group to keep logically sorted out in chronological order. Within | 12 | * group to keep logically sorted out in chronological order. Within |
| @@ -71,6 +71,7 @@ · 58 unmodified lines | |||
| 71 | #define INTEL_FAM6_ATOM_GOLDMONT 0x5C /* Apollo Lake */ | 71 | #define INTEL_FAM6_ATOM_GOLDMONT 0x5C /* Apollo Lake */ |
| 72 | #define INTEL_FAM6_ATOM_GOLDMONT_X 0x5F /* Denverton */ | 72 | #define INTEL_FAM6_ATOM_GOLDMONT_X 0x5F /* Denverton */ |
| 73 | #define INTEL_FAM6_ATOM_GOLDMONT_PLUS 0x7A /* Gemini Lake */ | 73 | #define INTEL_FAM6_ATOM_GOLDMONT_PLUS 0x7A /* Gemini Lake */ |
| 74 | #define INTEL_FAM6_ATOM_TREMONT_X 0x86 /* Jacobsville */ | ||
| 74 | 75 | ||
| 75 | /* Xeon Phi */ | 76 | /* Xeon Phi */ |
| 76 | 77 | ||
| @@ -178,6 +178,10 @@ static inline void switch_ldt(struct mm_struct *prev, struct mm_struct *next) · 177 unmodified lines | |||
| 178 | 178 | ||
| 179 | void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk); | 179 | void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk); |
| 180 | 180 | ||
| 181 | /* | ||
| 182 | * Init a new mm. Used on mm copies, like at fork() | ||
| 183 | * and on mm's that are brand-new, like at execve(). | ||
| 184 | */ | ||
| 181 | static inline int init_new_context(struct task_struct *tsk, | 185 | static inline int init_new_context(struct task_struct *tsk, |
| 182 | struct mm_struct *mm) | 186 | struct mm_struct *mm) |
| 183 | { | 187 | { |
| @@ -228,8 +232,22 @@ do { \ · 44 unmodified lines | |||
| 228 | } while (0) | 232 | } while (0) |
| 229 | #endif | 233 | #endif |
| 230 | 234 | ||
| 235 | static inline void arch_dup_pkeys(struct mm_struct *oldmm, | ||
| 236 | struct mm_struct *mm) | ||
| 237 | { | ||
| 238 | #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS | ||
| 239 | if (!cpu_feature_enabled(X86_FEATURE_OSPKE)) | ||
| 240 | return; | ||
| 241 | |||
| 242 | /* Duplicate the oldmm pkey state in mm: */ | ||
| 243 | mm->context.pkey_allocation_map = oldmm->context.pkey_allocation_map; | ||
| 244 | mm->context.execute_only_pkey = oldmm->context.execute_only_pkey; | ||
| 245 | #endif | ||
| 246 | } | ||
| 247 | |||
| 231 | static inline int arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) | 248 | static inline int arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) |
| 232 | { | 249 | { |
| 250 | arch_dup_pkeys(oldmm, mm); | ||
| 233 | paravirt_arch_dup_mmap(oldmm, mm); | 251 | paravirt_arch_dup_mmap(oldmm, mm); |
| 234 | return ldt_dup_context(oldmm, mm); | 252 | return ldt_dup_context(oldmm, mm); |
| 235 | } | 253 | } |
| @@ -7,7 +7,11 @@ · 6 unmodified lines | |||
| 7 | #endif | 7 | #endif |
| 8 | 8 | ||
| 9 | #ifdef CONFIG_KASAN | 9 | #ifdef CONFIG_KASAN |
| 10 | #ifdef CONFIG_KASAN_EXTRA | ||
| 11 | #define KASAN_STACK_ORDER 2 | ||
| 12 | #else | ||
| 10 | #define KASAN_STACK_ORDER 1 | 13 | #define KASAN_STACK_ORDER 1 |
| 14 | #endif | ||
| 11 | #else | 15 | #else |
| 12 | #define KASAN_STACK_ORDER 0 | 16 | #define KASAN_STACK_ORDER 0 |
| 13 | #endif | 17 | #endif |
| @@ -1065,7 +1065,7 @@ static inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr, · 1064 unmodified lines | |||
| 1065 | static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, | 1065 | static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, |
| 1066 | pmd_t *pmdp, pmd_t pmd) | 1066 | pmd_t *pmdp, pmd_t pmd) |
| 1067 | { | 1067 | { |
| 1068 | native_set_pmd(pmdp, pmd); | 1068 | set_pmd(pmdp, pmd); |
| 1069 | } | 1069 | } |
| 1070 | 1070 | ||
| 1071 | static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, | 1071 | static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | #ifndef _ASM_X86_RESCTRL_SCHED_H | 2 | #ifndef _ASM_X86_RESCTRL_SCHED_H |
| 3 | #define _ASM_X86_RESCTRL_SCHED_H | 3 | #define _ASM_X86_RESCTRL_SCHED_H |
| 4 | 4 | ||
| 5 | #ifdef CONFIG_RESCTRL | 5 | #ifdef CONFIG_X86_CPU_RESCTRL |
| 6 | 6 | ||
| 7 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
| 8 | #include <linux/jump_label.h> | 8 | #include <linux/jump_label.h> |
| @@ -88,6 +88,6 @@ static inline void resctrl_sched_in(void) · 79 unmodified lines | |||
| 88 | 88 | ||
| 89 | static inline void resctrl_sched_in(void) {} | 89 | static inline void resctrl_sched_in(void) {} |
| 90 | 90 | ||
| 91 | #endif /* CONFIG_RESCTRL */ | 91 | #endif /* CONFIG_X86_CPU_RESCTRL */ |
| 92 | 92 | ||
| 93 | #endif /* _ASM_X86_RESCTRL_SCHED_H */ | 93 | #endif /* _ASM_X86_RESCTRL_SCHED_H */ |
| @@ -711,7 +711,7 @@ static __must_check inline bool user_access_begin(const void __user *ptr, size_t · 710 unmodified lines | |||
| 711 | { | 711 | { |
| 712 | if (unlikely(!access_ok(ptr,len))) | 712 | if (unlikely(!access_ok(ptr,len))) |
| 713 | return 0; | 713 | return 0; |
| 714 | __uaccess_begin(); | 714 | __uaccess_begin_nospec(); |
| 715 | return 1; | 715 | return 1; |
| 716 | } | 716 | } |
| 717 | #define user_access_begin(a,b) user_access_begin(a,b) | 717 | #define user_access_begin(a,b) user_access_begin(a,b) |
| @@ -39,7 +39,7 @@ obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o · 38 unmodified lines | |||
| 39 | obj-$(CONFIG_X86_MCE) += mce/ | 39 | obj-$(CONFIG_X86_MCE) += mce/ |
| 40 | obj-$(CONFIG_MTRR) += mtrr/ | 40 | obj-$(CONFIG_MTRR) += mtrr/ |
| 41 | obj-$(CONFIG_MICROCODE) += microcode/ | 41 | obj-$(CONFIG_MICROCODE) += microcode/ |
| 42 | obj-$(CONFIG_RESCTRL) += resctrl/ | 42 | obj-$(CONFIG_X86_CPU_RESCTRL) += resctrl/ |
| 43 | 43 | ||
| 44 | obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o | 44 | obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o |
| 45 | 45 | ||
| @@ -71,7 +71,7 @@ void __init check_bugs(void) · 70 unmodified lines | |||
| 71 | * identify_boot_cpu() initialized SMT support information, let the | 71 | * identify_boot_cpu() initialized SMT support information, let the |
| 72 | * core code know. | 72 | * core code know. |
| 73 | */ | 73 | */ |
| 74 | cpu_smt_check_topology_early(); | 74 | cpu_smt_check_topology(); |
| 75 | 75 | ||
| 76 | if (!IS_ENABLED(CONFIG_SMP)) { | 76 | if (!IS_ENABLED(CONFIG_SMP)) { |
| 77 | pr_info("CPU: "); | 77 | pr_info("CPU: "); |
| @@ -215,7 +215,7 @@ static enum spectre_v2_mitigation spectre_v2_enabled __ro_after_init = · 137 unmodified lines | |||
| 215 | static enum spectre_v2_user_mitigation spectre_v2_user __ro_after_init = | 215 | static enum spectre_v2_user_mitigation spectre_v2_user __ro_after_init = |
| 216 | SPECTRE_V2_USER_NONE; | 216 | SPECTRE_V2_USER_NONE; |
| 217 | 217 | ||
| 218 | #ifdef RETPOLINE | 218 | #ifdef CONFIG_RETPOLINE |
| 219 | static bool spectre_v2_bad_module; | 219 | static bool spectre_v2_bad_module; |
| 220 | 220 | ||
| 221 | bool retpoline_module_ok(bool has_retpoline) | 221 | bool retpoline_module_ok(bool has_retpoline) |
| @@ -784,6 +784,7 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp, · 783 unmodified lines | |||
| 784 | quirk_no_way_out(i, m, regs); | 784 | quirk_no_way_out(i, m, regs); |
| 785 | 785 | ||
| 786 | if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { | 786 | if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { |
| 787 | m->bank = i; | ||
| 787 | mce_read_aux(m, i); | 788 | mce_read_aux(m, i); |
| 788 | *msg = tmp; | 789 | *msg = tmp; |
| 789 | return 1; | 790 | return 1; |
| @@ -855,7 +855,7 @@ load_microcode_amd(bool save, u8 family, const u8 *data, size_t size) · 854 unmodified lines | |||
| 855 | if (!p) { | 855 | if (!p) { |
| 856 | return ret; | 856 | return ret; |
| 857 | } else { | 857 | } else { |
| 858 | if (boot_cpu_data.microcode == p->patch_id) | 858 | if (boot_cpu_data.microcode >= p->patch_id) |
| 859 | return ret; | 859 | return ret; |
| 860 | 860 | ||
| 861 | ret = UCODE_NEW; | 861 | ret = UCODE_NEW; |
| @@ -1,4 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | obj-$(CONFIG_RESCTRL) += core.o rdtgroup.o monitor.o | 2 | obj-$(CONFIG_X86_CPU_RESCTRL) += core.o rdtgroup.o monitor.o |
| 3 | obj-$(CONFIG_RESCTRL) += ctrlmondata.o pseudo_lock.o | 3 | obj-$(CONFIG_X86_CPU_RESCTRL) += ctrlmondata.o pseudo_lock.o |
| 4 | CFLAGS_pseudo_lock.o = -I$(src) | 4 | CFLAGS_pseudo_lock.o = -I$(src) |
| @@ -470,6 +470,7 @@ int crash_load_segments(struct kimage *image) · 469 unmodified lines | |||
| 470 | 470 | ||
| 471 | kbuf.memsz = kbuf.bufsz; | 471 | kbuf.memsz = kbuf.bufsz; |
| 472 | kbuf.buf_align = ELF_CORE_HEADER_ALIGN; | 472 | kbuf.buf_align = ELF_CORE_HEADER_ALIGN; |
| 473 | kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; | ||
| 473 | ret = kexec_add_buffer(&kbuf); | 474 | ret = kexec_add_buffer(&kbuf); |
| 474 | if (ret) { | 475 | if (ret) { |
| 475 | vfree((void *)image->arch.elf_headers); | 476 | vfree((void *)image->arch.elf_headers); |
| @@ -21,10 +21,6 @@ · 20 unmodified lines | |||
| 21 | 21 | ||
| 22 | #define HPET_MASK CLOCKSOURCE_MASK(32) | 22 | #define HPET_MASK CLOCKSOURCE_MASK(32) |
| 23 | 23 | ||
| 24 | /* FSEC = 10^-15 | ||
| 25 | NSEC = 10^-9 */ | ||
| 26 | #define FSEC_PER_NSEC 1000000L | ||
| 27 | |||
| 28 | #define HPET_DEV_USED_BIT 2 | 24 | #define HPET_DEV_USED_BIT 2 |
| 29 | #define HPET_DEV_USED (1 << HPET_DEV_USED_BIT) | 25 | #define HPET_DEV_USED (1 << HPET_DEV_USED_BIT) |
| 30 | #define HPET_DEV_VALID 0x8 | 26 | #define HPET_DEV_VALID 0x8 |
| @@ -167,6 +167,9 @@ setup_efi_state(struct boot_params *params, unsigned long params_load_addr, · 166 unmodified lines | |||
| 167 | struct efi_info *current_ei = &boot_params.efi_info; | 167 | struct efi_info *current_ei = &boot_params.efi_info; |
| 168 | struct efi_info *ei = ¶ms->efi_info; | 168 | struct efi_info *ei = ¶ms->efi_info; |
| 169 | 169 | ||
| 170 | if (!efi_enabled(EFI_RUNTIME_SERVICES)) | ||
| 171 | return 0; | ||
| 172 | |||
| 170 | if (!current_ei->efi_memmap_size) | 173 | if (!current_ei->efi_memmap_size) |
| 171 | return 0; | 174 | return 0; |
| 172 | 175 | ||
| @@ -434,6 +437,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel, · 261 unmodified lines | |||
| 434 | kbuf.memsz = PAGE_ALIGN(header->init_size); | 437 | kbuf.memsz = PAGE_ALIGN(header->init_size); |
| 435 | kbuf.buf_align = header->kernel_alignment; | 438 | kbuf.buf_align = header->kernel_alignment; |
| 436 | kbuf.buf_min = MIN_KERNEL_LOAD_ADDR; | 439 | kbuf.buf_min = MIN_KERNEL_LOAD_ADDR; |
| 440 | kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; | ||
| 437 | ret = kexec_add_buffer(&kbuf); | 441 | ret = kexec_add_buffer(&kbuf); |
| 438 | if (ret) | 442 | if (ret) |
| 439 | goto out_free_params; | 443 | goto out_free_params; |
| @@ -448,6 +452,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel, · 8 unmodified lines | |||
| 448 | kbuf.bufsz = kbuf.memsz = initrd_len; | 452 | kbuf.bufsz = kbuf.memsz = initrd_len; |
| 449 | kbuf.buf_align = PAGE_SIZE; | 453 | kbuf.buf_align = PAGE_SIZE; |
| 450 | kbuf.buf_min = MIN_INITRD_LOAD_ADDR; | 454 | kbuf.buf_min = MIN_INITRD_LOAD_ADDR; |
| 455 | kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; | ||
| 451 | ret = kexec_add_buffer(&kbuf); | 456 | ret = kexec_add_buffer(&kbuf); |
| 452 | if (ret) | 457 | if (ret) |
| 453 | goto out_free_params; | 458 | goto out_free_params; |
| @@ -457,6 +457,7 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector) · 456 unmodified lines | |||
| 457 | #else | 457 | #else |
| 458 | u64 ipi_bitmap = 0; | 458 | u64 ipi_bitmap = 0; |
| 459 | #endif | 459 | #endif |
| 460 | long ret; | ||
| 460 | 461 | ||
| 461 | if (cpumask_empty(mask)) | 462 | if (cpumask_empty(mask)) |
| 462 | return; | 463 | return; |
| @@ -482,8 +483,9 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector) · 19 unmodified lines | |||
| 482 | } else if (apic_id < min + KVM_IPI_CLUSTER_SIZE) { | 483 | } else if (apic_id < min + KVM_IPI_CLUSTER_SIZE) { |
| 483 | max = apic_id < max ? max : apic_id; | 484 | max = apic_id < max ? max : apic_id; |
| 484 | } else { | 485 | } else { |
| 485 | kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, | 486 | ret = kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, |
| 486 | (unsigned long)(ipi_bitmap >> BITS_PER_LONG), min, icr); | 487 | (unsigned long)(ipi_bitmap >> BITS_PER_LONG), min, icr); |
| 488 | WARN_ONCE(ret < 0, "KVM: failed to send PV IPI: %ld", ret); | ||
| 487 | min = max = apic_id; | 489 | min = max = apic_id; |
| 488 | ipi_bitmap = 0; | 490 | ipi_bitmap = 0; |
| 489 | } | 491 | } |
| @@ -491,8 +493,9 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector) · 1 unmodified line | |||
| 491 | } | 493 | } |
| 492 | 494 | ||
| 493 | if (ipi_bitmap) { | 495 | if (ipi_bitmap) { |
| 494 | kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, | 496 | ret = kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, |
| 495 | (unsigned long)(ipi_bitmap >> BITS_PER_LONG), min, icr); | 497 | (unsigned long)(ipi_bitmap >> BITS_PER_LONG), min, icr); |
| 498 | WARN_ONCE(ret < 0, "KVM: failed to send PV IPI: %ld", ret); | ||
| 496 | } | 499 | } |
| 497 | 500 | ||
| 498 | local_irq_restore(flags); | 501 | local_irq_restore(flags); |
| @@ -297,15 +297,16 @@ static int __init tsc_setup(char *str) · 296 unmodified lines | |||
| 297 | 297 | ||
| 298 | __setup("tsc=", tsc_setup); | 298 | __setup("tsc=", tsc_setup); |
| 299 | 299 | ||
| 300 | #define MAX_RETRIES 5 | 300 | #define MAX_RETRIES 5 |
| 301 | #define SMI_TRESHOLD 50000 | 301 | #define TSC_DEFAULT_THRESHOLD 0x20000 |
| 302 | 302 | ||
| 303 | /* | 303 | /* |
| 304 | * Read TSC and the reference counters. Take care of SMI disturbance | 304 | * Read TSC and the reference counters. Take care of any disturbances |
| 305 | */ | 305 | */ |
| 306 | static u64 tsc_read_refs(u64 *p, int hpet) | 306 | static u64 tsc_read_refs(u64 *p, int hpet) |
| 307 | { | 307 | { |
| 308 | u64 t1, t2; | 308 | u64 t1, t2; |
| 309 | u64 thresh = tsc_khz ? tsc_khz >> 5 : TSC_DEFAULT_THRESHOLD; | ||
| 309 | int i; | 310 | int i; |
| 310 | 311 | ||
| 311 | for (i = 0; i < MAX_RETRIES; i++) { | 312 | for (i = 0; i < MAX_RETRIES; i++) { |
| @@ -315,7 +316,7 @@ static u64 tsc_read_refs(u64 *p, int hpet) · 3 unmodified lines | |||
| 315 | else | 316 | else |
| 316 | *p = acpi_pm_read_early(); | 317 | *p = acpi_pm_read_early(); |
| 317 | t2 = get_cycles(); | 318 | t2 = get_cycles(); |
| 318 | if ((t2 - t1) < SMI_TRESHOLD) | 319 | if ((t2 - t1) < thresh) |
| 319 | return t2; | 320 | return t2; |
| 320 | } | 321 | } |
| 321 | return ULLONG_MAX; | 322 | return ULLONG_MAX; |
| @@ -703,15 +704,15 @@ static unsigned long pit_hpet_ptimer_calibrate_cpu(void) · 381 unmodified lines | |||
| 703 | * zero. In each wait loop iteration we read the TSC and check | 704 | * zero. In each wait loop iteration we read the TSC and check |
| 704 | * the delta to the previous read. We keep track of the min | 705 | * the delta to the previous read. We keep track of the min |
| 705 | * and max values of that delta. The delta is mostly defined | 706 | * and max values of that delta. The delta is mostly defined |
| 706 | * by the IO time of the PIT access, so we can detect when a | 707 | * by the IO time of the PIT access, so we can detect when |
| 707 | * SMI/SMM disturbance happened between the two reads. If the | 708 | * any disturbance happened between the two reads. If the |
| 708 | * maximum time is significantly larger than the minimum time, | 709 | * maximum time is significantly larger than the minimum time, |
| 709 | * then we discard the result and have another try. | 710 | * then we discard the result and have another try. |
| 710 | * | 711 | * |
| 711 | * 2) Reference counter. If available we use the HPET or the | 712 | * 2) Reference counter. If available we use the HPET or the |
| 712 | * PMTIMER as a reference to check the sanity of that value. | 713 | * PMTIMER as a reference to check the sanity of that value. |
| 713 | * We use separate TSC readouts and check inside of the | 714 | * We use separate TSC readouts and check inside of the |
| 714 | * reference read for a SMI/SMM disturbance. We dicard | 715 | * reference read for any possible disturbance. We dicard |
| 715 | * disturbed values here as well. We do that around the PIT | 716 | * disturbed values here as well. We do that around the PIT |
| 716 | * calibration delay loop as we have to wait for a certain | 717 | * calibration delay loop as we have to wait for a certain |
| 717 | * amount of time anyway. | 718 | * amount of time anyway. |
| @@ -744,7 +745,7 @@ static unsigned long pit_hpet_ptimer_calibrate_cpu(void) · 26 unmodified lines | |||
| 744 | if (ref1 == ref2) | 745 | if (ref1 == ref2) |
| 745 | continue; | 746 | continue; |
| 746 | 747 | ||
| 747 | /* Check, whether the sampling was disturbed by an SMI */ | 748 | /* Check, whether the sampling was disturbed */ |
| 748 | if (tsc1 == ULLONG_MAX || tsc2 == ULLONG_MAX) | 749 | if (tsc1 == ULLONG_MAX || tsc2 == ULLONG_MAX) |
| 749 | continue; | 750 | continue; |
| 750 | 751 | ||
| @@ -1268,7 +1269,7 @@ static DECLARE_DELAYED_WORK(tsc_irqwork, tsc_refine_calibration_work); · 517 unmodified lines | |||
| 1268 | */ | 1269 | */ |
| 1269 | static void tsc_refine_calibration_work(struct work_struct *work) | 1270 | static void tsc_refine_calibration_work(struct work_struct *work) |
| 1270 | { | 1271 | { |
| 1271 | static u64 tsc_start = -1, ref_start; | 1272 | static u64 tsc_start = ULLONG_MAX, ref_start; |
| 1272 | static int hpet; | 1273 | static int hpet; |
| 1273 | u64 tsc_stop, ref_stop, delta; | 1274 | u64 tsc_stop, ref_stop, delta; |
| 1274 | unsigned long freq; | 1275 | unsigned long freq; |
| @@ -1283,14 +1284,15 @@ static void tsc_refine_calibration_work(struct work_struct *work) · 8 unmodified lines | |||
| 1283 | * delayed the first time we expire. So set the workqueue | 1284 | * delayed the first time we expire. So set the workqueue |
| 1284 | * again once we know timers are working. | 1285 | * again once we know timers are working. |
| 1285 | */ | 1286 | */ |
| 1286 | if (tsc_start == -1) { | 1287 | if (tsc_start == ULLONG_MAX) { |
| 1288 | restart: | ||
| 1287 | /* | 1289 | /* |
| 1288 | * Only set hpet once, to avoid mixing hardware | 1290 | * Only set hpet once, to avoid mixing hardware |
| 1289 | * if the hpet becomes enabled later. | 1291 | * if the hpet becomes enabled later. |
| 1290 | */ | 1292 | */ |
| 1291 | hpet = is_hpet_enabled(); | 1293 | hpet = is_hpet_enabled(); |
| 1292 | schedule_delayed_work(&tsc_irqwork, HZ); | ||
| 1293 | tsc_start = tsc_read_refs(&ref_start, hpet); | 1294 | tsc_start = tsc_read_refs(&ref_start, hpet); |
| 1295 | schedule_delayed_work(&tsc_irqwork, HZ); | ||
| 1294 | return; | 1296 | return; |
| 1295 | } | 1297 | } |
| 1296 | 1298 | ||
| @@ -1300,9 +1302,9 @@ static void tsc_refine_calibration_work(struct work_struct *work) · 3 unmodified lines | |||
| 1300 | if (ref_start == ref_stop) | 1302 | if (ref_start == ref_stop) |
| 1301 | goto out; | 1303 | goto out; |
| 1302 | 1304 | ||
| 1303 | /* Check, whether the sampling was disturbed by an SMI */ | 1305 | /* Check, whether the sampling was disturbed */ |
| 1304 | if (tsc_start == ULLONG_MAX || tsc_stop == ULLONG_MAX) | 1306 | if (tsc_stop == ULLONG_MAX) |
| 1305 | goto out; | 1307 | goto restart; |
| 1306 | 1308 | ||
| 1307 | delta = tsc_stop - tsc_start; | 1309 | delta = tsc_stop - tsc_start; |
| 1308 | delta *= 1000000LL; | 1310 | delta *= 1000000LL; |
| @@ -2,10 +2,6 @@ · 1 unmodified line | |||
| 2 | 2 | ||
| 3 | ccflags-y += -Iarch/x86/kvm | 3 | ccflags-y += -Iarch/x86/kvm |
| 4 | 4 | ||
| 5 | CFLAGS_x86.o := -I. | ||
| 6 | CFLAGS_svm.o := -I. | ||
| 7 | CFLAGS_vmx.o := -I. | ||
| 8 | |||
| 9 | KVM := ../../../virt/kvm | 5 | KVM := ../../../virt/kvm |
| 10 | 6 | ||
| 11 | kvm-y += $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \ | 7 | kvm-y += $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \ |
| @@ -1636,7 +1636,7 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu) · 1635 unmodified lines | |||
| 1636 | ret = kvm_hvcall_signal_event(vcpu, fast, ingpa); | 1636 | ret = kvm_hvcall_signal_event(vcpu, fast, ingpa); |
| 1637 | if (ret != HV_STATUS_INVALID_PORT_ID) | 1637 | if (ret != HV_STATUS_INVALID_PORT_ID) |
| 1638 | break; | 1638 | break; |
| 1639 | /* maybe userspace knows this conn_id: fall through */ | 1639 | /* fall through - maybe userspace knows this conn_id. */ |
| 1640 | case HVCALL_POST_MESSAGE: | 1640 | case HVCALL_POST_MESSAGE: |
| 1641 | /* don't bother userspace if it has no way to handle it */ | 1641 | /* don't bother userspace if it has no way to handle it */ |
| 1642 | if (unlikely(rep || !vcpu_to_synic(vcpu)->active)) { | 1642 | if (unlikely(rep || !vcpu_to_synic(vcpu)->active)) { |
| @@ -1832,7 +1832,6 @@ int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid, · 189 unmodified lines | |||
| 1832 | ent->eax |= HV_X64_MSR_VP_INDEX_AVAILABLE; | 1832 | ent->eax |= HV_X64_MSR_VP_INDEX_AVAILABLE; |
| 1833 | ent->eax |= HV_X64_MSR_RESET_AVAILABLE; | 1833 | ent->eax |= HV_X64_MSR_RESET_AVAILABLE; |
| 1834 | ent->eax |= HV_MSR_REFERENCE_TSC_AVAILABLE; | 1834 | ent->eax |= HV_MSR_REFERENCE_TSC_AVAILABLE; |
| 1835 | ent->eax |= HV_X64_MSR_GUEST_IDLE_AVAILABLE; | ||
| 1836 | ent->eax |= HV_X64_ACCESS_FREQUENCY_MSRS; | 1835 | ent->eax |= HV_X64_ACCESS_FREQUENCY_MSRS; |
| 1837 | ent->eax |= HV_X64_ACCESS_REENLIGHTENMENT; | 1836 | ent->eax |= HV_X64_ACCESS_REENLIGHTENMENT; |
| 1838 | 1837 | ||
| @@ -1848,11 +1847,11 @@ int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid, · 9 unmodified lines | |||
| 1848 | case HYPERV_CPUID_ENLIGHTMENT_INFO: | 1847 | case HYPERV_CPUID_ENLIGHTMENT_INFO: |
| 1849 | ent->eax |= HV_X64_REMOTE_TLB_FLUSH_RECOMMENDED; | 1848 | ent->eax |= HV_X64_REMOTE_TLB_FLUSH_RECOMMENDED; |
| 1850 | ent->eax |= HV_X64_APIC_ACCESS_RECOMMENDED; | 1849 | ent->eax |= HV_X64_APIC_ACCESS_RECOMMENDED; |
| 1851 | ent->eax |= HV_X64_SYSTEM_RESET_RECOMMENDED; | ||
| 1852 | ent->eax |= HV_X64_RELAXED_TIMING_RECOMMENDED; | 1850 | ent->eax |= HV_X64_RELAXED_TIMING_RECOMMENDED; |
| 1853 | ent->eax |= HV_X64_CLUSTER_IPI_RECOMMENDED; | 1851 | ent->eax |= HV_X64_CLUSTER_IPI_RECOMMENDED; |
| 1854 | ent->eax |= HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED; | 1852 | ent->eax |= HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED; |
| 1855 | ent->eax |= HV_X64_ENLIGHTENED_VMCS_RECOMMENDED; | 1853 | if (evmcs_ver) |
| 1854 | ent->eax |= HV_X64_ENLIGHTENED_VMCS_RECOMMENDED; | ||
| 1856 | 1855 | ||
| 1857 | /* | 1856 | /* |
| 1858 | * Default number of spinlock retry attempts, matches | 1857 | * Default number of spinlock retry attempts, matches |
| @@ -1035,6 +1035,7 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, · 1034 unmodified lines | |||
| 1035 | switch (delivery_mode) { | 1035 | switch (delivery_mode) { |
| 1036 | case APIC_DM_LOWEST: | 1036 | case APIC_DM_LOWEST: |
| 1037 | vcpu->arch.apic_arb_prio++; | 1037 | vcpu->arch.apic_arb_prio++; |
| 1038 | /* fall through */ | ||
| 1038 | case APIC_DM_FIXED: | 1039 | case APIC_DM_FIXED: |
| 1039 | if (unlikely(trig_mode && !level)) | 1040 | if (unlikely(trig_mode && !level)) |
| 1040 | break; | 1041 | break; |
| @@ -1874,6 +1875,7 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val) · 833 unmodified lines | |||
| 1874 | 1875 | ||
| 1875 | case APIC_LVT0: | 1876 | case APIC_LVT0: |
| 1876 | apic_manage_nmi_watchdog(apic, val); | 1877 | apic_manage_nmi_watchdog(apic, val); |
| 1878 | /* fall through */ | ||
| 1877 | case APIC_LVTTHMR: | 1879 | case APIC_LVTTHMR: |
| 1878 | case APIC_LVTPC: | 1880 | case APIC_LVTPC: |
| 1879 | case APIC_LVT1: | 1881 | case APIC_LVT1: |
| @@ -4371,6 +4371,7 @@ __reset_rsvds_bits_mask(struct kvm_vcpu *vcpu, · 4370 unmodified lines | |||
| 4371 | rsvd_bits(maxphyaddr, 51); | 4371 | rsvd_bits(maxphyaddr, 51); |
| 4372 | rsvd_check->rsvd_bits_mask[1][4] = | 4372 | rsvd_check->rsvd_bits_mask[1][4] = |
| 4373 | rsvd_check->rsvd_bits_mask[0][4]; | 4373 | rsvd_check->rsvd_bits_mask[0][4]; |
| 4374 | /* fall through */ | ||
| 4374 | case PT64_ROOT_4LEVEL: | 4375 | case PT64_ROOT_4LEVEL: |
| 4375 | rsvd_check->rsvd_bits_mask[0][3] = exb_bit_rsvd | | 4376 | rsvd_check->rsvd_bits_mask[0][3] = exb_bit_rsvd | |
| 4376 | nonleaf_bit8_rsvd | rsvd_bits(7, 7) | | 4377 | nonleaf_bit8_rsvd | rsvd_bits(7, 7) | |
| @@ -3414,6 +3414,14 @@ static int nested_svm_vmexit(struct vcpu_svm *svm) · 3413 unmodified lines | |||
| 3414 | kvm_mmu_reset_context(&svm->vcpu); | 3414 | kvm_mmu_reset_context(&svm->vcpu); |
| 3415 | kvm_mmu_load(&svm->vcpu); | 3415 | kvm_mmu_load(&svm->vcpu); |
| 3416 | 3416 | ||
| 3417 | /* | ||
| 3418 | * Drop what we picked up for L2 via svm_complete_interrupts() so it | ||
| 3419 | * doesn't end up in L1. | ||
| 3420 | */ | ||
| 3421 | svm->vcpu.arch.nmi_injected = false; | ||
| 3422 | kvm_clear_exception_queue(&svm->vcpu); | ||
| 3423 | kvm_clear_interrupt_queue(&svm->vcpu); | ||
| 3424 | |||
| 3417 | return 0; | 3425 | return 0; |
| 3418 | } | 3426 | } |
| 3419 | 3427 | ||
| @@ -4395,7 +4403,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) · 975 unmodified lines | |||
| 4395 | case MSR_IA32_APICBASE: | 4403 | case MSR_IA32_APICBASE: |
| 4396 | if (kvm_vcpu_apicv_active(vcpu)) | 4404 | if (kvm_vcpu_apicv_active(vcpu)) |
| 4397 | avic_update_vapic_bar(to_svm(vcpu), data); | 4405 | avic_update_vapic_bar(to_svm(vcpu), data); |
| 4398 | /* Follow through */ | 4406 | /* Fall through */ |
| 4399 | default: | 4407 | default: |
| 4400 | return kvm_set_msr_common(vcpu, msr); | 4408 | return kvm_set_msr_common(vcpu, msr); |
| 4401 | } | 4409 | } |
| @@ -4504,28 +4512,19 @@ static int avic_incomplete_ipi_interception(struct vcpu_svm *svm) · 102 unmodified lines | |||
| 4504 | kvm_lapic_reg_write(apic, APIC_ICR, icrl); | 4512 | kvm_lapic_reg_write(apic, APIC_ICR, icrl); |
| 4505 | break; | 4513 | break; |
| 4506 | case AVIC_IPI_FAILURE_TARGET_NOT_RUNNING: { | 4514 | case AVIC_IPI_FAILURE_TARGET_NOT_RUNNING: { |
| 4507 | int i; | ||
| 4508 | struct kvm_vcpu *vcpu; | ||
| 4509 | struct kvm *kvm = svm->vcpu.kvm; | ||
| 4510 | struct kvm_lapic *apic = svm->vcpu.arch.apic; | 4515 | struct kvm_lapic *apic = svm->vcpu.arch.apic; |
| 4511 | 4516 | ||
| 4512 | /* | 4517 | /* |
| 4513 | * At this point, we expect that the AVIC HW has already | 4518 | * Update ICR high and low, then emulate sending IPI, |
| 4514 | * set the appropriate IRR bits on the valid target | 4519 | * which is handled when writing APIC_ICR. |
| 4515 | * vcpus. So, we just need to kick the appropriate vcpu. | ||
| 4516 | */ | 4520 | */ |
| 4517 | kvm_for_each_vcpu(i, vcpu, kvm) { | 4521 | kvm_lapic_reg_write(apic, APIC_ICR2, icrh); |
| 4518 | bool m = kvm_apic_match_dest(vcpu, apic, | 4522 | kvm_lapic_reg_write(apic, APIC_ICR, icrl); |
| 4519 | icrl & KVM_APIC_SHORT_MASK, | ||
| 4520 | GET_APIC_DEST_FIELD(icrh), | ||
| 4521 | icrl & KVM_APIC_DEST_MASK); | ||
| 4522 | |||
| 4523 | if (m && !avic_vcpu_is_running(vcpu)) | ||
| 4524 | kvm_vcpu_wake_up(vcpu); | ||
| 4525 | } | ||
| 4526 | break; | 4523 | break; |
| 4527 | } | 4524 | } |
| 4528 | case AVIC_IPI_FAILURE_INVALID_TARGET: | 4525 | case AVIC_IPI_FAILURE_INVALID_TARGET: |
| 4526 | WARN_ONCE(1, "Invalid IPI target: index=%u, vcpu=%d, icr=%#0x:%#0x\n", | ||
| 4527 | index, svm->vcpu.vcpu_id, icrh, icrl); | ||
| 4529 | break; | 4528 | break; |
| 4530 | case AVIC_IPI_FAILURE_INVALID_BACKING_PAGE: | 4529 | case AVIC_IPI_FAILURE_INVALID_BACKING_PAGE: |
| 4531 | WARN_ONCE(1, "Invalid backing page\n"); | 4530 | WARN_ONCE(1, "Invalid backing page\n"); |
| @@ -6278,6 +6277,9 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp) · 1746 unmodified lines | |||
| 6278 | int asid, ret; | 6277 | int asid, ret; |
| 6279 | 6278 | ||
| 6280 | ret = -EBUSY; | 6279 | ret = -EBUSY; |
| 6280 | if (unlikely(sev->active)) | ||
| 6281 | return ret; | ||
| 6282 | |||
| 6281 | asid = sev_asid_new(); | 6283 | asid = sev_asid_new(); |
| 6282 | if (asid < 0) | 6284 | if (asid < 0) |
| 6283 | return ret; | 6285 | return ret; |
| @@ -1465,7 +1465,7 @@ TRACE_EVENT(kvm_hv_send_ipi_ex, · 1464 unmodified lines | |||
| 1465 | #endif /* _TRACE_KVM_H */ | 1465 | #endif /* _TRACE_KVM_H */ |
| 1466 | 1466 | ||
| 1467 | #undef TRACE_INCLUDE_PATH | 1467 | #undef TRACE_INCLUDE_PATH |
| 1468 | #define TRACE_INCLUDE_PATH arch/x86/kvm | 1468 | #define TRACE_INCLUDE_PATH ../../arch/x86/kvm |
| 1469 | #undef TRACE_INCLUDE_FILE | 1469 | #undef TRACE_INCLUDE_FILE |
| 1470 | #define TRACE_INCLUDE_FILE trace | 1470 | #define TRACE_INCLUDE_FILE trace |
| 1471 | 1471 | ||
| @@ -332,16 +332,17 @@ int nested_enable_evmcs(struct kvm_vcpu *vcpu, · 331 unmodified lines | |||
| 332 | uint16_t *vmcs_version) | 332 | uint16_t *vmcs_version) |
| 333 | { | 333 | { |
| 334 | struct vcpu_vmx *vmx = to_vmx(vcpu); | 334 | struct vcpu_vmx *vmx = to_vmx(vcpu); |
| 335 | bool evmcs_already_enabled = vmx->nested.enlightened_vmcs_enabled; | ||
| 336 | |||
| 337 | vmx->nested.enlightened_vmcs_enabled = true; | ||
| 335 | 338 | ||
| 336 | if (vmcs_version) | 339 | if (vmcs_version) |
| 337 | *vmcs_version = nested_get_evmcs_version(vcpu); | 340 | *vmcs_version = nested_get_evmcs_version(vcpu); |
| 338 | 341 | ||
| 339 | /* We don't support disabling the feature for simplicity. */ | 342 | /* We don't support disabling the feature for simplicity. */ |
| 340 | if (vmx->nested.enlightened_vmcs_enabled) | 343 | if (evmcs_already_enabled) |
| 341 | return 0; | 344 | return 0; |
| 342 | 345 | ||
| 343 | vmx->nested.enlightened_vmcs_enabled = true; | ||
| 344 | |||
| 345 | vmx->nested.msrs.pinbased_ctls_high &= ~EVMCS1_UNSUPPORTED_PINCTRL; | 346 | vmx->nested.msrs.pinbased_ctls_high &= ~EVMCS1_UNSUPPORTED_PINCTRL; |
| 346 | vmx->nested.msrs.entry_ctls_high &= ~EVMCS1_UNSUPPORTED_VMENTRY_CTRL; | 347 | vmx->nested.msrs.entry_ctls_high &= ~EVMCS1_UNSUPPORTED_VMENTRY_CTRL; |
| 347 | vmx->nested.msrs.exit_ctls_high &= ~EVMCS1_UNSUPPORTED_VMEXIT_CTRL; | 348 | vmx->nested.msrs.exit_ctls_high &= ~EVMCS1_UNSUPPORTED_VMEXIT_CTRL; |
| @@ -55,7 +55,7 @@ static u16 shadow_read_write_fields[] = { · 54 unmodified lines | |||
| 55 | static int max_shadow_read_write_fields = | 55 | static int max_shadow_read_write_fields = |
| 56 | ARRAY_SIZE(shadow_read_write_fields); | 56 | ARRAY_SIZE(shadow_read_write_fields); |
| 57 | 57 | ||
| 58 | void init_vmcs_shadow_fields(void) | 58 | static void init_vmcs_shadow_fields(void) |
| 59 | { | 59 | { |
| 60 | int i, j; | 60 | int i, j; |
| 61 | 61 | ||
| @@ -211,6 +211,7 @@ static void free_nested(struct kvm_vcpu *vcpu) · 149 unmodified lines | |||
| 211 | if (!vmx->nested.vmxon && !vmx->nested.smm.vmxon) | 211 | if (!vmx->nested.vmxon && !vmx->nested.smm.vmxon) |
| 212 | return; | 212 | return; |
| 213 | 213 | ||
| 214 | hrtimer_cancel(&vmx->nested.preemption_timer); | ||
| 214 | vmx->nested.vmxon = false; | 215 | vmx->nested.vmxon = false; |
| 215 | vmx->nested.smm.vmxon = false; | 216 | vmx->nested.smm.vmxon = false; |
| 216 | free_vpid(vmx->nested.vpid02); | 217 | free_vpid(vmx->nested.vpid02); |
| @@ -4140,11 +4141,11 @@ static int enter_vmx_operation(struct kvm_vcpu *vcpu) · 3923 unmodified lines | |||
| 4140 | if (r < 0) | 4141 | if (r < 0) |
| 4141 | goto out_vmcs02; | 4142 | goto out_vmcs02; |
| 4142 | 4143 | ||
| 4143 | vmx->nested.cached_vmcs12 = kmalloc(VMCS12_SIZE, GFP_KERNEL); | 4144 | vmx->nested.cached_vmcs12 = kzalloc(VMCS12_SIZE, GFP_KERNEL); |
| 4144 | if (!vmx->nested.cached_vmcs12) | 4145 | if (!vmx->nested.cached_vmcs12) |
| 4145 | goto out_cached_vmcs12; | 4146 | goto out_cached_vmcs12; |
| 4146 | 4147 | ||
| 4147 | vmx->nested.cached_shadow_vmcs12 = kmalloc(VMCS12_SIZE, GFP_KERNEL); | 4148 | vmx->nested.cached_shadow_vmcs12 = kzalloc(VMCS12_SIZE, GFP_KERNEL); |
| 4148 | if (!vmx->nested.cached_shadow_vmcs12) | 4149 | if (!vmx->nested.cached_shadow_vmcs12) |
| 4149 | goto out_cached_shadow_vmcs12; | 4150 | goto out_cached_shadow_vmcs12; |
| 4150 | 4151 | ||
| @@ -4540,9 +4541,8 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu) · 389 unmodified lines | |||
| 4540 | * given physical address won't match the required | 4541 | * given physical address won't match the required |
| 4541 | * VMCS12_REVISION identifier. | 4542 | * VMCS12_REVISION identifier. |
| 4542 | */ | 4543 | */ |
| 4543 | nested_vmx_failValid(vcpu, | 4544 | return nested_vmx_failValid(vcpu, |
| 4544 | VMXERR_VMPTRLD_INCORRECT_VMCS_REVISION_ID); | 4545 | VMXERR_VMPTRLD_INCORRECT_VMCS_REVISION_ID); |
| 4545 | return kvm_skip_emulated_instruction(vcpu); | ||
| 4546 | } | 4546 | } |
| 4547 | new_vmcs12 = kmap(page); | 4547 | new_vmcs12 = kmap(page); |
| 4548 | if (new_vmcs12->hdr.revision_id != VMCS12_REVISION || | 4548 | if (new_vmcs12->hdr.revision_id != VMCS12_REVISION || |
| @@ -5264,13 +5264,17 @@ static int vmx_get_nested_state(struct kvm_vcpu *vcpu, · 715 unmodified lines | |||
| 5264 | copy_shadow_to_vmcs12(vmx); | 5264 | copy_shadow_to_vmcs12(vmx); |
| 5265 | } | 5265 | } |
| 5266 | 5266 | ||
| 5267 | if (copy_to_user(user_kvm_nested_state->data, vmcs12, sizeof(*vmcs12))) | 5267 | /* |
| 5268 | * Copy over the full allocated size of vmcs12 rather than just the size | ||
| 5269 | * of the struct. | ||
| 5270 | */ | ||
| 5271 | if (copy_to_user(user_kvm_nested_state->data, vmcs12, VMCS12_SIZE)) | ||
| 5268 | return -EFAULT; | 5272 | return -EFAULT; |
| 5269 | 5273 | ||
| 5270 | if (nested_cpu_has_shadow_vmcs(vmcs12) && | 5274 | if (nested_cpu_has_shadow_vmcs(vmcs12) && |
| 5271 | vmcs12->vmcs_link_pointer != -1ull) { | 5275 | vmcs12->vmcs_link_pointer != -1ull) { |
| 5272 | if (copy_to_user(user_kvm_nested_state->data + VMCS12_SIZE, | 5276 | if (copy_to_user(user_kvm_nested_state->data + VMCS12_SIZE, |
| 5273 | get_shadow_vmcs12(vcpu), sizeof(*vmcs12))) | 5277 | get_shadow_vmcs12(vcpu), VMCS12_SIZE)) |
| 5274 | return -EFAULT; | 5278 | return -EFAULT; |
| 5275 | } | 5279 | } |
| 5276 | 5280 | ||
| @@ -26,6 +26,7 @@ · 25 unmodified lines | |||
| 26 | #include <linux/mod_devicetable.h> | 26 | #include <linux/mod_devicetable.h> |
| 27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
| 28 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
| 29 | #include <linux/sched/smt.h> | ||
| 29 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
| 30 | #include <linux/tboot.h> | 31 | #include <linux/tboot.h> |
| 31 | #include <linux/trace_events.h> | 32 | #include <linux/trace_events.h> |
| @@ -423,7 +424,7 @@ static void check_ept_pointer_match(struct kvm *kvm) · 391 unmodified lines | |||
| 423 | to_kvm_vmx(kvm)->ept_pointers_match = EPT_POINTERS_MATCH; | 424 | to_kvm_vmx(kvm)->ept_pointers_match = EPT_POINTERS_MATCH; |
| 424 | } | 425 | } |
| 425 | 426 | ||
| 426 | int kvm_fill_hv_flush_list_func(struct hv_guest_mapping_flush_list *flush, | 427 | static int kvm_fill_hv_flush_list_func(struct hv_guest_mapping_flush_list *flush, |
| 427 | void *data) | 428 | void *data) |
| 428 | { | 429 | { |
| 429 | struct kvm_tlb_range *range = data; | 430 | struct kvm_tlb_range *range = data; |
| @@ -453,7 +454,7 @@ static int hv_remote_flush_tlb_with_range(struct kvm *kvm, · 23 unmodified lines | |||
| 453 | struct kvm_tlb_range *range) | 454 | struct kvm_tlb_range *range) |
| 454 | { | 455 | { |
| 455 | struct kvm_vcpu *vcpu; | 456 | struct kvm_vcpu *vcpu; |
| 456 | int ret = -ENOTSUPP, i; | 457 | int ret = 0, i; |
| 457 | 458 | ||
| 458 | spin_lock(&to_kvm_vmx(kvm)->ept_pointer_lock); | 459 | spin_lock(&to_kvm_vmx(kvm)->ept_pointer_lock); |
| 459 | 460 | ||
| @@ -1773,7 +1774,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 1313 unmodified lines | |||
| 1773 | if (!msr_info->host_initiated && | 1774 | if (!msr_info->host_initiated && |
| 1774 | !guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP)) | 1775 | !guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP)) |
| 1775 | return 1; | 1776 | return 1; |
| 1776 | /* Otherwise falls through */ | 1777 | /* Else, falls through */ |
| 1777 | default: | 1778 | default: |
| 1778 | msr = find_msr_entry(vmx, msr_info->index); | 1779 | msr = find_msr_entry(vmx, msr_info->index); |
| 1779 | if (msr) { | 1780 | if (msr) { |
| @@ -2014,7 +2015,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 234 unmodified lines | |||
| 2014 | /* Check reserved bit, higher 32 bits should be zero */ | 2015 | /* Check reserved bit, higher 32 bits should be zero */ |
| 2015 | if ((data >> 32) != 0) | 2016 | if ((data >> 32) != 0) |
| 2016 | return 1; | 2017 | return 1; |
| 2017 | /* Otherwise falls through */ | 2018 | /* Else, falls through */ |
| 2018 | default: | 2019 | default: |
| 2019 | msr = find_msr_entry(vmx, msr_index); | 2020 | msr = find_msr_entry(vmx, msr_index); |
| 2020 | if (msr) { | 2021 | if (msr) { |
| @@ -2344,7 +2345,7 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf, · 323 unmodified lines | |||
| 2344 | case 37: /* AAT100 */ | 2345 | case 37: /* AAT100 */ |
| 2345 | case 44: /* BC86,AAY89,BD102 */ | 2346 | case 44: /* BC86,AAY89,BD102 */ |
| 2346 | case 46: /* BA97 */ | 2347 | case 46: /* BA97 */ |
| 2347 | _vmexit_control &= ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL; | 2348 | _vmentry_control &= ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL; |
| 2348 | _vmexit_control &= ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL; | 2349 | _vmexit_control &= ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL; |
| 2349 | pr_warn_once("kvm: VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL " | 2350 | pr_warn_once("kvm: VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL " |
| 2350 | "does not work properly. Using workaround\n"); | 2351 | "does not work properly. Using workaround\n"); |
| @@ -6362,72 +6363,9 @@ static void vmx_update_hv_timer(struct kvm_vcpu *vcpu) · 4011 unmodified lines | |||
| 6362 | vmx->loaded_vmcs->hv_timer_armed = false; | 6363 | vmx->loaded_vmcs->hv_timer_armed = false; |
| 6363 | } | 6364 | } |
| 6364 | 6365 | ||
| 6365 | static void vmx_vcpu_run(struct kvm_vcpu *vcpu) | 6366 | static void __vmx_vcpu_run(struct kvm_vcpu *vcpu, struct vcpu_vmx *vmx) |
| 6366 | { | 6367 | { |
| 6367 | struct vcpu_vmx *vmx = to_vmx(vcpu); | 6368 | unsigned long evmcs_rsp; |
| 6368 | unsigned long cr3, cr4, evmcs_rsp; | ||
| 6369 | |||
| 6370 | /* Record the guest's net vcpu time for enforced NMI injections. */ | ||
| 6371 | if (unlikely(!enable_vnmi && | ||
| 6372 | vmx->loaded_vmcs->soft_vnmi_blocked)) | ||
| 6373 | vmx->loaded_vmcs->entry_time = ktime_get(); | ||
| 6374 | |||
| 6375 | /* Don't enter VMX if guest state is invalid, let the exit handler | ||
| 6376 | start emulation until we arrive back to a valid state */ | ||
| 6377 | if (vmx->emulation_required) | ||
| 6378 | return; | ||
| 6379 | |||
| 6380 | if (vmx->ple_window_dirty) { | ||
| 6381 | vmx->ple_window_dirty = false; | ||
| 6382 | vmcs_write32(PLE_WINDOW, vmx->ple_window); | ||
| 6383 | } | ||
| 6384 | |||
| 6385 | if (vmx->nested.need_vmcs12_sync) | ||
| 6386 | nested_sync_from_vmcs12(vcpu); | ||
| 6387 | |||
| 6388 | if (test_bit(VCPU_REGS_RSP, (unsigned long *)&vcpu->arch.regs_dirty)) | ||
| 6389 | vmcs_writel(GUEST_RSP, vcpu->arch.regs[VCPU_REGS_RSP]); | ||
| 6390 | if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty)) | ||
| 6391 | vmcs_writel(GUEST_RIP, vcpu->arch.regs[VCPU_REGS_RIP]); | ||
| 6392 | |||
| 6393 | cr3 = __get_current_cr3_fast(); | ||
| 6394 | if (unlikely(cr3 != vmx->loaded_vmcs->host_state.cr3)) { | ||
| 6395 | vmcs_writel(HOST_CR3, cr3); | ||
| 6396 | vmx->loaded_vmcs->host_state.cr3 = cr3; | ||
| 6397 | } | ||
| 6398 | |||
| 6399 | cr4 = cr4_read_shadow(); | ||
| 6400 | if (unlikely(cr4 != vmx->loaded_vmcs->host_state.cr4)) { | ||
| 6401 | vmcs_writel(HOST_CR4, cr4); | ||
| 6402 | vmx->loaded_vmcs->host_state.cr4 = cr4; | ||
| 6403 | } | ||
| 6404 | |||
| 6405 | /* When single-stepping over STI and MOV SS, we must clear the | ||
| 6406 | * corresponding interruptibility bits in the guest state. Otherwise | ||
| 6407 | * vmentry fails as it then expects bit 14 (BS) in pending debug | ||
| 6408 | * exceptions being set, but that's not correct for the guest debugging | ||
| 6409 | * case. */ | ||
| 6410 | if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) | ||
| 6411 | vmx_set_interrupt_shadow(vcpu, 0); | ||
| 6412 | |||
| 6413 | if (static_cpu_has(X86_FEATURE_PKU) && | ||
| 6414 | kvm_read_cr4_bits(vcpu, X86_CR4_PKE) && | ||
| 6415 | vcpu->arch.pkru != vmx->host_pkru) | ||
| 6416 | __write_pkru(vcpu->arch.pkru); | ||
| 6417 | |||
| 6418 | pt_guest_enter(vmx); | ||
| 6419 | |||
| 6420 | atomic_switch_perf_msrs(vmx); | ||
| 6421 | |||
| 6422 | vmx_update_hv_timer(vcpu); | ||
| 6423 | |||
| 6424 | /* | ||
| 6425 | * If this vCPU has touched SPEC_CTRL, restore the guest's value if | ||
| 6426 | * it's non-zero. Since vmentry is serialising on affected CPUs, there | ||
| 6427 | * is no need to worry about the conditional branch over the wrmsr | ||
| 6428 | * being speculatively taken. | ||
| 6429 | */ | ||
| 6430 | x86_spec_ctrl_set_guest(vmx->spec_ctrl, 0); | ||
| 6431 | 6369 | ||
| 6432 | vmx->__launched = vmx->loaded_vmcs->launched; | 6370 | vmx->__launched = vmx->loaded_vmcs->launched; |
| 6433 | 6371 | ||
| @@ -6567,6 +6505,77 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) · 133 unmodified lines | |||
| 6567 | , "eax", "ebx", "edi" | 6505 | , "eax", "ebx", "edi" |
| 6568 | #endif | 6506 | #endif |
| 6569 | ); | 6507 | ); |
| 6508 | } | ||
| 6509 | STACK_FRAME_NON_STANDARD(__vmx_vcpu_run); | ||
| 6510 | |||
| 6511 | static void vmx_vcpu_run(struct kvm_vcpu *vcpu) | ||
| 6512 | { | ||
| 6513 | struct vcpu_vmx *vmx = to_vmx(vcpu); | ||
| 6514 | unsigned long cr3, cr4; | ||
| 6515 | |||
| 6516 | /* Record the guest's net vcpu time for enforced NMI injections. */ | ||
| 6517 | if (unlikely(!enable_vnmi && | ||
| 6518 | vmx->loaded_vmcs->soft_vnmi_blocked)) | ||
| 6519 | vmx->loaded_vmcs->entry_time = ktime_get(); | ||
| 6520 | |||
| 6521 | /* Don't enter VMX if guest state is invalid, let the exit handler | ||
| 6522 | start emulation until we arrive back to a valid state */ | ||
| 6523 | if (vmx->emulation_required) | ||
| 6524 | return; | ||
| 6525 | |||
| 6526 | if (vmx->ple_window_dirty) { | ||
| 6527 | vmx->ple_window_dirty = false; | ||
| 6528 | vmcs_write32(PLE_WINDOW, vmx->ple_window); | ||
| 6529 | } | ||
| 6530 | |||
| 6531 | if (vmx->nested.need_vmcs12_sync) | ||
| 6532 | nested_sync_from_vmcs12(vcpu); | ||
| 6533 | |||
| 6534 | if (test_bit(VCPU_REGS_RSP, (unsigned long *)&vcpu->arch.regs_dirty)) | ||
| 6535 | vmcs_writel(GUEST_RSP, vcpu->arch.regs[VCPU_REGS_RSP]); | ||
| 6536 | if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty)) | ||
| 6537 | vmcs_writel(GUEST_RIP, vcpu->arch.regs[VCPU_REGS_RIP]); | ||
| 6538 | |||
| 6539 | cr3 = __get_current_cr3_fast(); | ||
| 6540 | if (unlikely(cr3 != vmx->loaded_vmcs->host_state.cr3)) { | ||
| 6541 | vmcs_writel(HOST_CR3, cr3); | ||
| 6542 | vmx->loaded_vmcs->host_state.cr3 = cr3; | ||
| 6543 | } | ||
| 6544 | |||
| 6545 | cr4 = cr4_read_shadow(); | ||
| 6546 | if (unlikely(cr4 != vmx->loaded_vmcs->host_state.cr4)) { | ||
| 6547 | vmcs_writel(HOST_CR4, cr4); | ||
| 6548 | vmx->loaded_vmcs->host_state.cr4 = cr4; | ||
| 6549 | } | ||
| 6550 | |||
| 6551 | /* When single-stepping over STI and MOV SS, we must clear the | ||
| 6552 | * corresponding interruptibility bits in the guest state. Otherwise | ||
| 6553 | * vmentry fails as it then expects bit 14 (BS) in pending debug | ||
| 6554 | * exceptions being set, but that's not correct for the guest debugging | ||
| 6555 | * case. */ | ||
| 6556 | if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) | ||
| 6557 | vmx_set_interrupt_shadow(vcpu, 0); | ||
| 6558 | |||
| 6559 | if (static_cpu_has(X86_FEATURE_PKU) && | ||
| 6560 | kvm_read_cr4_bits(vcpu, X86_CR4_PKE) && | ||
| 6561 | vcpu->arch.pkru != vmx->host_pkru) | ||
| 6562 | __write_pkru(vcpu->arch.pkru); | ||
| 6563 | |||
| 6564 | pt_guest_enter(vmx); | ||
| 6565 | |||
| 6566 | atomic_switch_perf_msrs(vmx); | ||
| 6567 | |||
| 6568 | vmx_update_hv_timer(vcpu); | ||
| 6569 | |||
| 6570 | /* | ||
| 6571 | * If this vCPU has touched SPEC_CTRL, restore the guest's value if | ||
| 6572 | * it's non-zero. Since vmentry is serialising on affected CPUs, there | ||
| 6573 | * is no need to worry about the conditional branch over the wrmsr | ||
| 6574 | * being speculatively taken. | ||
| 6575 | */ | ||
| 6576 | x86_spec_ctrl_set_guest(vmx->spec_ctrl, 0); | ||
| 6577 | |||
| 6578 | __vmx_vcpu_run(vcpu, vmx); | ||
| 6570 | 6579 | ||
| 6571 | /* | 6580 | /* |
| 6572 | * We do not use IBRS in the kernel. If this vCPU has used the | 6581 | * We do not use IBRS in the kernel. If this vCPU has used the |
| @@ -6648,7 +6657,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) · 75 unmodified lines | |||
| 6648 | vmx_recover_nmi_blocking(vmx); | 6657 | vmx_recover_nmi_blocking(vmx); |
| 6649 | vmx_complete_interrupts(vmx); | 6658 | vmx_complete_interrupts(vmx); |
| 6650 | } | 6659 | } |
| 6651 | STACK_FRAME_NON_STANDARD(vmx_vcpu_run); | ||
| 6652 | 6660 | ||
| 6653 | static struct kvm *vmx_vm_alloc(void) | 6661 | static struct kvm *vmx_vm_alloc(void) |
| 6654 | { | 6662 | { |
| @@ -6816,7 +6824,7 @@ static int vmx_vm_init(struct kvm *kvm) · 161 unmodified lines | |||
| 6816 | * Warn upon starting the first VM in a potentially | 6824 | * Warn upon starting the first VM in a potentially |
| 6817 | * insecure environment. | 6825 | * insecure environment. |
| 6818 | */ | 6826 | */ |
| 6819 | if (cpu_smt_control == CPU_SMT_ENABLED) | 6827 | if (sched_smt_active()) |
| 6820 | pr_warn_once(L1TF_MSG_SMT); | 6828 | pr_warn_once(L1TF_MSG_SMT); |
| 6821 | if (l1tf_vmx_mitigation == VMENTER_L1D_FLUSH_NEVER) | 6829 | if (l1tf_vmx_mitigation == VMENTER_L1D_FLUSH_NEVER) |
| 6822 | pr_warn_once(L1TF_MSG_L1D); | 6830 | pr_warn_once(L1TF_MSG_L1D); |
| @@ -7044,7 +7052,7 @@ static void update_intel_pt_cfg(struct kvm_vcpu *vcpu) · 221 unmodified lines | |||
| 7044 | 7052 | ||
| 7045 | /* unmask address range configure area */ | 7053 | /* unmask address range configure area */ |
| 7046 | for (i = 0; i < vmx->pt_desc.addr_range; i++) | 7054 | for (i = 0; i < vmx->pt_desc.addr_range; i++) |
| 7047 | vmx->pt_desc.ctl_bitmask &= ~(0xf << (32 + i * 4)); | 7055 | vmx->pt_desc.ctl_bitmask &= ~(0xfULL << (32 + i * 4)); |
| 7048 | } | 7056 | } |
| 7049 | 7057 | ||
| 7050 | static void vmx_cpuid_update(struct kvm_vcpu *vcpu) | 7058 | static void vmx_cpuid_update(struct kvm_vcpu *vcpu) |
| @@ -3834,6 +3834,8 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu, · 3833 unmodified lines | |||
| 3834 | case KVM_CAP_HYPERV_SYNIC2: | 3834 | case KVM_CAP_HYPERV_SYNIC2: |
| 3835 | if (cap->args[0]) | 3835 | if (cap->args[0]) |
| 3836 | return -EINVAL; | 3836 | return -EINVAL; |
| 3837 | /* fall through */ | ||
| 3838 | |||
| 3837 | case KVM_CAP_HYPERV_SYNIC: | 3839 | case KVM_CAP_HYPERV_SYNIC: |
| 3838 | if (!irqchip_in_kernel(vcpu->kvm)) | 3840 | if (!irqchip_in_kernel(vcpu->kvm)) |
| 3839 | return -EINVAL; | 3841 | return -EINVAL; |
| @@ -5114,6 +5116,13 @@ int kvm_read_guest_virt(struct kvm_vcpu *vcpu, · 1274 unmodified lines | |||
| 5114 | { | 5116 | { |
| 5115 | u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; | 5117 | u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; |
| 5116 | 5118 | ||
| 5119 | /* | ||
| 5120 | * FIXME: this should call handle_emulation_failure if X86EMUL_IO_NEEDED | ||
| 5121 | * is returned, but our callers are not ready for that and they blindly | ||
| 5122 | * call kvm_inject_page_fault. Ensure that they at least do not leak | ||
| 5123 | * uninitialized kernel stack memory into cr2 and error code. | ||
| 5124 | */ | ||
| 5125 | memset(exception, 0, sizeof(*exception)); | ||
| 5117 | return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, access, | 5126 | return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, access, |
| 5118 | exception); | 5127 | exception); |
| 5119 | } | 5128 | } |
| @@ -6480,8 +6489,7 @@ restart: · 1360 unmodified lines | |||
| 6480 | toggle_interruptibility(vcpu, ctxt->interruptibility); | 6489 | toggle_interruptibility(vcpu, ctxt->interruptibility); |
| 6481 | vcpu->arch.emulate_regs_need_sync_to_vcpu = false; | 6490 | vcpu->arch.emulate_regs_need_sync_to_vcpu = false; |
| 6482 | kvm_rip_write(vcpu, ctxt->eip); | 6491 | kvm_rip_write(vcpu, ctxt->eip); |
| 6483 | if (r == EMULATE_DONE && | 6492 | if (r == EMULATE_DONE && ctxt->tf) |
| 6484 | (ctxt->tf || (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP))) | ||
| 6485 | kvm_vcpu_do_singlestep(vcpu, &r); | 6493 | kvm_vcpu_do_singlestep(vcpu, &r); |
| 6486 | if (!ctxt->have_exception || | 6494 | if (!ctxt->have_exception || |
| 6487 | exception_type(ctxt->exception.vector) == EXCPT_TRAP) | 6495 | exception_type(ctxt->exception.vector) == EXCPT_TRAP) |
| @@ -7093,10 +7101,10 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu) · 605 unmodified lines | |||
| 7093 | case KVM_HC_CLOCK_PAIRING: | 7101 | case KVM_HC_CLOCK_PAIRING: |
| 7094 | ret = kvm_pv_clock_pairing(vcpu, a0, a1); | 7102 | ret = kvm_pv_clock_pairing(vcpu, a0, a1); |
| 7095 | break; | 7103 | break; |
| 7104 | #endif | ||
| 7096 | case KVM_HC_SEND_IPI: | 7105 | case KVM_HC_SEND_IPI: |
| 7097 | ret = kvm_pv_send_ipi(vcpu->kvm, a0, a1, a2, a3, op_64_bit); | 7106 | ret = kvm_pv_send_ipi(vcpu->kvm, a0, a1, a2, a3, op_64_bit); |
| 7098 | break; | 7107 | break; |
| 7099 | #endif | ||
| 7100 | default: | 7108 | default: |
| 7101 | ret = -KVM_ENOSYS; | 7109 | ret = -KVM_ENOSYS; |
| 7102 | break; | 7110 | break; |
| @@ -7937,6 +7945,7 @@ static inline int vcpu_block(struct kvm *kvm, struct kvm_vcpu *vcpu) · 834 unmodified lines | |||
| 7937 | vcpu->arch.pv.pv_unhalted = false; | 7945 | vcpu->arch.pv.pv_unhalted = false; |
| 7938 | vcpu->arch.mp_state = | 7946 | vcpu->arch.mp_state = |
| 7939 | KVM_MP_STATE_RUNNABLE; | 7947 | KVM_MP_STATE_RUNNABLE; |
| 7948 | /* fall through */ | ||
| 7940 | case KVM_MP_STATE_RUNNABLE: | 7949 | case KVM_MP_STATE_RUNNABLE: |
| 7941 | vcpu->arch.apf.halted = false; | 7950 | vcpu->arch.apf.halted = false; |
| 7942 | break; | 7951 | break; |
| @@ -2,8 +2,11 @@ · 1 unmodified line | |||
| 2 | #include <linux/module.h> | 2 | #include <linux/module.h> |
| 3 | #include <linux/io.h> | 3 | #include <linux/io.h> |
| 4 | 4 | ||
| 5 | #define movs(type,to,from) \ | ||
| 6 | asm volatile("movs" type:"=&D" (to), "=&S" (from):"0" (to), "1" (from):"memory") | ||
| 7 | |||
| 5 | /* Originally from i386/string.h */ | 8 | /* Originally from i386/string.h */ |
| 6 | static __always_inline void __iomem_memcpy(void *to, const void *from, size_t n) | 9 | static __always_inline void rep_movs(void *to, const void *from, size_t n) |
| 7 | { | 10 | { |
| 8 | unsigned long d0, d1, d2; | 11 | unsigned long d0, d1, d2; |
| 9 | asm volatile("rep ; movsl\n\t" | 12 | asm volatile("rep ; movsl\n\t" |
| @@ -21,13 +24,37 @@ static __always_inline void __iomem_memcpy(void *to, const void *from, size_t n) · 11 unmodified lines | |||
| 21 | 24 | ||
| 22 | void memcpy_fromio(void *to, const volatile void __iomem *from, size_t n) | 25 | void memcpy_fromio(void *to, const volatile void __iomem *from, size_t n) |
| 23 | { | 26 | { |
| 24 | __iomem_memcpy(to, (const void *)from, n); | 27 | if (unlikely(!n)) |
| 28 | return; | ||
| 29 | |||
| 30 | /* Align any unaligned source IO */ | ||
| 31 | if (unlikely(1 & (unsigned long)from)) { | ||
| 32 | movs("b", to, from); | ||
| 33 | n--; | ||
| 34 | } | ||
| 35 | if (n > 1 && unlikely(2 & (unsigned long)from)) { | ||
| 36 | movs("w", to, from); | ||
| 37 | n-=2; | ||
| 38 | } | ||
| 39 | rep_movs(to, (const void *)from, n); | ||
| 25 | } | 40 | } |
| 26 | EXPORT_SYMBOL(memcpy_fromio); | 41 | EXPORT_SYMBOL(memcpy_fromio); |
| 27 | 42 | ||
| 28 | void memcpy_toio(volatile void __iomem *to, const void *from, size_t n) | 43 | void memcpy_toio(volatile void __iomem *to, const void *from, size_t n) |
| 29 | { | 44 | { |
| 30 | __iomem_memcpy((void *)to, (const void *) from, n); | 45 | if (unlikely(!n)) |
| 46 | return; | ||
| 47 | |||
| 48 | /* Align any unaligned destination IO */ | ||
| 49 | if (unlikely(1 & (unsigned long)to)) { | ||
| 50 | movs("b", to, from); | ||
| 51 | n--; | ||
| 52 | } | ||
| 53 | if (n > 1 && unlikely(2 & (unsigned long)to)) { | ||
| 54 | movs("w", to, from); | ||
| 55 | n-=2; | ||
| 56 | } | ||
| 57 | rep_movs((void *)to, (const void *) from, n); | ||
| 31 | } | 58 | } |
| 32 | EXPORT_SYMBOL(memcpy_toio); | 59 | EXPORT_SYMBOL(memcpy_toio); |
| 33 | 60 | ||
| @@ -36,8 +36,8 @@ static inline u16 i8254(void) · 35 unmodified lines | |||
| 36 | u16 status, timer; | 36 | u16 status, timer; |
| 37 | 37 | ||
| 38 | do { | 38 | do { |
| 39 | outb(I8254_PORT_CONTROL, | 39 | outb(I8254_CMD_READBACK | I8254_SELECT_COUNTER0, |
| 40 | I8254_CMD_READBACK | I8254_SELECT_COUNTER0); | 40 | I8254_PORT_CONTROL); |
| 41 | status = inb(I8254_PORT_COUNTER0); | 41 | status = inb(I8254_PORT_COUNTER0); |
| 42 | timer = inb(I8254_PORT_COUNTER0); | 42 | timer = inb(I8254_PORT_COUNTER0); |
| 43 | timer |= inb(I8254_PORT_COUNTER0) << 8; | 43 | timer |= inb(I8254_PORT_COUNTER0) << 8; |
| @@ -595,7 +595,7 @@ static void show_ldttss(const struct desc_ptr *gdt, const char *name, u16 index) · 594 unmodified lines | |||
| 595 | return; | 595 | return; |
| 596 | } | 596 | } |
| 597 | 597 | ||
| 598 | addr = desc.base0 | (desc.base1 << 16) | (desc.base2 << 24); | 598 | addr = desc.base0 | (desc.base1 << 16) | ((unsigned long)desc.base2 << 24); |
| 599 | #ifdef CONFIG_X86_64 | 599 | #ifdef CONFIG_X86_64 |
| 600 | addr |= ((u64)desc.base3 << 32); | 600 | addr |= ((u64)desc.base3 << 32); |
| 601 | #endif | 601 | #endif |
| @@ -158,8 +158,8 @@ static void __init sme_populate_pgd(struct sme_populate_pgd_data *ppd) · 157 unmodified lines | |||
| 158 | pmd = pmd_offset(pud, ppd->vaddr); | 158 | pmd = pmd_offset(pud, ppd->vaddr); |
| 159 | if (pmd_none(*pmd)) { | 159 | if (pmd_none(*pmd)) { |
| 160 | pte = ppd->pgtable_area; | 160 | pte = ppd->pgtable_area; |
| 161 | memset(pte, 0, sizeof(pte) * PTRS_PER_PTE); | 161 | memset(pte, 0, sizeof(*pte) * PTRS_PER_PTE); |
| 162 | ppd->pgtable_area += sizeof(pte) * PTRS_PER_PTE; | 162 | ppd->pgtable_area += sizeof(*pte) * PTRS_PER_PTE; |
| 163 | set_pmd(pmd, __pmd(PMD_FLAGS | __pa(pte))); | 163 | set_pmd(pmd, __pmd(PMD_FLAGS | __pa(pte))); |
| 164 | } | 164 | } |
| 165 | 165 | ||
| @@ -230,6 +230,29 @@ static bool __cpa_pfn_in_highmap(unsigned long pfn) · 229 unmodified lines | |||
| 230 | 230 | ||
| 231 | #endif | 231 | #endif |
| 232 | 232 | ||
| 233 | /* | ||
| 234 | * See set_mce_nospec(). | ||
| 235 | * | ||
| 236 | * Machine check recovery code needs to change cache mode of poisoned pages to | ||
| 237 | * UC to avoid speculative access logging another error. But passing the | ||
| 238 | * address of the 1:1 mapping to set_memory_uc() is a fine way to encourage a | ||
| 239 | * speculative access. So we cheat and flip the top bit of the address. This | ||
| 240 | * works fine for the code that updates the page tables. But at the end of the | ||
| 241 | * process we need to flush the TLB and cache and the non-canonical address | ||
| 242 | * causes a #GP fault when used by the INVLPG and CLFLUSH instructions. | ||
| 243 | * | ||
| 244 | * But in the common case we already have a canonical address. This code | ||
| 245 | * will fix the top bit if needed and is a no-op otherwise. | ||
| 246 | */ | ||
| 247 | static inline unsigned long fix_addr(unsigned long addr) | ||
| 248 | { | ||
| 249 | #ifdef CONFIG_X86_64 | ||
| 250 | return (long)(addr << 1) >> 1; | ||
| 251 | #else | ||
| 252 | return addr; | ||
| 253 | #endif | ||
| 254 | } | ||
| 255 | |||
| 233 | static unsigned long __cpa_addr(struct cpa_data *cpa, unsigned long idx) | 256 | static unsigned long __cpa_addr(struct cpa_data *cpa, unsigned long idx) |
| 234 | { | 257 | { |
| 235 | if (cpa->flags & CPA_PAGES_ARRAY) { | 258 | if (cpa->flags & CPA_PAGES_ARRAY) { |
| @@ -313,7 +336,7 @@ void __cpa_flush_tlb(void *data) · 77 unmodified lines | |||
| 313 | unsigned int i; | 336 | unsigned int i; |
| 314 | 337 | ||
| 315 | for (i = 0; i < cpa->numpages; i++) | 338 | for (i = 0; i < cpa->numpages; i++) |
| 316 | __flush_tlb_one_kernel(__cpa_addr(cpa, i)); | 339 | __flush_tlb_one_kernel(fix_addr(__cpa_addr(cpa, i))); |
| 317 | } | 340 | } |
| 318 | 341 | ||
| 319 | static void cpa_flush(struct cpa_data *data, int cache) | 342 | static void cpa_flush(struct cpa_data *data, int cache) |
| @@ -347,7 +370,7 @@ static void cpa_flush(struct cpa_data *data, int cache) · 27 unmodified lines | |||
| 347 | * Only flush present addresses: | 370 | * Only flush present addresses: |
| 348 | */ | 371 | */ |
| 349 | if (pte && (pte_val(*pte) & _PAGE_PRESENT)) | 372 | if (pte && (pte_val(*pte) & _PAGE_PRESENT)) |
| 350 | clflush_cache_range_opt((void *)addr, PAGE_SIZE); | 373 | clflush_cache_range_opt((void *)fix_addr(addr), PAGE_SIZE); |
| 351 | } | 374 | } |
| 352 | mb(); | 375 | mb(); |
| 353 | } | 376 | } |
| @@ -1627,29 +1650,6 @@ out: · 1273 unmodified lines | |||
| 1627 | return ret; | 1650 | return ret; |
| 1628 | } | 1651 | } |
| 1629 | 1652 | ||
| 1630 | /* | ||
| 1631 | * Machine check recovery code needs to change cache mode of poisoned | ||
| 1632 | * pages to UC to avoid speculative access logging another error. But | ||
| 1633 | * passing the address of the 1:1 mapping to set_memory_uc() is a fine | ||
| 1634 | * way to encourage a speculative access. So we cheat and flip the top | ||
| 1635 | * bit of the address. This works fine for the code that updates the | ||
| 1636 | * page tables. But at the end of the process we need to flush the cache | ||
| 1637 | * and the non-canonical address causes a #GP fault when used by the | ||
| 1638 | * CLFLUSH instruction. | ||
| 1639 | * | ||
| 1640 | * But in the common case we already have a canonical address. This code | ||
| 1641 | * will fix the top bit if needed and is a no-op otherwise. | ||
| 1642 | */ | ||
| 1643 | static inline unsigned long make_addr_canonical_again(unsigned long addr) | ||
| 1644 | { | ||
| 1645 | #ifdef CONFIG_X86_64 | ||
| 1646 | return (long)(addr << 1) >> 1; | ||
| 1647 | #else | ||
| 1648 | return addr; | ||
| 1649 | #endif | ||
| 1650 | } | ||
| 1651 | |||
| 1652 | |||
| 1653 | static int change_page_attr_set_clr(unsigned long *addr, int numpages, | 1653 | static int change_page_attr_set_clr(unsigned long *addr, int numpages, |
| 1654 | pgprot_t mask_set, pgprot_t mask_clr, | 1654 | pgprot_t mask_set, pgprot_t mask_clr, |
| 1655 | int force_split, int in_flag, | 1655 | int force_split, int in_flag, |
| @@ -898,10 +898,7 @@ static u64 xen_read_msr_safe(unsigned int msr, int *err) · 897 unmodified lines | |||
| 898 | val = native_read_msr_safe(msr, err); | 898 | val = native_read_msr_safe(msr, err); |
| 899 | switch (msr) { | 899 | switch (msr) { |
| 900 | case MSR_IA32_APICBASE: | 900 | case MSR_IA32_APICBASE: |
| 901 | #ifdef CONFIG_X86_X2APIC | 901 | val &= ~X2APIC_ENABLE; |
| 902 | if (!(cpuid_ecx(1) & (1 << (X86_FEATURE_X2APIC & 31)))) | ||
| 903 | #endif | ||
| 904 | val &= ~X2APIC_ENABLE; | ||
| 905 | break; | 902 | break; |
| 906 | } | 903 | } |
| 907 | return val; | 904 | return val; |
| @@ -361,8 +361,6 @@ void xen_timer_resume(void) · 360 unmodified lines | |||
| 361 | { | 361 | { |
| 362 | int cpu; | 362 | int cpu; |
| 363 | 363 | ||
| 364 | pvclock_resume(); | ||
| 365 | |||
| 366 | if (xen_clockevent != &xen_vcpuop_clockevent) | 364 | if (xen_clockevent != &xen_vcpuop_clockevent) |
| 367 | return; | 365 | return; |
| 368 | 366 | ||
| @@ -379,12 +377,15 @@ static const struct pv_time_ops xen_time_ops __initconst = { · 10 unmodified lines | |||
| 379 | }; | 377 | }; |
| 380 | 378 | ||
| 381 | static struct pvclock_vsyscall_time_info *xen_clock __read_mostly; | 379 | static struct pvclock_vsyscall_time_info *xen_clock __read_mostly; |
| 380 | static u64 xen_clock_value_saved; | ||
| 382 | 381 | ||
| 383 | void xen_save_time_memory_area(void) | 382 | void xen_save_time_memory_area(void) |
| 384 | { | 383 | { |
| 385 | struct vcpu_register_time_memory_area t; | 384 | struct vcpu_register_time_memory_area t; |
| 386 | int ret; | 385 | int ret; |
| 387 | 386 | ||
| 387 | xen_clock_value_saved = xen_clocksource_read() - xen_sched_clock_offset; | ||
| 388 | |||
| 388 | if (!xen_clock) | 389 | if (!xen_clock) |
| 389 | return; | 390 | return; |
| 390 | 391 | ||
| @@ -404,7 +405,7 @@ void xen_restore_time_memory_area(void) · 13 unmodified lines | |||
| 404 | int ret; | 405 | int ret; |
| 405 | 406 | ||
| 406 | if (!xen_clock) | 407 | if (!xen_clock) |
| 407 | return; | 408 | goto out; |
| 408 | 409 | ||
| 409 | t.addr.v = &xen_clock->pvti; | 410 | t.addr.v = &xen_clock->pvti; |
| 410 | 411 | ||
| @@ -421,6 +422,11 @@ void xen_restore_time_memory_area(void) · 10 unmodified lines | |||
| 421 | if (ret != 0) | 422 | if (ret != 0) |
| 422 | pr_notice("Cannot restore secondary vcpu_time_info (err %d)", | 423 | pr_notice("Cannot restore secondary vcpu_time_info (err %d)", |
| 423 | ret); | 424 | ret); |
| 425 | |||
| 426 | out: | ||
| 427 | /* Need pvclock_resume() before using xen_clocksource_read(). */ | ||
| 428 | pvclock_resume(); | ||
| 429 | xen_sched_clock_offset = xen_clocksource_read() - xen_clock_value_saved; | ||
| 424 | } | 430 | } |
| 425 | 431 | ||
| 426 | static void xen_setup_vsyscall_time_info(void) | 432 | static void xen_setup_vsyscall_time_info(void) |
| @@ -164,7 +164,7 @@ config XTENSA_FAKE_NMI · 163 unmodified lines | |||
| 164 | If unsure, say N. | 164 | If unsure, say N. |
| 165 | 165 | ||
| 166 | config XTENSA_UNALIGNED_USER | 166 | config XTENSA_UNALIGNED_USER |
| 167 | bool "Unaligned memory access in use space" | 167 | bool "Unaligned memory access in user space" |
| 168 | help | 168 | help |
| 169 | The Xtensa architecture currently does not handle unaligned | 169 | The Xtensa architecture currently does not handle unaligned |
| 170 | memory accesses in hardware but through an exception handler. | 170 | memory accesses in hardware but through an exception handler. |
| @@ -451,7 +451,7 @@ config USE_OF · 280 unmodified lines | |||
| 451 | help | 451 | help |
| 452 | Include support for flattened device tree machine descriptions. | 452 | Include support for flattened device tree machine descriptions. |
| 453 | 453 | ||
| 454 | config BUILTIN_DTB | 454 | config BUILTIN_DTB_SOURCE |
| 455 | string "DTB to build into the kernel image" | 455 | string "DTB to build into the kernel image" |
| 456 | depends on OF | 456 | depends on OF |
| 457 | 457 | ||
| @@ -7,9 +7,9 @@ · 6 unmodified lines | |||
| 7 | # | 7 | # |
| 8 | # | 8 | # |
| 9 | 9 | ||
| 10 | BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB)).dtb.o | 10 | BUILTIN_DTB_SOURCE := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o |
| 11 | ifneq ($(CONFIG_BUILTIN_DTB),"") | 11 | ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"") |
| 12 | obj-$(CONFIG_OF) += $(BUILTIN_DTB) | 12 | obj-$(CONFIG_OF) += $(BUILTIN_DTB_SOURCE) |
| 13 | endif | 13 | endif |
| 14 | 14 | ||
| 15 | # for CONFIG_OF_ALL_DTBS test | 15 | # for CONFIG_OF_ALL_DTBS test |
| @@ -34,7 +34,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y · 33 unmodified lines | |||
| 34 | CONFIG_CMDLINE_BOOL=y | 34 | CONFIG_CMDLINE_BOOL=y |
| 35 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0" | 35 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0" |
| 36 | CONFIG_USE_OF=y | 36 | CONFIG_USE_OF=y |
| 37 | CONFIG_BUILTIN_DTB="kc705" | 37 | CONFIG_BUILTIN_DTB_SOURCE="kc705" |
| 38 | # CONFIG_COMPACTION is not set | 38 | # CONFIG_COMPACTION is not set |
| 39 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 39 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
| 40 | CONFIG_PM=y | 40 | CONFIG_PM=y |
| @@ -38,7 +38,7 @@ CONFIG_HIGHMEM=y · 37 unmodified lines | |||
| 38 | # CONFIG_PCI is not set | 38 | # CONFIG_PCI is not set |
| 39 | CONFIG_XTENSA_PLATFORM_XTFPGA=y | 39 | CONFIG_XTENSA_PLATFORM_XTFPGA=y |
| 40 | CONFIG_USE_OF=y | 40 | CONFIG_USE_OF=y |
| 41 | CONFIG_BUILTIN_DTB="csp" | 41 | CONFIG_BUILTIN_DTB_SOURCE="csp" |
| 42 | # CONFIG_COMPACTION is not set | 42 | # CONFIG_COMPACTION is not set |
| 43 | CONFIG_XTFPGA_LCD=y | 43 | CONFIG_XTFPGA_LCD=y |
| 44 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 44 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
| @@ -33,7 +33,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y · 32 unmodified lines | |||
| 33 | CONFIG_CMDLINE_BOOL=y | 33 | CONFIG_CMDLINE_BOOL=y |
| 34 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0" | 34 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0" |
| 35 | CONFIG_USE_OF=y | 35 | CONFIG_USE_OF=y |
| 36 | CONFIG_BUILTIN_DTB="kc705" | 36 | CONFIG_BUILTIN_DTB_SOURCE="kc705" |
| 37 | # CONFIG_COMPACTION is not set | 37 | # CONFIG_COMPACTION is not set |
| 38 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 38 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
| 39 | CONFIG_NET=y | 39 | CONFIG_NET=y |
| @@ -39,7 +39,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y · 38 unmodified lines | |||
| 39 | CONFIG_CMDLINE_BOOL=y | 39 | CONFIG_CMDLINE_BOOL=y |
| 40 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0x9d050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=256M@0x60000000" | 40 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0x9d050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=256M@0x60000000" |
| 41 | CONFIG_USE_OF=y | 41 | CONFIG_USE_OF=y |
| 42 | CONFIG_BUILTIN_DTB="kc705_nommu" | 42 | CONFIG_BUILTIN_DTB_SOURCE="kc705_nommu" |
| 43 | CONFIG_BINFMT_FLAT=y | 43 | CONFIG_BINFMT_FLAT=y |
| 44 | CONFIG_NET=y | 44 | CONFIG_NET=y |
| 45 | CONFIG_PACKET=y | 45 | CONFIG_PACKET=y |
| @@ -33,11 +33,12 @@ CONFIG_SMP=y · 32 unmodified lines | |||
| 33 | CONFIG_HOTPLUG_CPU=y | 33 | CONFIG_HOTPLUG_CPU=y |
| 34 | # CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is not set | 34 | # CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is not set |
| 35 | # CONFIG_PCI is not set | 35 | # CONFIG_PCI is not set |
| 36 | CONFIG_VECTORS_OFFSET=0x00002000 | ||
| 36 | CONFIG_XTENSA_PLATFORM_XTFPGA=y | 37 | CONFIG_XTENSA_PLATFORM_XTFPGA=y |
| 37 | CONFIG_CMDLINE_BOOL=y | 38 | CONFIG_CMDLINE_BOOL=y |
| 38 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=96M@0" | 39 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=96M@0" |
| 39 | CONFIG_USE_OF=y | 40 | CONFIG_USE_OF=y |
| 40 | CONFIG_BUILTIN_DTB="lx200mx" | 41 | CONFIG_BUILTIN_DTB_SOURCE="lx200mx" |
| 41 | # CONFIG_COMPACTION is not set | 42 | # CONFIG_COMPACTION is not set |
| 42 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 43 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
| 43 | CONFIG_NET=y | 44 | CONFIG_NET=y |
| @@ -276,12 +276,13 @@ should_never_return: · 275 unmodified lines | |||
| 276 | 276 | ||
| 277 | movi a2, cpu_start_ccount | 277 | movi a2, cpu_start_ccount |
| 278 | 1: | 278 | 1: |
| 279 | memw | ||
| 279 | l32i a3, a2, 0 | 280 | l32i a3, a2, 0 |
| 280 | beqi a3, 0, 1b | 281 | beqi a3, 0, 1b |
| 281 | movi a3, 0 | 282 | movi a3, 0 |
| 282 | s32i a3, a2, 0 | 283 | s32i a3, a2, 0 |
| 283 | memw | ||
| 284 | 1: | 284 | 1: |
| 285 | memw | ||
| 285 | l32i a3, a2, 0 | 286 | l32i a3, a2, 0 |
| 286 | beqi a3, 0, 1b | 287 | beqi a3, 0, 1b |
| 287 | wsr a3, ccount | 288 | wsr a3, ccount |
| @@ -317,11 +318,13 @@ ENTRY(cpu_restart) · 29 unmodified lines | |||
| 317 | rsr a0, prid | 318 | rsr a0, prid |
| 318 | neg a2, a0 | 319 | neg a2, a0 |
| 319 | movi a3, cpu_start_id | 320 | movi a3, cpu_start_id |
| 321 | memw | ||
| 320 | s32i a2, a3, 0 | 322 | s32i a2, a3, 0 |
| 321 | #if XCHAL_DCACHE_IS_WRITEBACK | 323 | #if XCHAL_DCACHE_IS_WRITEBACK |
| 322 | dhwbi a3, 0 | 324 | dhwbi a3, 0 |
| 323 | #endif | 325 | #endif |
| 324 | 1: | 326 | 1: |
| 327 | memw | ||
| 325 | l32i a2, a3, 0 | 328 | l32i a2, a3, 0 |
| 326 | dhi a3, 0 | 329 | dhi a3, 0 |
| 327 | bne a2, a0, 1b | 330 | bne a2, a0, 1b |
| @@ -83,7 +83,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) · 82 unmodified lines | |||
| 83 | { | 83 | { |
| 84 | unsigned i; | 84 | unsigned i; |
| 85 | 85 | ||
| 86 | for (i = 0; i < max_cpus; ++i) | 86 | for_each_possible_cpu(i) |
| 87 | set_cpu_present(i, true); | 87 | set_cpu_present(i, true); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| @@ -96,6 +96,11 @@ void __init smp_init_cpus(void) · 6 unmodified lines | |||
| 96 | pr_info("%s: Core Count = %d\n", __func__, ncpus); | 96 | pr_info("%s: Core Count = %d\n", __func__, ncpus); |
| 97 | pr_info("%s: Core Id = %d\n", __func__, core_id); | 97 | pr_info("%s: Core Id = %d\n", __func__, core_id); |
| 98 | 98 | ||
| 99 | if (ncpus > NR_CPUS) { | ||
| 100 | ncpus = NR_CPUS; | ||
| 101 | pr_info("%s: limiting core count by %d\n", __func__, ncpus); | ||
| 102 | } | ||
| 103 | |||
| 99 | for (i = 0; i < ncpus; ++i) | 104 | for (i = 0; i < ncpus; ++i) |
| 100 | set_cpu_possible(i, true); | 105 | set_cpu_possible(i, true); |
| 101 | } | 106 | } |
| @@ -195,9 +200,11 @@ static int boot_secondary(unsigned int cpu, struct task_struct *ts) · 93 unmodified lines | |||
| 195 | int i; | 200 | int i; |
| 196 | 201 | ||
| 197 | #ifdef CONFIG_HOTPLUG_CPU | 202 | #ifdef CONFIG_HOTPLUG_CPU |
| 198 | cpu_start_id = cpu; | 203 | WRITE_ONCE(cpu_start_id, cpu); |
| 199 | system_flush_invalidate_dcache_range( | 204 | /* Pairs with the third memw in the cpu_restart */ |
| 200 | (unsigned long)&cpu_start_id, sizeof(cpu_start_id)); | 205 | mb(); |
| 206 | system_flush_invalidate_dcache_range((unsigned long)&cpu_start_id, | ||
| 207 | sizeof(cpu_start_id)); | ||
| 201 | #endif | 208 | #endif |
| 202 | smp_call_function_single(0, mx_cpu_start, (void *)cpu, 1); | 209 | smp_call_function_single(0, mx_cpu_start, (void *)cpu, 1); |
| 203 | 210 | ||
| @@ -206,18 +213,21 @@ static int boot_secondary(unsigned int cpu, struct task_struct *ts) · 2 unmodified lines | |||
| 206 | ccount = get_ccount(); | 213 | ccount = get_ccount(); |
| 207 | while (!ccount); | 214 | while (!ccount); |
| 208 | 215 | ||
| 209 | cpu_start_ccount = ccount; | 216 | WRITE_ONCE(cpu_start_ccount, ccount); |
| 210 | 217 | ||
| 211 | while (time_before(jiffies, timeout)) { | 218 | do { |
| 219 | /* | ||
| 220 | * Pairs with the first two memws in the | ||
| 221 | * .Lboot_secondary. | ||
| 222 | */ | ||
| 212 | mb(); | 223 | mb(); |
| 213 | if (!cpu_start_ccount) | 224 | ccount = READ_ONCE(cpu_start_ccount); |
| 214 | break; | 225 | } while (ccount && time_before(jiffies, timeout)); |
| 215 | } | ||
| 216 | 226 | ||
| 217 | if (cpu_start_ccount) { | 227 | if (ccount) { |
| 218 | smp_call_function_single(0, mx_cpu_stop, | 228 | smp_call_function_single(0, mx_cpu_stop, |
| 219 | (void *)cpu, 1); | 229 | (void *)cpu, 1); |
| 220 | cpu_start_ccount = 0; | 230 | WRITE_ONCE(cpu_start_ccount, 0); |
| 221 | return -EIO; | 231 | return -EIO; |
| 222 | } | 232 | } |
| 223 | } | 233 | } |
| @@ -237,6 +247,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) · 13 unmodified lines | |||
| 237 | pr_debug("%s: Calling wakeup_secondary(cpu:%d, idle:%p, sp: %08lx)\n", | 247 | pr_debug("%s: Calling wakeup_secondary(cpu:%d, idle:%p, sp: %08lx)\n", |
| 238 | __func__, cpu, idle, start_info.stack); | 248 | __func__, cpu, idle, start_info.stack); |
| 239 | 249 | ||
| 250 | init_completion(&cpu_running); | ||
| 240 | ret = boot_secondary(cpu, idle); | 251 | ret = boot_secondary(cpu, idle); |
| 241 | if (ret == 0) { | 252 | if (ret == 0) { |
| 242 | wait_for_completion_timeout(&cpu_running, | 253 | wait_for_completion_timeout(&cpu_running, |
| @@ -298,8 +309,10 @@ void __cpu_die(unsigned int cpu) · 55 unmodified lines | |||
| 298 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); | 309 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); |
| 299 | while (time_before(jiffies, timeout)) { | 310 | while (time_before(jiffies, timeout)) { |
| 300 | system_invalidate_dcache_range((unsigned long)&cpu_start_id, | 311 | system_invalidate_dcache_range((unsigned long)&cpu_start_id, |
| 301 | sizeof(cpu_start_id)); | 312 | sizeof(cpu_start_id)); |
| 302 | if (cpu_start_id == -cpu) { | 313 | /* Pairs with the second memw in the cpu_restart */ |
| 314 | mb(); | ||
| 315 | if (READ_ONCE(cpu_start_id) == -cpu) { | ||
| 303 | platform_cpu_kill(cpu); | 316 | platform_cpu_kill(cpu); |
| 304 | return; | 317 | return; |
| 305 | } | 318 | } |
| @@ -89,7 +89,7 @@ static int ccount_timer_shutdown(struct clock_event_device *evt) · 88 unmodified lines | |||
| 89 | container_of(evt, struct ccount_timer, evt); | 89 | container_of(evt, struct ccount_timer, evt); |
| 90 | 90 | ||
| 91 | if (timer->irq_enabled) { | 91 | if (timer->irq_enabled) { |
| 92 | disable_irq(evt->irq); | 92 | disable_irq_nosync(evt->irq); |
| 93 | timer->irq_enabled = 0; | 93 | timer->irq_enabled = 0; |
| 94 | } | 94 | } |
| 95 | return 0; | 95 | return 0; |
| @@ -1154,15 +1154,14 @@ static void bfq_activate_requeue_entity(struct bfq_entity *entity, · 1153 unmodified lines | |||
| 1154 | } | 1154 | } |
| 1155 | 1155 | ||
| 1156 | /** | 1156 | /** |
| 1157 | * __bfq_deactivate_entity - deactivate an entity from its service tree. | 1157 | * __bfq_deactivate_entity - update sched_data and service trees for |
| 1158 | * @entity: the entity to deactivate. | 1158 | * entity, so as to represent entity as inactive |
| 1159 | * @entity: the entity being deactivated. | ||
| 1159 | * @ins_into_idle_tree: if false, the entity will not be put into the | 1160 | * @ins_into_idle_tree: if false, the entity will not be put into the |
| 1160 | * idle tree. | 1161 | * idle tree. |
| 1161 | * | 1162 | * |
| 1162 | * Deactivates an entity, independently of its previous state. Must | 1163 | * If necessary and allowed, puts entity into the idle tree. NOTE: |
| 1163 | * be invoked only if entity is on a service tree. Extracts the entity | 1164 | * entity may be on no tree if in service. |
| 1164 | * from that tree, and if necessary and allowed, puts it into the idle | ||
| 1165 | * tree. | ||
| 1166 | */ | 1165 | */ |
| 1167 | bool __bfq_deactivate_entity(struct bfq_entity *entity, bool ins_into_idle_tree) | 1166 | bool __bfq_deactivate_entity(struct bfq_entity *entity, bool ins_into_idle_tree) |
| 1168 | { | 1167 | { |
| @@ -462,6 +462,10 @@ static void blk_rq_timed_out_timer(struct timer_list *t) · 461 unmodified lines | |||
| 462 | kblockd_schedule_work(&q->timeout_work); | 462 | kblockd_schedule_work(&q->timeout_work); |
| 463 | } | 463 | } |
| 464 | 464 | ||
| 465 | static void blk_timeout_work(struct work_struct *work) | ||
| 466 | { | ||
| 467 | } | ||
| 468 | |||
| 465 | /** | 469 | /** |
| 466 | * blk_alloc_queue_node - allocate a request queue | 470 | * blk_alloc_queue_node - allocate a request queue |
| 467 | * @gfp_mask: memory allocation flags | 471 | * @gfp_mask: memory allocation flags |
| @@ -505,7 +509,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) · 37 unmodified lines | |||
| 505 | timer_setup(&q->backing_dev_info->laptop_mode_wb_timer, | 509 | timer_setup(&q->backing_dev_info->laptop_mode_wb_timer, |
| 506 | laptop_mode_timer_fn, 0); | 510 | laptop_mode_timer_fn, 0); |
| 507 | timer_setup(&q->timeout, blk_rq_timed_out_timer, 0); | 511 | timer_setup(&q->timeout, blk_rq_timed_out_timer, 0); |
| 508 | INIT_WORK(&q->timeout_work, NULL); | 512 | INIT_WORK(&q->timeout_work, blk_timeout_work); |
| 509 | INIT_LIST_HEAD(&q->icq_list); | 513 | INIT_LIST_HEAD(&q->icq_list); |
| 510 | #ifdef CONFIG_BLK_CGROUP | 514 | #ifdef CONFIG_BLK_CGROUP |
| 511 | INIT_LIST_HEAD(&q->blkg_list); | 515 | INIT_LIST_HEAD(&q->blkg_list); |
| @@ -661,7 +665,6 @@ no_merge: · 149 unmodified lines | |||
| 661 | * blk_attempt_plug_merge - try to merge with %current's plugged list | 665 | * blk_attempt_plug_merge - try to merge with %current's plugged list |
| 662 | * @q: request_queue new bio is being queued at | 666 | * @q: request_queue new bio is being queued at |
| 663 | * @bio: new bio being queued | 667 | * @bio: new bio being queued |
| 664 | * @request_count: out parameter for number of traversed plugged requests | ||
| 665 | * @same_queue_rq: pointer to &struct request that gets filled in when | 668 | * @same_queue_rq: pointer to &struct request that gets filled in when |
| 666 | * another request associated with @q is found on the plug list | 669 | * another request associated with @q is found on the plug list |
| 667 | * (optional, may be %NULL) | 670 | * (optional, may be %NULL) |
| @@ -1683,6 +1686,15 @@ EXPORT_SYMBOL(kblockd_mod_delayed_work_on); · 1015 unmodified lines | |||
| 1683 | * @plug: The &struct blk_plug that needs to be initialized | 1686 | * @plug: The &struct blk_plug that needs to be initialized |
| 1684 | * | 1687 | * |
| 1685 | * Description: | 1688 | * Description: |
| 1689 | * blk_start_plug() indicates to the block layer an intent by the caller | ||
| 1690 | * to submit multiple I/O requests in a batch. The block layer may use | ||
| 1691 | * this hint to defer submitting I/Os from the caller until blk_finish_plug() | ||
| 1692 | * is called. However, the block layer may choose to submit requests | ||
| 1693 | * before a call to blk_finish_plug() if the number of queued I/Os | ||
| 1694 | * exceeds %BLK_MAX_REQUEST_COUNT, or if the size of the I/O is larger than | ||
| 1695 | * %BLK_PLUG_FLUSH_SIZE. The queued I/Os may also be submitted early if | ||
| 1696 | * the task schedules (see below). | ||
| 1697 | * | ||
| 1686 | * Tracking blk_plug inside the task_struct will help with auto-flushing the | 1698 | * Tracking blk_plug inside the task_struct will help with auto-flushing the |
| 1687 | * pending I/O should the task end up blocking between blk_start_plug() and | 1699 | * pending I/O should the task end up blocking between blk_start_plug() and |
| 1688 | * blk_finish_plug(). This is important from a performance perspective, but | 1700 | * blk_finish_plug(). This is important from a performance perspective, but |
| @@ -1765,6 +1777,16 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule) · 76 unmodified lines | |||
| 1765 | blk_mq_flush_plug_list(plug, from_schedule); | 1777 | blk_mq_flush_plug_list(plug, from_schedule); |
| 1766 | } | 1778 | } |
| 1767 | 1779 | ||
| 1780 | /** | ||
| 1781 | * blk_finish_plug - mark the end of a batch of submitted I/O | ||
| 1782 | * @plug: The &struct blk_plug passed to blk_start_plug() | ||
| 1783 | * | ||
| 1784 | * Description: | ||
| 1785 | * Indicate that a batch of I/O submissions is complete. This function | ||
| 1786 | * must be paired with an initial call to blk_start_plug(). The intent | ||
| 1787 | * is to allow the block layer to optimize I/O submission. See the | ||
| 1788 | * documentation for blk_start_plug() for more information. | ||
| 1789 | */ | ||
| 1768 | void blk_finish_plug(struct blk_plug *plug) | 1790 | void blk_finish_plug(struct blk_plug *plug) |
| 1769 | { | 1791 | { |
| 1770 | if (plug != current->plug) | 1792 | if (plug != current->plug) |
| @@ -335,7 +335,7 @@ static void mq_flush_data_end_io(struct request *rq, blk_status_t error) · 334 unmodified lines | |||
| 335 | blk_flush_complete_seq(rq, fq, REQ_FSEQ_DATA, error); | 335 | blk_flush_complete_seq(rq, fq, REQ_FSEQ_DATA, error); |
| 336 | spin_unlock_irqrestore(&fq->mq_flush_lock, flags); | 336 | spin_unlock_irqrestore(&fq->mq_flush_lock, flags); |
| 337 | 337 | ||
| 338 | blk_mq_run_hw_queue(hctx, true); | 338 | blk_mq_sched_restart(hctx); |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | /** | 341 | /** |
| @@ -72,6 +72,7 @@ · 71 unmodified lines | |||
| 72 | #include <linux/sched/loadavg.h> | 72 | #include <linux/sched/loadavg.h> |
| 73 | #include <linux/sched/signal.h> | 73 | #include <linux/sched/signal.h> |
| 74 | #include <trace/events/block.h> | 74 | #include <trace/events/block.h> |
| 75 | #include <linux/blk-mq.h> | ||
| 75 | #include "blk-rq-qos.h" | 76 | #include "blk-rq-qos.h" |
| 76 | #include "blk-stat.h" | 77 | #include "blk-stat.h" |
| 77 | 78 | ||
| @@ -591,6 +592,7 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) · 513 unmodified lines | |||
| 591 | u64 now = ktime_to_ns(ktime_get()); | 592 | u64 now = ktime_to_ns(ktime_get()); |
| 592 | bool issue_as_root = bio_issue_as_root_blkg(bio); | 593 | bool issue_as_root = bio_issue_as_root_blkg(bio); |
| 593 | bool enabled = false; | 594 | bool enabled = false; |
| 595 | int inflight = 0; | ||
| 594 | 596 | ||
| 595 | blkg = bio->bi_blkg; | 597 | blkg = bio->bi_blkg; |
| 596 | if (!blkg || !bio_flagged(bio, BIO_TRACKED)) | 598 | if (!blkg || !bio_flagged(bio, BIO_TRACKED)) |
| @@ -601,6 +603,9 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) · 4 unmodified lines | |||
| 601 | return; | 603 | return; |
| 602 | 604 | ||
| 603 | enabled = blk_iolatency_enabled(iolat->blkiolat); | 605 | enabled = blk_iolatency_enabled(iolat->blkiolat); |
| 606 | if (!enabled) | ||
| 607 | return; | ||
| 608 | |||
| 604 | while (blkg && blkg->parent) { | 609 | while (blkg && blkg->parent) { |
| 605 | iolat = blkg_to_lat(blkg); | 610 | iolat = blkg_to_lat(blkg); |
| 606 | if (!iolat) { | 611 | if (!iolat) { |
| @@ -609,8 +614,9 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) · 2 unmodified lines | |||
| 609 | } | 614 | } |
| 610 | rqw = &iolat->rq_wait; | 615 | rqw = &iolat->rq_wait; |
| 611 | 616 | ||
| 612 | atomic_dec(&rqw->inflight); | 617 | inflight = atomic_dec_return(&rqw->inflight); |
| 613 | if (!enabled || iolat->min_lat_nsec == 0) | 618 | WARN_ON_ONCE(inflight < 0); |
| 619 | if (iolat->min_lat_nsec == 0) | ||
| 614 | goto next; | 620 | goto next; |
| 615 | iolatency_record_time(iolat, &bio->bi_issue, now, | 621 | iolatency_record_time(iolat, &bio->bi_issue, now, |
| 616 | issue_as_root); | 622 | issue_as_root); |
| @@ -754,10 +760,13 @@ int blk_iolatency_init(struct request_queue *q) · 137 unmodified lines | |||
| 754 | return 0; | 760 | return 0; |
| 755 | } | 761 | } |
| 756 | 762 | ||
| 757 | static void iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val) | 763 | /* |
| 764 | * return 1 for enabling iolatency, return -1 for disabling iolatency, otherwise | ||
| 765 | * return 0. | ||
| 766 | */ | ||
| 767 | static int iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val) | ||
| 758 | { | 768 | { |
| 759 | struct iolatency_grp *iolat = blkg_to_lat(blkg); | 769 | struct iolatency_grp *iolat = blkg_to_lat(blkg); |
| 760 | struct blk_iolatency *blkiolat = iolat->blkiolat; | ||
| 761 | u64 oldval = iolat->min_lat_nsec; | 770 | u64 oldval = iolat->min_lat_nsec; |
| 762 | 771 | ||
| 763 | iolat->min_lat_nsec = val; | 772 | iolat->min_lat_nsec = val; |
| @@ -766,9 +775,10 @@ static void iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val) · 2 unmodified lines | |||
| 766 | BLKIOLATENCY_MAX_WIN_SIZE); | 775 | BLKIOLATENCY_MAX_WIN_SIZE); |
| 767 | 776 | ||
| 768 | if (!oldval && val) | 777 | if (!oldval && val) |
| 769 | atomic_inc(&blkiolat->enabled); | 778 | return 1; |
| 770 | if (oldval && !val) | 779 | if (oldval && !val) |
| 771 | atomic_dec(&blkiolat->enabled); | 780 | return -1; |
| 781 | return 0; | ||
| 772 | } | 782 | } |
| 773 | 783 | ||
| 774 | static void iolatency_clear_scaling(struct blkcg_gq *blkg) | 784 | static void iolatency_clear_scaling(struct blkcg_gq *blkg) |
| @@ -800,6 +810,7 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, · 25 unmodified lines | |||
| 800 | u64 lat_val = 0; | 810 | u64 lat_val = 0; |
| 801 | u64 oldval; | 811 | u64 oldval; |
| 802 | int ret; | 812 | int ret; |
| 813 | int enable = 0; | ||
| 803 | 814 | ||
| 804 | ret = blkg_conf_prep(blkcg, &blkcg_policy_iolatency, buf, &ctx); | 815 | ret = blkg_conf_prep(blkcg, &blkcg_policy_iolatency, buf, &ctx); |
| 805 | if (ret) | 816 | if (ret) |
| @@ -834,7 +845,12 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, · 28 unmodified lines | |||
| 834 | blkg = ctx.blkg; | 845 | blkg = ctx.blkg; |
| 835 | oldval = iolat->min_lat_nsec; | 846 | oldval = iolat->min_lat_nsec; |
| 836 | 847 | ||
| 837 | iolatency_set_min_lat_nsec(blkg, lat_val); | 848 | enable = iolatency_set_min_lat_nsec(blkg, lat_val); |
| 849 | if (enable) { | ||
| 850 | WARN_ON_ONCE(!blk_get_queue(blkg->q)); | ||
| 851 | blkg_get(blkg); | ||
| 852 | } | ||
| 853 | |||
| 838 | if (oldval != iolat->min_lat_nsec) { | 854 | if (oldval != iolat->min_lat_nsec) { |
| 839 | iolatency_clear_scaling(blkg); | 855 | iolatency_clear_scaling(blkg); |
| 840 | } | 856 | } |
| @@ -842,6 +858,24 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, · 1 unmodified line | |||
| 842 | ret = 0; | 858 | ret = 0; |
| 843 | out: | 859 | out: |
| 844 | blkg_conf_finish(&ctx); | 860 | blkg_conf_finish(&ctx); |
| 861 | if (ret == 0 && enable) { | ||
| 862 | struct iolatency_grp *tmp = blkg_to_lat(blkg); | ||
| 863 | struct blk_iolatency *blkiolat = tmp->blkiolat; | ||
| 864 | |||
| 865 | blk_mq_freeze_queue(blkg->q); | ||
| 866 | |||
| 867 | if (enable == 1) | ||
| 868 | atomic_inc(&blkiolat->enabled); | ||
| 869 | else if (enable == -1) | ||
| 870 | atomic_dec(&blkiolat->enabled); | ||
| 871 | else | ||
| 872 | WARN_ON_ONCE(1); | ||
| 873 | |||
| 874 | blk_mq_unfreeze_queue(blkg->q); | ||
| 875 | |||
| 876 | blkg_put(blkg); | ||
| 877 | blk_put_queue(blkg->q); | ||
| 878 | } | ||
| 845 | return ret ?: nbytes; | 879 | return ret ?: nbytes; |
| 846 | } | 880 | } |
| 847 | 881 | ||
| @@ -977,8 +1011,14 @@ static void iolatency_pd_offline(struct blkg_policy_data *pd) · 129 unmodified lines | |||
| 977 | { | 1011 | { |
| 978 | struct iolatency_grp *iolat = pd_to_lat(pd); | 1012 | struct iolatency_grp *iolat = pd_to_lat(pd); |
| 979 | struct blkcg_gq *blkg = lat_to_blkg(iolat); | 1013 | struct blkcg_gq *blkg = lat_to_blkg(iolat); |
| 1014 | struct blk_iolatency *blkiolat = iolat->blkiolat; | ||
| 1015 | int ret; | ||
| 980 | 1016 | ||
| 981 | iolatency_set_min_lat_nsec(blkg, 0); | 1017 | ret = iolatency_set_min_lat_nsec(blkg, 0); |
| 1018 | if (ret == 1) | ||
| 1019 | atomic_inc(&blkiolat->enabled); | ||
| 1020 | if (ret == -1) | ||
| 1021 | atomic_dec(&blkiolat->enabled); | ||
| 982 | iolatency_clear_scaling(blkg); | 1022 | iolatency_clear_scaling(blkg); |
| 983 | } | 1023 | } |
| 984 | 1024 | ||
| @@ -1,8 +1,6 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* | 2 | /* |
| 3 | * Copyright (C) 2017 Western Digital Corporation or its affiliates. | 3 | * Copyright (C) 2017 Western Digital Corporation or its affiliates. |
| 4 | * | ||
| 5 | * This file is released under the GPL. | ||
| 6 | */ | 4 | */ |
| 7 | 5 | ||
| 8 | #include <linux/blkdev.h> | 6 | #include <linux/blkdev.h> |
| @@ -308,8 +308,9 @@ static const char *const cmd_flag_name[] = { · 307 unmodified lines | |||
| 308 | CMD_FLAG_NAME(PREFLUSH), | 308 | CMD_FLAG_NAME(PREFLUSH), |
| 309 | CMD_FLAG_NAME(RAHEAD), | 309 | CMD_FLAG_NAME(RAHEAD), |
| 310 | CMD_FLAG_NAME(BACKGROUND), | 310 | CMD_FLAG_NAME(BACKGROUND), |
| 311 | CMD_FLAG_NAME(NOUNMAP), | ||
| 312 | CMD_FLAG_NAME(NOWAIT), | 311 | CMD_FLAG_NAME(NOWAIT), |
| 312 | CMD_FLAG_NAME(NOUNMAP), | ||
| 313 | CMD_FLAG_NAME(HIPRI), | ||
| 313 | }; | 314 | }; |
| 314 | #undef CMD_FLAG_NAME | 315 | #undef CMD_FLAG_NAME |
| 315 | 316 | ||
| @@ -838,6 +839,9 @@ static const struct blk_mq_debugfs_attr blk_mq_debugfs_ctx_attrs[] = { · 522 unmodified lines | |||
| 838 | static bool debugfs_create_files(struct dentry *parent, void *data, | 839 | static bool debugfs_create_files(struct dentry *parent, void *data, |
| 839 | const struct blk_mq_debugfs_attr *attr) | 840 | const struct blk_mq_debugfs_attr *attr) |
| 840 | { | 841 | { |
| 842 | if (IS_ERR_OR_NULL(parent)) | ||
| 843 | return false; | ||
| 844 | |||
| 841 | d_inode(parent)->i_private = data; | 845 | d_inode(parent)->i_private = data; |
| 842 | 846 | ||
| 843 | for (; attr->name; attr++) { | 847 | for (; attr->name; attr++) { |
| @@ -1906,7 +1906,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 1905 unmodified lines | |||
| 1906 | { | 1906 | { |
| 1907 | const int is_sync = op_is_sync(bio->bi_opf); | 1907 | const int is_sync = op_is_sync(bio->bi_opf); |
| 1908 | const int is_flush_fua = op_is_flush(bio->bi_opf); | 1908 | const int is_flush_fua = op_is_flush(bio->bi_opf); |
| 1909 | struct blk_mq_alloc_data data = { .flags = 0, .cmd_flags = bio->bi_opf }; | 1909 | struct blk_mq_alloc_data data = { .flags = 0}; |
| 1910 | struct request *rq; | 1910 | struct request *rq; |
| 1911 | struct blk_plug *plug; | 1911 | struct blk_plug *plug; |
| 1912 | struct request *same_queue_rq = NULL; | 1912 | struct request *same_queue_rq = NULL; |
| @@ -1928,6 +1928,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 15 unmodified lines | |||
| 1928 | 1928 | ||
| 1929 | rq_qos_throttle(q, bio); | 1929 | rq_qos_throttle(q, bio); |
| 1930 | 1930 | ||
| 1931 | data.cmd_flags = bio->bi_opf; | ||
| 1931 | rq = blk_mq_get_request(q, bio, &data); | 1932 | rq = blk_mq_get_request(q, bio, &data); |
| 1932 | if (unlikely(!rq)) { | 1933 | if (unlikely(!rq)) { |
| 1933 | rq_qos_cleanup(q, bio); | 1934 | rq_qos_cleanup(q, bio); |
| @@ -36,7 +36,6 @@ struct blk_mq_ctx { · 35 unmodified lines | |||
| 36 | struct kobject kobj; | 36 | struct kobject kobj; |
| 37 | } ____cacheline_aligned_in_smp; | 37 | } ____cacheline_aligned_in_smp; |
| 38 | 38 | ||
| 39 | void blk_mq_freeze_queue(struct request_queue *q); | ||
| 40 | void blk_mq_free_queue(struct request_queue *q); | 39 | void blk_mq_free_queue(struct request_queue *q); |
| 41 | int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr); | 40 | int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr); |
| 42 | void blk_mq_wake_waiters(struct request_queue *q); | 41 | void blk_mq_wake_waiters(struct request_queue *q); |
| @@ -597,7 +597,7 @@ static void wbt_track(struct rq_qos *rqos, struct request *rq, struct bio *bio) · 596 unmodified lines | |||
| 597 | rq->wbt_flags |= bio_to_wbt_flags(rwb, bio); | 597 | rq->wbt_flags |= bio_to_wbt_flags(rwb, bio); |
| 598 | } | 598 | } |
| 599 | 599 | ||
| 600 | void wbt_issue(struct rq_qos *rqos, struct request *rq) | 600 | static void wbt_issue(struct rq_qos *rqos, struct request *rq) |
| 601 | { | 601 | { |
| 602 | struct rq_wb *rwb = RQWB(rqos); | 602 | struct rq_wb *rwb = RQWB(rqos); |
| 603 | 603 | ||
| @@ -617,7 +617,7 @@ void wbt_issue(struct rq_qos *rqos, struct request *rq) · 13 unmodified lines | |||
| 617 | } | 617 | } |
| 618 | } | 618 | } |
| 619 | 619 | ||
| 620 | void wbt_requeue(struct rq_qos *rqos, struct request *rq) | 620 | static void wbt_requeue(struct rq_qos *rqos, struct request *rq) |
| 621 | { | 621 | { |
| 622 | struct rq_wb *rwb = RQWB(rqos); | 622 | struct rq_wb *rwb = RQWB(rqos); |
| 623 | if (!rwb_enabled(rwb)) | 623 | if (!rwb_enabled(rwb)) |
| @@ -539,6 +539,8 @@ static int adiantum_create(struct crypto_template *tmpl, struct rtattr **tb) · 538 unmodified lines | |||
| 539 | ictx = skcipher_instance_ctx(inst); | 539 | ictx = skcipher_instance_ctx(inst); |
| 540 | 540 | ||
| 541 | /* Stream cipher, e.g. "xchacha12" */ | 541 | /* Stream cipher, e.g. "xchacha12" */ |
| 542 | crypto_set_skcipher_spawn(&ictx->streamcipher_spawn, | ||
| 543 | skcipher_crypto_instance(inst)); | ||
| 542 | err = crypto_grab_skcipher(&ictx->streamcipher_spawn, streamcipher_name, | 544 | err = crypto_grab_skcipher(&ictx->streamcipher_spawn, streamcipher_name, |
| 543 | 0, crypto_requires_sync(algt->type, | 545 | 0, crypto_requires_sync(algt->type, |
| 544 | algt->mask)); | 546 | algt->mask)); |
| @@ -547,6 +549,8 @@ static int adiantum_create(struct crypto_template *tmpl, struct rtattr **tb) · 2 unmodified lines | |||
| 547 | streamcipher_alg = crypto_spawn_skcipher_alg(&ictx->streamcipher_spawn); | 549 | streamcipher_alg = crypto_spawn_skcipher_alg(&ictx->streamcipher_spawn); |
| 548 | 550 | ||
| 549 | /* Block cipher, e.g. "aes" */ | 551 | /* Block cipher, e.g. "aes" */ |
| 552 | crypto_set_spawn(&ictx->blockcipher_spawn, | ||
| 553 | skcipher_crypto_instance(inst)); | ||
| 550 | err = crypto_grab_spawn(&ictx->blockcipher_spawn, blockcipher_name, | 554 | err = crypto_grab_spawn(&ictx->blockcipher_spawn, blockcipher_name, |
| 551 | CRYPTO_ALG_TYPE_CIPHER, CRYPTO_ALG_TYPE_MASK); | 555 | CRYPTO_ALG_TYPE_CIPHER, CRYPTO_ALG_TYPE_MASK); |
| 552 | if (err) | 556 | if (err) |
| @@ -58,14 +58,22 @@ int crypto_authenc_extractkeys(struct crypto_authenc_keys *keys, const u8 *key, · 57 unmodified lines | |||
| 58 | return -EINVAL; | 58 | return -EINVAL; |
| 59 | if (rta->rta_type != CRYPTO_AUTHENC_KEYA_PARAM) | 59 | if (rta->rta_type != CRYPTO_AUTHENC_KEYA_PARAM) |
| 60 | return -EINVAL; | 60 | return -EINVAL; |
| 61 | if (RTA_PAYLOAD(rta) < sizeof(*param)) | 61 | |
| 62 | /* | ||
| 63 | * RTA_OK() didn't align the rtattr's payload when validating that it | ||
| 64 | * fits in the buffer. Yet, the keys should start on the next 4-byte | ||
| 65 | * aligned boundary. To avoid confusion, require that the rtattr | ||
| 66 | * payload be exactly the param struct, which has a 4-byte aligned size. | ||
| 67 | */ | ||
| 68 | if (RTA_PAYLOAD(rta) != sizeof(*param)) | ||
| 62 | return -EINVAL; | 69 | return -EINVAL; |
| 70 | BUILD_BUG_ON(sizeof(*param) % RTA_ALIGNTO); | ||
| 63 | 71 | ||
| 64 | param = RTA_DATA(rta); | 72 | param = RTA_DATA(rta); |
| 65 | keys->enckeylen = be32_to_cpu(param->enckeylen); | 73 | keys->enckeylen = be32_to_cpu(param->enckeylen); |
| 66 | 74 | ||
| 67 | key += RTA_ALIGN(rta->rta_len); | 75 | key += rta->rta_len; |
| 68 | keylen -= RTA_ALIGN(rta->rta_len); | 76 | keylen -= rta->rta_len; |
| 69 | 77 | ||
| 70 | if (keylen < keys->enckeylen) | 78 | if (keylen < keys->enckeylen) |
| 71 | return -EINVAL; | 79 | return -EINVAL; |
| @@ -279,7 +279,7 @@ static void authenc_esn_verify_ahash_done(struct crypto_async_request *areq, · 278 unmodified lines | |||
| 279 | struct aead_request *req = areq->data; | 279 | struct aead_request *req = areq->data; |
| 280 | 280 | ||
| 281 | err = err ?: crypto_authenc_esn_decrypt_tail(req, 0); | 281 | err = err ?: crypto_authenc_esn_decrypt_tail(req, 0); |
| 282 | aead_request_complete(req, err); | 282 | authenc_esn_request_complete(req, err); |
| 283 | } | 283 | } |
| 284 | 284 | ||
| 285 | static int crypto_authenc_esn_decrypt(struct aead_request *req) | 285 | static int crypto_authenc_esn_decrypt(struct aead_request *req) |
| @@ -100,7 +100,7 @@ static void sm3_compress(u32 *w, u32 *wt, u32 *m) · 99 unmodified lines | |||
| 100 | 100 | ||
| 101 | for (i = 0; i <= 63; i++) { | 101 | for (i = 0; i <= 63; i++) { |
| 102 | 102 | ||
| 103 | ss1 = rol32((rol32(a, 12) + e + rol32(t(i), i)), 7); | 103 | ss1 = rol32((rol32(a, 12) + e + rol32(t(i), i & 31)), 7); |
| 104 | 104 | ||
| 105 | ss2 = ss1 ^ rol32(a, 12); | 105 | ss2 = ss1 ^ rol32(a, 12); |
| 106 | 106 | ||
| @@ -10,6 +10,7 @@ menuconfig ACPI · 9 unmodified lines | |||
| 10 | bool "ACPI (Advanced Configuration and Power Interface) Support" | 10 | bool "ACPI (Advanced Configuration and Power Interface) Support" |
| 11 | depends on ARCH_SUPPORTS_ACPI | 11 | depends on ARCH_SUPPORTS_ACPI |
| 12 | select PNP | 12 | select PNP |
| 13 | select NLS | ||
| 13 | default y if X86 | 14 | default y if X86 |
| 14 | help | 15 | help |
| 15 | Advanced Configuration and Power Interface (ACPI) support for | 16 | Advanced Configuration and Power Interface (ACPI) support for |
| @@ -41,7 +41,8 @@ acpi-y += ec.o · 40 unmodified lines | |||
| 41 | acpi-$(CONFIG_ACPI_DOCK) += dock.o | 41 | acpi-$(CONFIG_ACPI_DOCK) += dock.o |
| 42 | acpi-$(CONFIG_PCI) += pci_root.o pci_link.o pci_irq.o | 42 | acpi-$(CONFIG_PCI) += pci_root.o pci_link.o pci_irq.o |
| 43 | obj-$(CONFIG_ACPI_MCFG) += pci_mcfg.o | 43 | obj-$(CONFIG_ACPI_MCFG) += pci_mcfg.o |
| 44 | acpi-y += acpi_lpss.o acpi_apd.o | 44 | acpi-$(CONFIG_PCI) += acpi_lpss.o |
| 45 | acpi-y += acpi_apd.o | ||
| 45 | acpi-y += acpi_platform.o | 46 | acpi-y += acpi_platform.o |
| 46 | acpi-y += acpi_pnp.o | 47 | acpi-y += acpi_pnp.o |
| 47 | acpi-$(CONFIG_ARM_AMBA) += acpi_amba.o | 48 | acpi-$(CONFIG_ARM_AMBA) += acpi_amba.o |
| @@ -876,7 +876,7 @@ int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head) · 875 unmodified lines | |||
| 876 | return (resv == its->its_count) ? resv : -ENODEV; | 876 | return (resv == its->its_count) ? resv : -ENODEV; |
| 877 | } | 877 | } |
| 878 | #else | 878 | #else |
| 879 | static inline const struct iommu_ops *iort_fwspec_iommu_ops(struct device *dev); | 879 | static inline const struct iommu_ops *iort_fwspec_iommu_ops(struct device *dev) |
| 880 | { return NULL; } | 880 | { return NULL; } |
| 881 | static inline int iort_add_device_replay(const struct iommu_ops *ops, | 881 | static inline int iort_add_device_replay(const struct iommu_ops *ops, |
| 882 | struct device *dev) | 882 | struct device *dev) |
| @@ -952,9 +952,10 @@ static int rc_dma_get_range(struct device *dev, u64 *size) · 69 unmodified lines | |||
| 952 | { | 952 | { |
| 953 | struct acpi_iort_node *node; | 953 | struct acpi_iort_node *node; |
| 954 | struct acpi_iort_root_complex *rc; | 954 | struct acpi_iort_root_complex *rc; |
| 955 | struct pci_bus *pbus = to_pci_dev(dev)->bus; | ||
| 955 | 956 | ||
| 956 | node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX, | 957 | node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX, |
| 957 | iort_match_node_callback, dev); | 958 | iort_match_node_callback, &pbus->dev); |
| 958 | if (!node || node->revision < 1) | 959 | if (!node || node->revision < 1) |
| 959 | return -ENODEV; | 960 | return -ENODEV; |
| 960 | 961 | ||
| @@ -1029,6 +1029,9 @@ void __init acpi_early_init(void) · 1028 unmodified lines | |||
| 1029 | 1029 | ||
| 1030 | acpi_permanent_mmap = true; | 1030 | acpi_permanent_mmap = true; |
| 1031 | 1031 | ||
| 1032 | /* Initialize debug output. Linux does not use ACPICA defaults */ | ||
| 1033 | acpi_dbg_level = ACPI_LV_INFO | ACPI_LV_REPAIR; | ||
| 1034 | |||
| 1032 | #ifdef CONFIG_X86 | 1035 | #ifdef CONFIG_X86 |
| 1033 | /* | 1036 | /* |
| 1034 | * If the machine falls into the DMI check table, | 1037 | * If the machine falls into the DMI check table, |
| @@ -1054,18 +1057,6 @@ void __init acpi_early_init(void) · 19 unmodified lines | |||
| 1054 | goto error0; | 1057 | goto error0; |
| 1055 | } | 1058 | } |
| 1056 | 1059 | ||
| 1057 | /* | ||
| 1058 | * ACPI 2.0 requires the EC driver to be loaded and work before | ||
| 1059 | * the EC device is found in the namespace (i.e. before | ||
| 1060 | * acpi_load_tables() is called). | ||
| 1061 | * | ||
| 1062 | * This is accomplished by looking for the ECDT table, and getting | ||
| 1063 | * the EC parameters out of that. | ||
| 1064 | * | ||
| 1065 | * Ignore the result. Not having an ECDT is not fatal. | ||
| 1066 | */ | ||
| 1067 | status = acpi_ec_ecdt_probe(); | ||
| 1068 | |||
| 1069 | #ifdef CONFIG_X86 | 1060 | #ifdef CONFIG_X86 |
| 1070 | if (!acpi_ioapic) { | 1061 | if (!acpi_ioapic) { |
| 1071 | /* compatible (0) means level (3) */ | 1062 | /* compatible (0) means level (3) */ |
| @@ -1142,6 +1133,18 @@ static int __init acpi_bus_init(void) · 70 unmodified lines | |||
| 1142 | goto error1; | 1133 | goto error1; |
| 1143 | } | 1134 | } |
| 1144 | 1135 | ||
| 1136 | /* | ||
| 1137 | * ACPI 2.0 requires the EC driver to be loaded and work before the EC | ||
| 1138 | * device is found in the namespace. | ||
| 1139 | * | ||
| 1140 | * This is accomplished by looking for the ECDT table and getting the EC | ||
| 1141 | * parameters out of that. | ||
| 1142 | * | ||
| 1143 | * Do that before calling acpi_initialize_objects() which may trigger EC | ||
| 1144 | * address space accesses. | ||
| 1145 | */ | ||
| 1146 | acpi_ec_ecdt_probe(); | ||
| 1147 | |||
| 1145 | status = acpi_enable_subsystem(ACPI_NO_ACPI_ENABLE); | 1148 | status = acpi_enable_subsystem(ACPI_NO_ACPI_ENABLE); |
| 1146 | if (ACPI_FAILURE(status)) { | 1149 | if (ACPI_FAILURE(status)) { |
| 1147 | printk(KERN_ERR PREFIX | 1150 | printk(KERN_ERR PREFIX |
| @@ -81,7 +81,11 @@ void acpi_debugfs_init(void); · 80 unmodified lines | |||
| 81 | #else | 81 | #else |
| 82 | static inline void acpi_debugfs_init(void) { return; } | 82 | static inline void acpi_debugfs_init(void) { return; } |
| 83 | #endif | 83 | #endif |
| 84 | #ifdef CONFIG_PCI | ||
| 84 | void acpi_lpss_init(void); | 85 | void acpi_lpss_init(void); |
| 86 | #else | ||
| 87 | static inline void acpi_lpss_init(void) {} | ||
| 88 | #endif | ||
| 85 | 89 | ||
| 86 | void acpi_apd_init(void); | 90 | void acpi_apd_init(void); |
| 87 | 91 | ||
| @@ -26,7 +26,6 @@ · 25 unmodified lines | |||
| 26 | #include <acpi/nfit.h> | 26 | #include <acpi/nfit.h> |
| 27 | #include "intel.h" | 27 | #include "intel.h" |
| 28 | #include "nfit.h" | 28 | #include "nfit.h" |
| 29 | #include "intel.h" | ||
| 30 | 29 | ||
| 31 | /* | 30 | /* |
| 32 | * For readq() and writeq() on 32-bit builds, the hi-lo, lo-hi order is | 31 | * For readq() and writeq() on 32-bit builds, the hi-lo, lo-hi order is |
| @@ -78,12 +77,6 @@ const guid_t *to_nfit_uuid(enum nfit_uuids id) · 45 unmodified lines | |||
| 78 | } | 77 | } |
| 79 | EXPORT_SYMBOL(to_nfit_uuid); | 78 | EXPORT_SYMBOL(to_nfit_uuid); |
| 80 | 79 | ||
| 81 | static struct acpi_nfit_desc *to_acpi_nfit_desc( | ||
| 82 | struct nvdimm_bus_descriptor *nd_desc) | ||
| 83 | { | ||
| 84 | return container_of(nd_desc, struct acpi_nfit_desc, nd_desc); | ||
| 85 | } | ||
| 86 | |||
| 87 | static struct acpi_device *to_acpi_dev(struct acpi_nfit_desc *acpi_desc) | 80 | static struct acpi_device *to_acpi_dev(struct acpi_nfit_desc *acpi_desc) |
| 88 | { | 81 | { |
| 89 | struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; | 82 | struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; |
| @@ -416,10 +409,36 @@ static bool payload_dumpable(struct nvdimm *nvdimm, unsigned int func) · 326 unmodified lines | |||
| 416 | return true; | 409 | return true; |
| 417 | } | 410 | } |
| 418 | 411 | ||
| 412 | static int cmd_to_func(struct nfit_mem *nfit_mem, unsigned int cmd, | ||
| 413 | struct nd_cmd_pkg *call_pkg) | ||
| 414 | { | ||
| 415 | if (call_pkg) { | ||
| 416 | int i; | ||
| 417 | |||
| 418 | if (nfit_mem->family != call_pkg->nd_family) | ||
| 419 | return -ENOTTY; | ||
| 420 | |||
| 421 | for (i = 0; i < ARRAY_SIZE(call_pkg->nd_reserved2); i++) | ||
| 422 | if (call_pkg->nd_reserved2[i]) | ||
| 423 | return -EINVAL; | ||
| 424 | return call_pkg->nd_command; | ||
| 425 | } | ||
| 426 | |||
| 427 | /* Linux ND commands == NVDIMM_FAMILY_INTEL function numbers */ | ||
| 428 | if (nfit_mem->family == NVDIMM_FAMILY_INTEL) | ||
| 429 | return cmd; | ||
| 430 | |||
| 431 | /* | ||
| 432 | * Force function number validation to fail since 0 is never | ||
| 433 | * published as a valid function in dsm_mask. | ||
| 434 | */ | ||
| 435 | return 0; | ||
| 436 | } | ||
| 437 | |||
| 419 | int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, | 438 | int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, |
| 420 | unsigned int cmd, void *buf, unsigned int buf_len, int *cmd_rc) | 439 | unsigned int cmd, void *buf, unsigned int buf_len, int *cmd_rc) |
| 421 | { | 440 | { |
| 422 | struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc); | 441 | struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); |
| 423 | struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); | 442 | struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); |
| 424 | union acpi_object in_obj, in_buf, *out_obj; | 443 | union acpi_object in_obj, in_buf, *out_obj; |
| 425 | const struct nd_cmd_desc *desc = NULL; | 444 | const struct nd_cmd_desc *desc = NULL; |
| @@ -429,30 +448,23 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, · 3 unmodified lines | |||
| 429 | unsigned long cmd_mask, dsm_mask; | 448 | unsigned long cmd_mask, dsm_mask; |
| 430 | u32 offset, fw_status = 0; | 449 | u32 offset, fw_status = 0; |
| 431 | acpi_handle handle; | 450 | acpi_handle handle; |
| 432 | unsigned int func; | ||
| 433 | const guid_t *guid; | 451 | const guid_t *guid; |
| 434 | int rc, i; | 452 | int func, rc, i; |
| 435 | 453 | ||
| 436 | if (cmd_rc) | 454 | if (cmd_rc) |
| 437 | *cmd_rc = -EINVAL; | 455 | *cmd_rc = -EINVAL; |
| 438 | func = cmd; | ||
| 439 | if (cmd == ND_CMD_CALL) { | ||
| 440 | call_pkg = buf; | ||
| 441 | func = call_pkg->nd_command; | ||
| 442 | |||
| 443 | for (i = 0; i < ARRAY_SIZE(call_pkg->nd_reserved2); i++) | ||
| 444 | if (call_pkg->nd_reserved2[i]) | ||
| 445 | return -EINVAL; | ||
| 446 | } | ||
| 447 | 456 | ||
| 448 | if (nvdimm) { | 457 | if (nvdimm) { |
| 449 | struct acpi_device *adev = nfit_mem->adev; | 458 | struct acpi_device *adev = nfit_mem->adev; |
| 450 | 459 | ||
| 451 | if (!adev) | 460 | if (!adev) |
| 452 | return -ENOTTY; | 461 | return -ENOTTY; |
| 453 | if (call_pkg && nfit_mem->family != call_pkg->nd_family) | ||
| 454 | return -ENOTTY; | ||
| 455 | 462 | ||
| 463 | if (cmd == ND_CMD_CALL) | ||
| 464 | call_pkg = buf; | ||
| 465 | func = cmd_to_func(nfit_mem, cmd, call_pkg); | ||
| 466 | if (func < 0) | ||
| 467 | return func; | ||
| 456 | dimm_name = nvdimm_name(nvdimm); | 468 | dimm_name = nvdimm_name(nvdimm); |
| 457 | cmd_name = nvdimm_cmd_name(cmd); | 469 | cmd_name = nvdimm_cmd_name(cmd); |
| 458 | cmd_mask = nvdimm_cmd_mask(nvdimm); | 470 | cmd_mask = nvdimm_cmd_mask(nvdimm); |
| @@ -463,6 +475,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, · 4 unmodified lines | |||
| 463 | } else { | 475 | } else { |
| 464 | struct acpi_device *adev = to_acpi_dev(acpi_desc); | 476 | struct acpi_device *adev = to_acpi_dev(acpi_desc); |
| 465 | 477 | ||
| 478 | func = cmd; | ||
| 466 | cmd_name = nvdimm_bus_cmd_name(cmd); | 479 | cmd_name = nvdimm_bus_cmd_name(cmd); |
| 467 | cmd_mask = nd_desc->cmd_mask; | 480 | cmd_mask = nd_desc->cmd_mask; |
| 468 | dsm_mask = cmd_mask; | 481 | dsm_mask = cmd_mask; |
| @@ -477,7 +490,13 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, · 8 unmodified lines | |||
| 477 | if (!desc || (cmd && (desc->out_num + desc->in_num == 0))) | 490 | if (!desc || (cmd && (desc->out_num + desc->in_num == 0))) |
| 478 | return -ENOTTY; | 491 | return -ENOTTY; |
| 479 | 492 | ||
| 480 | if (!test_bit(cmd, &cmd_mask) || !test_bit(func, &dsm_mask)) | 493 | /* |
| 494 | * Check for a valid command. For ND_CMD_CALL, we also have to | ||
| 495 | * make sure that the DSM function is supported. | ||
| 496 | */ | ||
| 497 | if (cmd == ND_CMD_CALL && !test_bit(func, &dsm_mask)) | ||
| 498 | return -ENOTTY; | ||
| 499 | else if (!test_bit(cmd, &cmd_mask)) | ||
| 481 | return -ENOTTY; | 500 | return -ENOTTY; |
| 482 | 501 | ||
| 483 | in_obj.type = ACPI_TYPE_PACKAGE; | 502 | in_obj.type = ACPI_TYPE_PACKAGE; |
| @@ -721,6 +740,7 @@ int nfit_get_smbios_id(u32 device_handle, u16 *flags) · 237 unmodified lines | |||
| 721 | struct acpi_nfit_memory_map *memdev; | 740 | struct acpi_nfit_memory_map *memdev; |
| 722 | struct acpi_nfit_desc *acpi_desc; | 741 | struct acpi_nfit_desc *acpi_desc; |
| 723 | struct nfit_mem *nfit_mem; | 742 | struct nfit_mem *nfit_mem; |
| 743 | u16 physical_id; | ||
| 724 | 744 | ||
| 725 | mutex_lock(&acpi_desc_lock); | 745 | mutex_lock(&acpi_desc_lock); |
| 726 | list_for_each_entry(acpi_desc, &acpi_descs, list) { | 746 | list_for_each_entry(acpi_desc, &acpi_descs, list) { |
| @@ -728,10 +748,11 @@ int nfit_get_smbios_id(u32 device_handle, u16 *flags) · 1 unmodified line | |||
| 728 | list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { | 748 | list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { |
| 729 | memdev = __to_nfit_memdev(nfit_mem); | 749 | memdev = __to_nfit_memdev(nfit_mem); |
| 730 | if (memdev->device_handle == device_handle) { | 750 | if (memdev->device_handle == device_handle) { |
| 751 | *flags = memdev->flags; | ||
| 752 | physical_id = memdev->physical_id; | ||
| 731 | mutex_unlock(&acpi_desc->init_mutex); | 753 | mutex_unlock(&acpi_desc->init_mutex); |
| 732 | mutex_unlock(&acpi_desc_lock); | 754 | mutex_unlock(&acpi_desc_lock); |
| 733 | *flags = memdev->flags; | 755 | return physical_id; |
| 734 | return memdev->physical_id; | ||
| 735 | } | 756 | } |
| 736 | } | 757 | } |
| 737 | mutex_unlock(&acpi_desc->init_mutex); | 758 | mutex_unlock(&acpi_desc->init_mutex); |
| @@ -1872,6 +1893,13 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc, · 1134 unmodified lines | |||
| 1872 | return 0; | 1893 | return 0; |
| 1873 | } | 1894 | } |
| 1874 | 1895 | ||
| 1896 | /* | ||
| 1897 | * Function 0 is the command interrogation function, don't | ||
| 1898 | * export it to potential userspace use, and enable it to be | ||
| 1899 | * used as an error value in acpi_nfit_ctl(). | ||
| 1900 | */ | ||
| 1901 | dsm_mask &= ~1UL; | ||
| 1902 | |||
| 1875 | guid = to_nfit_uuid(nfit_mem->family); | 1903 | guid = to_nfit_uuid(nfit_mem->family); |
| 1876 | for_each_set_bit(i, &dsm_mask, BITS_PER_LONG) | 1904 | for_each_set_bit(i, &dsm_mask, BITS_PER_LONG) |
| 1877 | if (acpi_check_dsm(adev_dimm->handle, guid, | 1905 | if (acpi_check_dsm(adev_dimm->handle, guid, |
| @@ -2047,11 +2075,6 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc) · 169 unmodified lines | |||
| 2047 | if (!nvdimm) | 2075 | if (!nvdimm) |
| 2048 | continue; | 2076 | continue; |
| 2049 | 2077 | ||
| 2050 | rc = nvdimm_security_setup_events(nvdimm); | ||
| 2051 | if (rc < 0) | ||
| 2052 | dev_warn(acpi_desc->dev, | ||
| 2053 | "security event setup failed: %d\n", rc); | ||
| 2054 | |||
| 2055 | nfit_kernfs = sysfs_get_dirent(nvdimm_kobj(nvdimm)->sd, "nfit"); | 2078 | nfit_kernfs = sysfs_get_dirent(nvdimm_kobj(nvdimm)->sd, "nfit"); |
| 2056 | if (nfit_kernfs) | 2079 | if (nfit_kernfs) |
| 2057 | nfit_mem->flags_attr = sysfs_get_dirent(nfit_kernfs, | 2080 | nfit_mem->flags_attr = sysfs_get_dirent(nfit_kernfs, |
| @@ -2231,7 +2254,6 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc, · 173 unmodified lines | |||
| 2231 | nd_set = devm_kzalloc(dev, sizeof(*nd_set), GFP_KERNEL); | 2254 | nd_set = devm_kzalloc(dev, sizeof(*nd_set), GFP_KERNEL); |
| 2232 | if (!nd_set) | 2255 | if (!nd_set) |
| 2233 | return -ENOMEM; | 2256 | return -ENOMEM; |
| 2234 | ndr_desc->nd_set = nd_set; | ||
| 2235 | guid_copy(&nd_set->type_guid, (guid_t *) spa->range_guid); | 2257 | guid_copy(&nd_set->type_guid, (guid_t *) spa->range_guid); |
| 2236 | 2258 | ||
| 2237 | info = devm_kzalloc(dev, sizeof_nfit_set_info(nr), GFP_KERNEL); | 2259 | info = devm_kzalloc(dev, sizeof_nfit_set_info(nr), GFP_KERNEL); |
| @@ -3367,7 +3389,7 @@ EXPORT_SYMBOL_GPL(acpi_nfit_init); · 1129 unmodified lines | |||
| 3367 | 3389 | ||
| 3368 | static int acpi_nfit_flush_probe(struct nvdimm_bus_descriptor *nd_desc) | 3390 | static int acpi_nfit_flush_probe(struct nvdimm_bus_descriptor *nd_desc) |
| 3369 | { | 3391 | { |
| 3370 | struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc); | 3392 | struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); |
| 3371 | struct device *dev = acpi_desc->dev; | 3393 | struct device *dev = acpi_desc->dev; |
| 3372 | 3394 | ||
| 3373 | /* Bounce the device lock to flush acpi_nfit_add / acpi_nfit_notify */ | 3395 | /* Bounce the device lock to flush acpi_nfit_add / acpi_nfit_notify */ |
| @@ -3384,7 +3406,7 @@ static int acpi_nfit_flush_probe(struct nvdimm_bus_descriptor *nd_desc) · 10 unmodified lines | |||
| 3384 | static int __acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc, | 3406 | static int __acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc, |
| 3385 | struct nvdimm *nvdimm, unsigned int cmd) | 3407 | struct nvdimm *nvdimm, unsigned int cmd) |
| 3386 | { | 3408 | { |
| 3387 | struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc); | 3409 | struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); |
| 3388 | 3410 | ||
| 3389 | if (nvdimm) | 3411 | if (nvdimm) |
| 3390 | return 0; | 3412 | return 0; |
| @@ -146,7 +146,7 @@ static int intel_security_change_key(struct nvdimm *nvdimm, · 145 unmodified lines | |||
| 146 | 146 | ||
| 147 | static void nvdimm_invalidate_cache(void); | 147 | static void nvdimm_invalidate_cache(void); |
| 148 | 148 | ||
| 149 | static int intel_security_unlock(struct nvdimm *nvdimm, | 149 | static int __maybe_unused intel_security_unlock(struct nvdimm *nvdimm, |
| 150 | const struct nvdimm_key_data *key_data) | 150 | const struct nvdimm_key_data *key_data) |
| 151 | { | 151 | { |
| 152 | struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); | 152 | struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); |
| @@ -227,7 +227,7 @@ static int intel_security_disable(struct nvdimm *nvdimm, · 74 unmodified lines | |||
| 227 | return 0; | 227 | return 0; |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | static int intel_security_erase(struct nvdimm *nvdimm, | 230 | static int __maybe_unused intel_security_erase(struct nvdimm *nvdimm, |
| 231 | const struct nvdimm_key_data *key, | 231 | const struct nvdimm_key_data *key, |
| 232 | enum nvdimm_passphrase_type ptype) | 232 | enum nvdimm_passphrase_type ptype) |
| 233 | { | 233 | { |
| @@ -276,7 +276,7 @@ static int intel_security_erase(struct nvdimm *nvdimm, · 42 unmodified lines | |||
| 276 | return 0; | 276 | return 0; |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | static int intel_security_query_overwrite(struct nvdimm *nvdimm) | 279 | static int __maybe_unused intel_security_query_overwrite(struct nvdimm *nvdimm) |
| 280 | { | 280 | { |
| 281 | int rc; | 281 | int rc; |
| 282 | struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); | 282 | struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); |
| @@ -313,7 +313,7 @@ static int intel_security_query_overwrite(struct nvdimm *nvdimm) · 30 unmodified lines | |||
| 313 | return 0; | 313 | return 0; |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | static int intel_security_overwrite(struct nvdimm *nvdimm, | 316 | static int __maybe_unused intel_security_overwrite(struct nvdimm *nvdimm, |
| 317 | const struct nvdimm_key_data *nkey) | 317 | const struct nvdimm_key_data *nkey) |
| 318 | { | 318 | { |
| 319 | int rc; | 319 | int rc; |
| @@ -146,9 +146,9 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header) · 145 unmodified lines | |||
| 146 | { | 146 | { |
| 147 | struct acpi_srat_mem_affinity *p = | 147 | struct acpi_srat_mem_affinity *p = |
| 148 | (struct acpi_srat_mem_affinity *)header; | 148 | (struct acpi_srat_mem_affinity *)header; |
| 149 | pr_debug("SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s%s\n", | 149 | pr_debug("SRAT Memory (0x%llx length 0x%llx) in proximity domain %d %s%s%s\n", |
| 150 | (unsigned long)p->base_address, | 150 | (unsigned long long)p->base_address, |
| 151 | (unsigned long)p->length, | 151 | (unsigned long long)p->length, |
| 152 | p->proximity_domain, | 152 | p->proximity_domain, |
| 153 | (p->flags & ACPI_SRAT_MEM_ENABLED) ? | 153 | (p->flags & ACPI_SRAT_MEM_ENABLED) ? |
| 154 | "enabled" : "disabled", | 154 | "enabled" : "disabled", |
| @@ -20,8 +20,11 @@ · 19 unmodified lines | |||
| 20 | #define GPI1_LDO_ON (3 << 0) | 20 | #define GPI1_LDO_ON (3 << 0) |
| 21 | #define GPI1_LDO_OFF (4 << 0) | 21 | #define GPI1_LDO_OFF (4 << 0) |
| 22 | 22 | ||
| 23 | #define AXP288_ADC_TS_PIN_GPADC 0xf2 | 23 | #define AXP288_ADC_TS_CURRENT_ON_OFF_MASK GENMASK(1, 0) |
| 24 | #define AXP288_ADC_TS_PIN_ON 0xf3 | 24 | #define AXP288_ADC_TS_CURRENT_OFF (0 << 0) |
| 25 | #define AXP288_ADC_TS_CURRENT_ON_WHEN_CHARGING (1 << 0) | ||
| 26 | #define AXP288_ADC_TS_CURRENT_ON_ONDEMAND (2 << 0) | ||
| 27 | #define AXP288_ADC_TS_CURRENT_ON (3 << 0) | ||
| 25 | 28 | ||
| 26 | static struct pmic_table power_table[] = { | 29 | static struct pmic_table power_table[] = { |
| 27 | { | 30 | { |
| @@ -212,22 +215,44 @@ out: · 184 unmodified lines | |||
| 212 | */ | 215 | */ |
| 213 | static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg) | 216 | static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg) |
| 214 | { | 217 | { |
| 218 | int ret, adc_ts_pin_ctrl; | ||
| 215 | u8 buf[2]; | 219 | u8 buf[2]; |
| 216 | int ret; | ||
| 217 | 220 | ||
| 218 | ret = regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, | 221 | /* |
| 219 | AXP288_ADC_TS_PIN_GPADC); | 222 | * The current-source used for the battery temp-sensor (TS) is shared |
| 223 | * with the GPADC. For proper fuel-gauge and charger operation the TS | ||
| 224 | * current-source needs to be permanently on. But to read the GPADC we | ||
| 225 | * need to temporary switch the TS current-source to ondemand, so that | ||
| 226 | * the GPADC can use it, otherwise we will always read an all 0 value. | ||
| 227 | * | ||
| 228 | * Note that the switching from on to on-ondemand is not necessary | ||
| 229 | * when the TS current-source is off (this happens on devices which | ||
| 230 | * do not use the TS-pin). | ||
| 231 | */ | ||
| 232 | ret = regmap_read(regmap, AXP288_ADC_TS_PIN_CTRL, &adc_ts_pin_ctrl); | ||
| 220 | if (ret) | 233 | if (ret) |
| 221 | return ret; | 234 | return ret; |
| 222 | 235 | ||
| 223 | /* After switching to the GPADC pin give things some time to settle */ | 236 | if (adc_ts_pin_ctrl & AXP288_ADC_TS_CURRENT_ON_OFF_MASK) { |
| 224 | usleep_range(6000, 10000); | 237 | ret = regmap_update_bits(regmap, AXP288_ADC_TS_PIN_CTRL, |
| 238 | AXP288_ADC_TS_CURRENT_ON_OFF_MASK, | ||
| 239 | AXP288_ADC_TS_CURRENT_ON_ONDEMAND); | ||
| 240 | if (ret) | ||
| 241 | return ret; | ||
| 242 | |||
| 243 | /* Wait a bit after switching the current-source */ | ||
| 244 | usleep_range(6000, 10000); | ||
| 245 | } | ||
| 225 | 246 | ||
| 226 | ret = regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, 2); | 247 | ret = regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, 2); |
| 227 | if (ret == 0) | 248 | if (ret == 0) |
| 228 | ret = (buf[0] << 4) + ((buf[1] >> 4) & 0x0f); | 249 | ret = (buf[0] << 4) + ((buf[1] >> 4) & 0x0f); |
| 229 | 250 | ||
| 230 | regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, AXP288_ADC_TS_PIN_ON); | 251 | if (adc_ts_pin_ctrl & AXP288_ADC_TS_CURRENT_ON_OFF_MASK) { |
| 252 | regmap_update_bits(regmap, AXP288_ADC_TS_PIN_CTRL, | ||
| 253 | AXP288_ADC_TS_CURRENT_ON_OFF_MASK, | ||
| 254 | AXP288_ADC_TS_CURRENT_ON); | ||
| 255 | } | ||
| 231 | 256 | ||
| 232 | return ret; | 257 | return ret; |
| 233 | } | 258 | } |
| @@ -131,6 +131,23 @@ void acpi_power_resources_list_free(struct list_head *list) · 130 unmodified lines | |||
| 131 | } | 131 | } |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | static bool acpi_power_resource_is_dup(union acpi_object *package, | ||
| 135 | unsigned int start, unsigned int i) | ||
| 136 | { | ||
| 137 | acpi_handle rhandle, dup; | ||
| 138 | unsigned int j; | ||
| 139 | |||
| 140 | /* The caller is expected to check the package element types */ | ||
| 141 | rhandle = package->package.elements[i].reference.handle; | ||
| 142 | for (j = start; j < i; j++) { | ||
| 143 | dup = package->package.elements[j].reference.handle; | ||
| 144 | if (dup == rhandle) | ||
| 145 | return true; | ||
| 146 | } | ||
| 147 | |||
| 148 | return false; | ||
| 149 | } | ||
| 150 | |||
| 134 | int acpi_extract_power_resources(union acpi_object *package, unsigned int start, | 151 | int acpi_extract_power_resources(union acpi_object *package, unsigned int start, |
| 135 | struct list_head *list) | 152 | struct list_head *list) |
| 136 | { | 153 | { |
| @@ -150,6 +167,11 @@ int acpi_extract_power_resources(union acpi_object *package, unsigned int start, · 13 unmodified lines | |||
| 150 | err = -ENODEV; | 167 | err = -ENODEV; |
| 151 | break; | 168 | break; |
| 152 | } | 169 | } |
| 170 | |||
| 171 | /* Some ACPI tables contain duplicate power resource references */ | ||
| 172 | if (acpi_power_resource_is_dup(package, start, i)) | ||
| 173 | continue; | ||
| 174 | |||
| 153 | err = acpi_add_power_resource(rhandle); | 175 | err = acpi_add_power_resource(rhandle); |
| 154 | if (err) | 176 | if (err) |
| 155 | break; | 177 | break; |
| @@ -5854,9 +5854,10 @@ static int __init init_binder_device(const char *name) · 5853 unmodified lines | |||
| 5854 | static int __init binder_init(void) | 5854 | static int __init binder_init(void) |
| 5855 | { | 5855 | { |
| 5856 | int ret; | 5856 | int ret; |
| 5857 | char *device_name, *device_names, *device_tmp; | 5857 | char *device_name, *device_tmp; |
| 5858 | struct binder_device *device; | 5858 | struct binder_device *device; |
| 5859 | struct hlist_node *tmp; | 5859 | struct hlist_node *tmp; |
| 5860 | char *device_names = NULL; | ||
| 5860 | 5861 | ||
| 5861 | ret = binder_alloc_shrinker_init(); | 5862 | ret = binder_alloc_shrinker_init(); |
| 5862 | if (ret) | 5863 | if (ret) |
| @@ -5898,23 +5899,29 @@ static int __init binder_init(void) · 35 unmodified lines | |||
| 5898 | &transaction_log_fops); | 5899 | &transaction_log_fops); |
| 5899 | } | 5900 | } |
| 5900 | 5901 | ||
| 5901 | /* | 5902 | if (strcmp(binder_devices_param, "") != 0) { |
| 5902 | * Copy the module_parameter string, because we don't want to | 5903 | /* |
| 5903 | * tokenize it in-place. | 5904 | * Copy the module_parameter string, because we don't want to |
| 5904 | */ | 5905 | * tokenize it in-place. |
| 5905 | device_names = kstrdup(binder_devices_param, GFP_KERNEL); | 5906 | */ |
| 5906 | if (!device_names) { | 5907 | device_names = kstrdup(binder_devices_param, GFP_KERNEL); |
| 5907 | ret = -ENOMEM; | 5908 | if (!device_names) { |
| 5908 | goto err_alloc_device_names_failed; | 5909 | ret = -ENOMEM; |
| 5909 | } | 5910 | goto err_alloc_device_names_failed; |
| 5911 | } | ||
| 5910 | 5912 | ||
| 5911 | device_tmp = device_names; | 5913 | device_tmp = device_names; |
| 5912 | while ((device_name = strsep(&device_tmp, ","))) { | 5914 | while ((device_name = strsep(&device_tmp, ","))) { |
| 5913 | ret = init_binder_device(device_name); | 5915 | ret = init_binder_device(device_name); |
| 5914 | if (ret) | 5916 | if (ret) |
| 5915 | goto err_init_binder_device_failed; | 5917 | goto err_init_binder_device_failed; |
| 5918 | } | ||
| 5916 | } | 5919 | } |
| 5917 | 5920 | ||
| 5921 | ret = init_binderfs(); | ||
| 5922 | if (ret) | ||
| 5923 | goto err_init_binder_device_failed; | ||
| 5924 | |||
| 5918 | return ret; | 5925 | return ret; |
| 5919 | 5926 | ||
| 5920 | err_init_binder_device_failed: | 5927 | err_init_binder_device_failed: |
| @@ -46,4 +46,13 @@ static inline bool is_binderfs_device(const struct inode *inode) · 45 unmodified lines | |||
| 46 | } | 46 | } |
| 47 | #endif | 47 | #endif |
| 48 | 48 | ||
| 49 | #ifdef CONFIG_ANDROID_BINDERFS | ||
| 50 | extern int __init init_binderfs(void); | ||
| 51 | #else | ||
| 52 | static inline int __init init_binderfs(void) | ||
| 53 | { | ||
| 54 | return 0; | ||
| 55 | } | ||
| 56 | #endif | ||
| 57 | |||
| 49 | #endif /* _LINUX_BINDER_INTERNAL_H */ | 58 | #endif /* _LINUX_BINDER_INTERNAL_H */ |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | #include <linux/kdev_t.h> | 11 | #include <linux/kdev_t.h> |
| 12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
| 13 | #include <linux/list.h> | 13 | #include <linux/list.h> |
| 14 | #include <linux/namei.h> | ||
| 14 | #include <linux/magic.h> | 15 | #include <linux/magic.h> |
| 15 | #include <linux/major.h> | 16 | #include <linux/major.h> |
| 16 | #include <linux/miscdevice.h> | 17 | #include <linux/miscdevice.h> |
| @@ -20,6 +21,7 @@ · 3 unmodified lines | |||
| 20 | #include <linux/parser.h> | 21 | #include <linux/parser.h> |
| 21 | #include <linux/radix-tree.h> | 22 | #include <linux/radix-tree.h> |
| 22 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
| 24 | #include <linux/seq_file.h> | ||
| 23 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 24 | #include <linux/spinlock_types.h> | 26 | #include <linux/spinlock_types.h> |
| 25 | #include <linux/stddef.h> | 27 | #include <linux/stddef.h> |
| @@ -30,7 +32,7 @@ · 4 unmodified lines | |||
| 30 | #include <linux/xarray.h> | 32 | #include <linux/xarray.h> |
| 31 | #include <uapi/asm-generic/errno-base.h> | 33 | #include <uapi/asm-generic/errno-base.h> |
| 32 | #include <uapi/linux/android/binder.h> | 34 | #include <uapi/linux/android/binder.h> |
| 33 | #include <uapi/linux/android/binder_ctl.h> | 35 | #include <uapi/linux/android/binderfs.h> |
| 34 | 36 | ||
| 35 | #include "binder_internal.h" | 37 | #include "binder_internal.h" |
| 36 | 38 | ||
| @@ -39,13 +41,31 @@ · 2 unmodified lines | |||
| 39 | #define INODE_OFFSET 3 | 41 | #define INODE_OFFSET 3 |
| 40 | #define INTSTRLEN 21 | 42 | #define INTSTRLEN 21 |
| 41 | #define BINDERFS_MAX_MINOR (1U << MINORBITS) | 43 | #define BINDERFS_MAX_MINOR (1U << MINORBITS) |
| 42 | 44 | /* Ensure that the initial ipc namespace always has devices available. */ | |
| 43 | static struct vfsmount *binderfs_mnt; | 45 | #define BINDERFS_MAX_MINOR_CAPPED (BINDERFS_MAX_MINOR - 4) |
| 44 | 46 | ||
| 45 | static dev_t binderfs_dev; | 47 | static dev_t binderfs_dev; |
| 46 | static DEFINE_MUTEX(binderfs_minors_mutex); | 48 | static DEFINE_MUTEX(binderfs_minors_mutex); |
| 47 | static DEFINE_IDA(binderfs_minors); | 49 | static DEFINE_IDA(binderfs_minors); |
| 48 | 50 | ||
| 51 | /** | ||
| 52 | * binderfs_mount_opts - mount options for binderfs | ||
| 53 | * @max: maximum number of allocatable binderfs binder devices | ||
| 54 | */ | ||
| 55 | struct binderfs_mount_opts { | ||
| 56 | int max; | ||
| 57 | }; | ||
| 58 | |||
| 59 | enum { | ||
| 60 | Opt_max, | ||
| 61 | Opt_err | ||
| 62 | }; | ||
| 63 | |||
| 64 | static const match_table_t tokens = { | ||
| 65 | { Opt_max, "max=%d" }, | ||
| 66 | { Opt_err, NULL } | ||
| 67 | }; | ||
| 68 | |||
| 49 | /** | 69 | /** |
| 50 | * binderfs_info - information about a binderfs mount | 70 | * binderfs_info - information about a binderfs mount |
| 51 | * @ipc_ns: The ipc namespace the binderfs mount belongs to. | 71 | * @ipc_ns: The ipc namespace the binderfs mount belongs to. |
| @@ -55,13 +75,16 @@ static DEFINE_IDA(binderfs_minors); · 3 unmodified lines | |||
| 55 | * created. | 75 | * created. |
| 56 | * @root_gid: gid that needs to be used when a new binder device is | 76 | * @root_gid: gid that needs to be used when a new binder device is |
| 57 | * created. | 77 | * created. |
| 78 | * @mount_opts: The mount options in use. | ||
| 79 | * @device_count: The current number of allocated binder devices. | ||
| 58 | */ | 80 | */ |
| 59 | struct binderfs_info { | 81 | struct binderfs_info { |
| 60 | struct ipc_namespace *ipc_ns; | 82 | struct ipc_namespace *ipc_ns; |
| 61 | struct dentry *control_dentry; | 83 | struct dentry *control_dentry; |
| 62 | kuid_t root_uid; | 84 | kuid_t root_uid; |
| 63 | kgid_t root_gid; | 85 | kgid_t root_gid; |
| 64 | 86 | struct binderfs_mount_opts mount_opts; | |
| 87 | int device_count; | ||
| 65 | }; | 88 | }; |
| 66 | 89 | ||
| 67 | static inline struct binderfs_info *BINDERFS_I(const struct inode *inode) | 90 | static inline struct binderfs_info *BINDERFS_I(const struct inode *inode) |
| @@ -84,7 +107,7 @@ bool is_binderfs_device(const struct inode *inode) · 16 unmodified lines | |||
| 84 | * @userp: buffer to copy information about new device for userspace to | 107 | * @userp: buffer to copy information about new device for userspace to |
| 85 | * @req: struct binderfs_device as copied from userspace | 108 | * @req: struct binderfs_device as copied from userspace |
| 86 | * | 109 | * |
| 87 | * This function allocated a new binder_device and reserves a new minor | 110 | * This function allocates a new binder_device and reserves a new minor |
| 88 | * number for it. | 111 | * number for it. |
| 89 | * Minor numbers are limited and tracked globally in binderfs_minors. The | 112 | * Minor numbers are limited and tracked globally in binderfs_minors. The |
| 90 | * function will stash a struct binder_device for the specific binder | 113 | * function will stash a struct binder_device for the specific binder |
| @@ -100,20 +123,34 @@ static int binderfs_binder_device_create(struct inode *ref_inode, · 9 unmodified lines | |||
| 100 | struct binderfs_device *req) | 123 | struct binderfs_device *req) |
| 101 | { | 124 | { |
| 102 | int minor, ret; | 125 | int minor, ret; |
| 103 | struct dentry *dentry, *dup, *root; | 126 | struct dentry *dentry, *root; |
| 104 | struct binder_device *device; | 127 | struct binder_device *device; |
| 105 | size_t name_len = BINDERFS_MAX_NAME + 1; | ||
| 106 | char *name = NULL; | 128 | char *name = NULL; |
| 129 | size_t name_len; | ||
| 107 | struct inode *inode = NULL; | 130 | struct inode *inode = NULL; |
| 108 | struct super_block *sb = ref_inode->i_sb; | 131 | struct super_block *sb = ref_inode->i_sb; |
| 109 | struct binderfs_info *info = sb->s_fs_info; | 132 | struct binderfs_info *info = sb->s_fs_info; |
| 133 | #if defined(CONFIG_IPC_NS) | ||
| 134 | bool use_reserve = (info->ipc_ns == &init_ipc_ns); | ||
| 135 | #else | ||
| 136 | bool use_reserve = true; | ||
| 137 | #endif | ||
| 110 | 138 | ||
| 111 | /* Reserve new minor number for the new device. */ | 139 | /* Reserve new minor number for the new device. */ |
| 112 | mutex_lock(&binderfs_minors_mutex); | 140 | mutex_lock(&binderfs_minors_mutex); |
| 113 | minor = ida_alloc_max(&binderfs_minors, BINDERFS_MAX_MINOR, GFP_KERNEL); | 141 | if (++info->device_count <= info->mount_opts.max) |
| 114 | mutex_unlock(&binderfs_minors_mutex); | 142 | minor = ida_alloc_max(&binderfs_minors, |
| 115 | if (minor < 0) | 143 | use_reserve ? BINDERFS_MAX_MINOR : |
| 144 | BINDERFS_MAX_MINOR_CAPPED, | ||
| 145 | GFP_KERNEL); | ||
| 146 | else | ||
| 147 | minor = -ENOSPC; | ||
| 148 | if (minor < 0) { | ||
| 149 | --info->device_count; | ||
| 150 | mutex_unlock(&binderfs_minors_mutex); | ||
| 116 | return minor; | 151 | return minor; |
| 152 | } | ||
| 153 | mutex_unlock(&binderfs_minors_mutex); | ||
| 117 | 154 | ||
| 118 | ret = -ENOMEM; | 155 | ret = -ENOMEM; |
| 119 | device = kzalloc(sizeof(*device), GFP_KERNEL); | 156 | device = kzalloc(sizeof(*device), GFP_KERNEL); |
| @@ -132,12 +169,13 @@ static int binderfs_binder_device_create(struct inode *ref_inode, · 12 unmodified lines | |||
| 132 | inode->i_uid = info->root_uid; | 169 | inode->i_uid = info->root_uid; |
| 133 | inode->i_gid = info->root_gid; | 170 | inode->i_gid = info->root_gid; |
| 134 | 171 | ||
| 135 | name = kmalloc(name_len, GFP_KERNEL); | 172 | req->name[BINDERFS_MAX_NAME] = '\0'; /* NUL-terminate */ |
| 173 | name_len = strlen(req->name); | ||
| 174 | /* Make sure to include terminating NUL byte */ | ||
| 175 | name = kmemdup(req->name, name_len + 1, GFP_KERNEL); | ||
| 136 | if (!name) | 176 | if (!name) |
| 137 | goto err; | 177 | goto err; |
| 138 | 178 | ||
| 139 | strscpy(name, req->name, name_len); | ||
| 140 | |||
| 141 | device->binderfs_inode = inode; | 179 | device->binderfs_inode = inode; |
| 142 | device->context.binder_context_mgr_uid = INVALID_UID; | 180 | device->context.binder_context_mgr_uid = INVALID_UID; |
| 143 | device->context.name = name; | 181 | device->context.name = name; |
| @@ -156,28 +194,25 @@ static int binderfs_binder_device_create(struct inode *ref_inode, · 12 unmodified lines | |||
| 156 | 194 | ||
| 157 | root = sb->s_root; | 195 | root = sb->s_root; |
| 158 | inode_lock(d_inode(root)); | 196 | inode_lock(d_inode(root)); |
| 159 | dentry = d_alloc_name(root, name); | 197 | |
| 160 | if (!dentry) { | 198 | /* look it up */ |
| 199 | dentry = lookup_one_len(name, root, name_len); | ||
| 200 | if (IS_ERR(dentry)) { | ||
| 161 | inode_unlock(d_inode(root)); | 201 | inode_unlock(d_inode(root)); |
| 162 | ret = -ENOMEM; | 202 | ret = PTR_ERR(dentry); |
| 163 | goto err; | 203 | goto err; |
| 164 | } | 204 | } |
| 165 | 205 | ||
| 166 | /* Verify that the name userspace gave us is not already in use. */ | 206 | if (d_really_is_positive(dentry)) { |
| 167 | dup = d_lookup(root, &dentry->d_name); | 207 | /* already exists */ |
| 168 | if (dup) { | 208 | dput(dentry); |
| 169 | if (d_really_is_positive(dup)) { | 209 | inode_unlock(d_inode(root)); |
| 170 | dput(dup); | 210 | ret = -EEXIST; |
| 171 | dput(dentry); | 211 | goto err; |
| 172 | inode_unlock(d_inode(root)); | ||
| 173 | ret = -EEXIST; | ||
| 174 | goto err; | ||
| 175 | } | ||
| 176 | dput(dup); | ||
| 177 | } | 212 | } |
| 178 | 213 | ||
| 179 | inode->i_private = device; | 214 | inode->i_private = device; |
| 180 | d_add(dentry, inode); | 215 | d_instantiate(dentry, inode); |
| 181 | fsnotify_create(root->d_inode, dentry); | 216 | fsnotify_create(root->d_inode, dentry); |
| 182 | inode_unlock(d_inode(root)); | 217 | inode_unlock(d_inode(root)); |
| 183 | 218 | ||
| @@ -187,6 +222,7 @@ err: · 3 unmodified lines | |||
| 187 | kfree(name); | 222 | kfree(name); |
| 188 | kfree(device); | 223 | kfree(device); |
| 189 | mutex_lock(&binderfs_minors_mutex); | 224 | mutex_lock(&binderfs_minors_mutex); |
| 225 | --info->device_count; | ||
| 190 | ida_free(&binderfs_minors, minor); | 226 | ida_free(&binderfs_minors, minor); |
| 191 | mutex_unlock(&binderfs_minors_mutex); | 227 | mutex_unlock(&binderfs_minors_mutex); |
| 192 | iput(inode); | 228 | iput(inode); |
| @@ -232,6 +268,7 @@ static long binder_ctl_ioctl(struct file *file, unsigned int cmd, · 39 unmodified lines | |||
| 232 | static void binderfs_evict_inode(struct inode *inode) | 268 | static void binderfs_evict_inode(struct inode *inode) |
| 233 | { | 269 | { |
| 234 | struct binder_device *device = inode->i_private; | 270 | struct binder_device *device = inode->i_private; |
| 271 | struct binderfs_info *info = BINDERFS_I(inode); | ||
| 235 | 272 | ||
| 236 | clear_inode(inode); | 273 | clear_inode(inode); |
| 237 | 274 | ||
| @@ -239,6 +276,7 @@ static void binderfs_evict_inode(struct inode *inode) · 1 unmodified line | |||
| 239 | return; | 276 | return; |
| 240 | 277 | ||
| 241 | mutex_lock(&binderfs_minors_mutex); | 278 | mutex_lock(&binderfs_minors_mutex); |
| 279 | --info->device_count; | ||
| 242 | ida_free(&binderfs_minors, device->miscdev.minor); | 280 | ida_free(&binderfs_minors, device->miscdev.minor); |
| 243 | mutex_unlock(&binderfs_minors_mutex); | 281 | mutex_unlock(&binderfs_minors_mutex); |
| 244 | 282 | ||
| @@ -246,43 +284,87 @@ static void binderfs_evict_inode(struct inode *inode) · 1 unmodified line | |||
| 246 | kfree(device); | 284 | kfree(device); |
| 247 | } | 285 | } |
| 248 | 286 | ||
| 287 | /** | ||
| 288 | * binderfs_parse_mount_opts - parse binderfs mount options | ||
| 289 | * @data: options to set (can be NULL in which case defaults are used) | ||
| 290 | */ | ||
| 291 | static int binderfs_parse_mount_opts(char *data, | ||
| 292 | struct binderfs_mount_opts *opts) | ||
| 293 | { | ||
| 294 | char *p; | ||
| 295 | opts->max = BINDERFS_MAX_MINOR; | ||
| 296 | |||
| 297 | while ((p = strsep(&data, ",")) != NULL) { | ||
| 298 | substring_t args[MAX_OPT_ARGS]; | ||
| 299 | int token; | ||
| 300 | int max_devices; | ||
| 301 | |||
| 302 | if (!*p) | ||
| 303 | continue; | ||
| 304 | |||
| 305 | token = match_token(p, tokens, args); | ||
| 306 | switch (token) { | ||
| 307 | case Opt_max: | ||
| 308 | if (match_int(&args[0], &max_devices) || | ||
| 309 | (max_devices < 0 || | ||
| 310 | (max_devices > BINDERFS_MAX_MINOR))) | ||
| 311 | return -EINVAL; | ||
| 312 | |||
| 313 | opts->max = max_devices; | ||
| 314 | break; | ||
| 315 | default: | ||
| 316 | pr_err("Invalid mount options\n"); | ||
| 317 | return -EINVAL; | ||
| 318 | } | ||
| 319 | } | ||
| 320 | |||
| 321 | return 0; | ||
| 322 | } | ||
| 323 | |||
| 324 | static int binderfs_remount(struct super_block *sb, int *flags, char *data) | ||
| 325 | { | ||
| 326 | struct binderfs_info *info = sb->s_fs_info; | ||
| 327 | return binderfs_parse_mount_opts(data, &info->mount_opts); | ||
| 328 | } | ||
| 329 | |||
| 330 | static int binderfs_show_mount_opts(struct seq_file *seq, struct dentry *root) | ||
| 331 | { | ||
| 332 | struct binderfs_info *info; | ||
| 333 | |||
| 334 | info = root->d_sb->s_fs_info; | ||
| 335 | if (info->mount_opts.max <= BINDERFS_MAX_MINOR) | ||
| 336 | seq_printf(seq, ",max=%d", info->mount_opts.max); | ||
| 337 | |||
| 338 | return 0; | ||
| 339 | } | ||
| 340 | |||
| 249 | static const struct super_operations binderfs_super_ops = { | 341 | static const struct super_operations binderfs_super_ops = { |
| 250 | .statfs = simple_statfs, | 342 | .evict_inode = binderfs_evict_inode, |
| 251 | .evict_inode = binderfs_evict_inode, | 343 | .remount_fs = binderfs_remount, |
| 344 | .show_options = binderfs_show_mount_opts, | ||
| 345 | .statfs = simple_statfs, | ||
| 252 | }; | 346 | }; |
| 253 | 347 | ||
| 348 | static inline bool is_binderfs_control_device(const struct dentry *dentry) | ||
| 349 | { | ||
| 350 | struct binderfs_info *info = dentry->d_sb->s_fs_info; | ||
| 351 | return info->control_dentry == dentry; | ||
| 352 | } | ||
| 353 | |||
| 254 | static int binderfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 354 | static int binderfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
| 255 | struct inode *new_dir, struct dentry *new_dentry, | 355 | struct inode *new_dir, struct dentry *new_dentry, |
| 256 | unsigned int flags) | 356 | unsigned int flags) |
| 257 | { | 357 | { |
| 258 | struct inode *inode = d_inode(old_dentry); | 358 | if (is_binderfs_control_device(old_dentry) || |
| 259 | 359 | is_binderfs_control_device(new_dentry)) | |
| 260 | /* binderfs doesn't support directories. */ | ||
| 261 | if (d_is_dir(old_dentry)) | ||
| 262 | return -EPERM; | 360 | return -EPERM; |
| 263 | 361 | ||
| 264 | if (flags & ~RENAME_NOREPLACE) | 362 | return simple_rename(old_dir, old_dentry, new_dir, new_dentry, flags); |
| 265 | return -EINVAL; | ||
| 266 | |||
| 267 | if (!simple_empty(new_dentry)) | ||
| 268 | return -ENOTEMPTY; | ||
| 269 | |||
| 270 | if (d_really_is_positive(new_dentry)) | ||
| 271 | simple_unlink(new_dir, new_dentry); | ||
| 272 | |||
| 273 | old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime = | ||
| 274 | new_dir->i_mtime = inode->i_ctime = current_time(old_dir); | ||
| 275 | |||
| 276 | return 0; | ||
| 277 | } | 363 | } |
| 278 | 364 | ||
| 279 | static int binderfs_unlink(struct inode *dir, struct dentry *dentry) | 365 | static int binderfs_unlink(struct inode *dir, struct dentry *dentry) |
| 280 | { | 366 | { |
| 281 | /* | 367 | if (is_binderfs_control_device(dentry)) |
| 282 | * The control dentry is only ever touched during mount so checking it | ||
| 283 | * here should not require us to take lock. | ||
| 284 | */ | ||
| 285 | if (BINDERFS_I(dir)->control_dentry == dentry) | ||
| 286 | return -EPERM; | 368 | return -EPERM; |
| 287 | 369 | ||
| 288 | return simple_unlink(dir, dentry); | 370 | return simple_unlink(dir, dentry); |
| @@ -313,13 +395,16 @@ static int binderfs_binder_ctl_create(struct super_block *sb) · 24 unmodified lines | |||
| 313 | struct inode *inode = NULL; | 395 | struct inode *inode = NULL; |
| 314 | struct dentry *root = sb->s_root; | 396 | struct dentry *root = sb->s_root; |
| 315 | struct binderfs_info *info = sb->s_fs_info; | 397 | struct binderfs_info *info = sb->s_fs_info; |
| 398 | #if defined(CONFIG_IPC_NS) | ||
| 399 | bool use_reserve = (info->ipc_ns == &init_ipc_ns); | ||
| 400 | #else | ||
| 401 | bool use_reserve = true; | ||
| 402 | #endif | ||
| 316 | 403 | ||
| 317 | device = kzalloc(sizeof(*device), GFP_KERNEL); | 404 | device = kzalloc(sizeof(*device), GFP_KERNEL); |
| 318 | if (!device) | 405 | if (!device) |
| 319 | return -ENOMEM; | 406 | return -ENOMEM; |
| 320 | 407 | ||
| 321 | inode_lock(d_inode(root)); | ||
| 322 | |||
| 323 | /* If we have already created a binder-control node, return. */ | 408 | /* If we have already created a binder-control node, return. */ |
| 324 | if (info->control_dentry) { | 409 | if (info->control_dentry) { |
| 325 | ret = 0; | 410 | ret = 0; |
| @@ -333,7 +418,10 @@ static int binderfs_binder_ctl_create(struct super_block *sb) · 7 unmodified lines | |||
| 333 | 418 | ||
| 334 | /* Reserve a new minor number for the new device. */ | 419 | /* Reserve a new minor number for the new device. */ |
| 335 | mutex_lock(&binderfs_minors_mutex); | 420 | mutex_lock(&binderfs_minors_mutex); |
| 336 | minor = ida_alloc_max(&binderfs_minors, BINDERFS_MAX_MINOR, GFP_KERNEL); | 421 | minor = ida_alloc_max(&binderfs_minors, |
| 422 | use_reserve ? BINDERFS_MAX_MINOR : | ||
| 423 | BINDERFS_MAX_MINOR_CAPPED, | ||
| 424 | GFP_KERNEL); | ||
| 337 | mutex_unlock(&binderfs_minors_mutex); | 425 | mutex_unlock(&binderfs_minors_mutex); |
| 338 | if (minor < 0) { | 426 | if (minor < 0) { |
| 339 | ret = minor; | 427 | ret = minor; |
| @@ -358,12 +446,10 @@ static int binderfs_binder_ctl_create(struct super_block *sb) · 18 unmodified lines | |||
| 358 | inode->i_private = device; | 446 | inode->i_private = device; |
| 359 | info->control_dentry = dentry; | 447 | info->control_dentry = dentry; |
| 360 | d_add(dentry, inode); | 448 | d_add(dentry, inode); |
| 361 | inode_unlock(d_inode(root)); | ||
| 362 | 449 | ||
| 363 | return 0; | 450 | return 0; |
| 364 | 451 | ||
| 365 | out: | 452 | out: |
| 366 | inode_unlock(d_inode(root)); | ||
| 367 | kfree(device); | 453 | kfree(device); |
| 368 | iput(inode); | 454 | iput(inode); |
| 369 | 455 | ||
| @@ -378,12 +464,9 @@ static const struct inode_operations binderfs_dir_inode_operations = { · 8 unmodified lines | |||
| 378 | 464 | ||
| 379 | static int binderfs_fill_super(struct super_block *sb, void *data, int silent) | 465 | static int binderfs_fill_super(struct super_block *sb, void *data, int silent) |
| 380 | { | 466 | { |
| 467 | int ret; | ||
| 381 | struct binderfs_info *info; | 468 | struct binderfs_info *info; |
| 382 | int ret = -ENOMEM; | ||
| 383 | struct inode *inode = NULL; | 469 | struct inode *inode = NULL; |
| 384 | struct ipc_namespace *ipc_ns = sb->s_fs_info; | ||
| 385 | |||
| 386 | get_ipc_ns(ipc_ns); | ||
| 387 | 470 | ||
| 388 | sb->s_blocksize = PAGE_SIZE; | 471 | sb->s_blocksize = PAGE_SIZE; |
| 389 | sb->s_blocksize_bits = PAGE_SHIFT; | 472 | sb->s_blocksize_bits = PAGE_SHIFT; |
| @@ -405,11 +488,17 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) · 15 unmodified lines | |||
| 405 | sb->s_op = &binderfs_super_ops; | 488 | sb->s_op = &binderfs_super_ops; |
| 406 | sb->s_time_gran = 1; | 489 | sb->s_time_gran = 1; |
| 407 | 490 | ||
| 408 | info = kzalloc(sizeof(struct binderfs_info), GFP_KERNEL); | 491 | sb->s_fs_info = kzalloc(sizeof(struct binderfs_info), GFP_KERNEL); |
| 409 | if (!info) | 492 | if (!sb->s_fs_info) |
| 410 | goto err_without_dentry; | 493 | return -ENOMEM; |
| 494 | info = sb->s_fs_info; | ||
| 495 | |||
| 496 | info->ipc_ns = get_ipc_ns(current->nsproxy->ipc_ns); | ||
| 497 | |||
| 498 | ret = binderfs_parse_mount_opts(data, &info->mount_opts); | ||
| 499 | if (ret) | ||
| 500 | return ret; | ||
| 411 | 501 | ||
| 412 | info->ipc_ns = ipc_ns; | ||
| 413 | info->root_gid = make_kgid(sb->s_user_ns, 0); | 502 | info->root_gid = make_kgid(sb->s_user_ns, 0); |
| 414 | if (!gid_valid(info->root_gid)) | 503 | if (!gid_valid(info->root_gid)) |
| 415 | info->root_gid = GLOBAL_ROOT_GID; | 504 | info->root_gid = GLOBAL_ROOT_GID; |
| @@ -417,11 +506,9 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) · 1 unmodified line | |||
| 417 | if (!uid_valid(info->root_uid)) | 506 | if (!uid_valid(info->root_uid)) |
| 418 | info->root_uid = GLOBAL_ROOT_UID; | 507 | info->root_uid = GLOBAL_ROOT_UID; |
| 419 | 508 | ||
| 420 | sb->s_fs_info = info; | ||
| 421 | |||
| 422 | inode = new_inode(sb); | 509 | inode = new_inode(sb); |
| 423 | if (!inode) | 510 | if (!inode) |
| 424 | goto err_without_dentry; | 511 | return -ENOMEM; |
| 425 | 512 | ||
| 426 | inode->i_ino = FIRST_INODE; | 513 | inode->i_ino = FIRST_INODE; |
| 427 | inode->i_fop = &simple_dir_operations; | 514 | inode->i_fop = &simple_dir_operations; |
| @@ -432,79 +519,28 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) · 4 unmodified lines | |||
| 432 | 519 | ||
| 433 | sb->s_root = d_make_root(inode); | 520 | sb->s_root = d_make_root(inode); |
| 434 | if (!sb->s_root) | 521 | if (!sb->s_root) |
| 435 | goto err_without_dentry; | 522 | return -ENOMEM; |
| 436 | |||
| 437 | ret = binderfs_binder_ctl_create(sb); | ||
| 438 | if (ret) | ||
| 439 | goto err_with_dentry; | ||
| 440 | |||
| 441 | return 0; | ||
| 442 | |||
| 443 | err_with_dentry: | ||
| 444 | dput(sb->s_root); | ||
| 445 | sb->s_root = NULL; | ||
| 446 | |||
| 447 | err_without_dentry: | ||
| 448 | put_ipc_ns(ipc_ns); | ||
| 449 | iput(inode); | ||
| 450 | kfree(info); | ||
| 451 | |||
| 452 | return ret; | ||
| 453 | } | ||
| 454 | |||
| 455 | static int binderfs_test_super(struct super_block *sb, void *data) | ||
| 456 | { | ||
| 457 | struct binderfs_info *info = sb->s_fs_info; | ||
| 458 | |||
| 459 | if (info) | ||
| 460 | return info->ipc_ns == data; | ||
| 461 | |||
| 462 | return 0; | ||
| 463 | } | ||
| 464 | 523 | ||
| 465 | static int binderfs_set_super(struct super_block *sb, void *data) | 524 | return binderfs_binder_ctl_create(sb); |
| 466 | { | ||
| 467 | sb->s_fs_info = data; | ||
| 468 | return set_anon_super(sb, NULL); | ||
| 469 | } | 525 | } |
| 470 | 526 | ||
| 471 | static struct dentry *binderfs_mount(struct file_system_type *fs_type, | 527 | static struct dentry *binderfs_mount(struct file_system_type *fs_type, |
| 472 | int flags, const char *dev_name, | 528 | int flags, const char *dev_name, |
| 473 | void *data) | 529 | void *data) |
| 474 | { | 530 | { |
| 475 | struct super_block *sb; | 531 | return mount_nodev(fs_type, flags, data, binderfs_fill_super); |
| 476 | struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns; | ||
| 477 | |||
| 478 | if (!ns_capable(ipc_ns->user_ns, CAP_SYS_ADMIN)) | ||
| 479 | return ERR_PTR(-EPERM); | ||
| 480 | |||
| 481 | sb = sget_userns(fs_type, binderfs_test_super, binderfs_set_super, | ||
| 482 | flags, ipc_ns->user_ns, ipc_ns); | ||
| 483 | if (IS_ERR(sb)) | ||
| 484 | return ERR_CAST(sb); | ||
| 485 | |||
| 486 | if (!sb->s_root) { | ||
| 487 | int ret = binderfs_fill_super(sb, data, flags & SB_SILENT ? 1 : 0); | ||
| 488 | if (ret) { | ||
| 489 | deactivate_locked_super(sb); | ||
| 490 | return ERR_PTR(ret); | ||
| 491 | } | ||
| 492 | |||
| 493 | sb->s_flags |= SB_ACTIVE; | ||
| 494 | } | ||
| 495 | |||
| 496 | return dget(sb->s_root); | ||
| 497 | } | 532 | } |
| 498 | 533 | ||
| 499 | static void binderfs_kill_super(struct super_block *sb) | 534 | static void binderfs_kill_super(struct super_block *sb) |
| 500 | { | 535 | { |
| 501 | struct binderfs_info *info = sb->s_fs_info; | 536 | struct binderfs_info *info = sb->s_fs_info; |
| 502 | 537 | ||
| 538 | kill_litter_super(sb); | ||
| 539 | |||
| 503 | if (info && info->ipc_ns) | 540 | if (info && info->ipc_ns) |
| 504 | put_ipc_ns(info->ipc_ns); | 541 | put_ipc_ns(info->ipc_ns); |
| 505 | 542 | ||
| 506 | kfree(info); | 543 | kfree(info); |
| 507 | kill_litter_super(sb); | ||
| 508 | } | 544 | } |
| 509 | 545 | ||
| 510 | static struct file_system_type binder_fs_type = { | 546 | static struct file_system_type binder_fs_type = { |
| @@ -514,7 +550,7 @@ static struct file_system_type binder_fs_type = { · 3 unmodified lines | |||
| 514 | .fs_flags = FS_USERNS_MOUNT, | 550 | .fs_flags = FS_USERNS_MOUNT, |
| 515 | }; | 551 | }; |
| 516 | 552 | ||
| 517 | static int __init init_binderfs(void) | 553 | int __init init_binderfs(void) |
| 518 | { | 554 | { |
| 519 | int ret; | 555 | int ret; |
| 520 | 556 | ||
| @@ -530,15 +566,5 @@ static int __init init_binderfs(void) · 9 unmodified lines | |||
| 530 | return ret; | 566 | return ret; |
| 531 | } | 567 | } |
| 532 | 568 | ||
| 533 | binderfs_mnt = kern_mount(&binder_fs_type); | ||
| 534 | if (IS_ERR(binderfs_mnt)) { | ||
| 535 | ret = PTR_ERR(binderfs_mnt); | ||
| 536 | binderfs_mnt = NULL; | ||
| 537 | unregister_filesystem(&binder_fs_type); | ||
| 538 | unregister_chrdev_region(binderfs_dev, BINDERFS_MAX_MINOR); | ||
| 539 | } | ||
| 540 | |||
| 541 | return ret; | 569 | return ret; |
| 542 | } | 570 | } |
| 543 | |||
| 544 | device_initcall(init_binderfs); | ||
| @@ -1091,7 +1091,7 @@ comment "Generic fallback / legacy drivers" · 1090 unmodified lines | |||
| 1091 | 1091 | ||
| 1092 | config PATA_ACPI | 1092 | config PATA_ACPI |
| 1093 | tristate "ACPI firmware driver for PATA" | 1093 | tristate "ACPI firmware driver for PATA" |
| 1094 | depends on ATA_ACPI && ATA_BMDMA | 1094 | depends on ATA_ACPI && ATA_BMDMA && PCI |
| 1095 | help | 1095 | help |
| 1096 | This option enables an ACPI method driver which drives | 1096 | This option enables an ACPI method driver which drives |
| 1097 | motherboard PATA controller interfaces through the ACPI | 1097 | motherboard PATA controller interfaces through the ACPI |
| @@ -254,6 +254,8 @@ enum { · 253 unmodified lines | |||
| 254 | AHCI_HFLAG_IS_MOBILE = (1 << 25), /* mobile chipset, use | 254 | AHCI_HFLAG_IS_MOBILE = (1 << 25), /* mobile chipset, use |
| 255 | SATA_MOBILE_LPM_POLICY | 255 | SATA_MOBILE_LPM_POLICY |
| 256 | as default lpm_policy */ | 256 | as default lpm_policy */ |
| 257 | AHCI_HFLAG_SUSPEND_PHYS = (1 << 26), /* handle PHYs during | ||
| 258 | suspend/resume */ | ||
| 257 | 259 | ||
| 258 | /* ap->flags bits */ | 260 | /* ap->flags bits */ |
| 259 | 261 | ||
| @@ -28,6 +28,11 @@ · 27 unmodified lines | |||
| 28 | #define AHCI_WINDOW_BASE(win) (0x64 + ((win) << 4)) | 28 | #define AHCI_WINDOW_BASE(win) (0x64 + ((win) << 4)) |
| 29 | #define AHCI_WINDOW_SIZE(win) (0x68 + ((win) << 4)) | 29 | #define AHCI_WINDOW_SIZE(win) (0x68 + ((win) << 4)) |
| 30 | 30 | ||
| 31 | struct ahci_mvebu_plat_data { | ||
| 32 | int (*plat_config)(struct ahci_host_priv *hpriv); | ||
| 33 | unsigned int flags; | ||
| 34 | }; | ||
| 35 | |||
| 31 | static void ahci_mvebu_mbus_config(struct ahci_host_priv *hpriv, | 36 | static void ahci_mvebu_mbus_config(struct ahci_host_priv *hpriv, |
| 32 | const struct mbus_dram_target_info *dram) | 37 | const struct mbus_dram_target_info *dram) |
| 33 | { | 38 | { |
| @@ -62,6 +67,35 @@ static void ahci_mvebu_regret_option(struct ahci_host_priv *hpriv) · 28 unmodified lines | |||
| 62 | writel(0x80, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA); | 67 | writel(0x80, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA); |
| 63 | } | 68 | } |
| 64 | 69 | ||
| 70 | static int ahci_mvebu_armada_380_config(struct ahci_host_priv *hpriv) | ||
| 71 | { | ||
| 72 | const struct mbus_dram_target_info *dram; | ||
| 73 | int rc = 0; | ||
| 74 | |||
| 75 | dram = mv_mbus_dram_info(); | ||
| 76 | if (dram) | ||
| 77 | ahci_mvebu_mbus_config(hpriv, dram); | ||
| 78 | else | ||
| 79 | rc = -ENODEV; | ||
| 80 | |||
| 81 | ahci_mvebu_regret_option(hpriv); | ||
| 82 | |||
| 83 | return rc; | ||
| 84 | } | ||
| 85 | |||
| 86 | static int ahci_mvebu_armada_3700_config(struct ahci_host_priv *hpriv) | ||
| 87 | { | ||
| 88 | u32 reg; | ||
| 89 | |||
| 90 | writel(0, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_ADDR); | ||
| 91 | |||
| 92 | reg = readl(hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA); | ||
| 93 | reg |= BIT(6); | ||
| 94 | writel(reg, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA); | ||
| 95 | |||
| 96 | return 0; | ||
| 97 | } | ||
| 98 | |||
| 65 | /** | 99 | /** |
| 66 | * ahci_mvebu_stop_engine | 100 | * ahci_mvebu_stop_engine |
| 67 | * | 101 | * |
| @@ -126,13 +160,9 @@ static int ahci_mvebu_resume(struct platform_device *pdev) · 58 unmodified lines | |||
| 126 | { | 160 | { |
| 127 | struct ata_host *host = platform_get_drvdata(pdev); | 161 | struct ata_host *host = platform_get_drvdata(pdev); |
| 128 | struct ahci_host_priv *hpriv = host->private_data; | 162 | struct ahci_host_priv *hpriv = host->private_data; |
| 129 | const struct mbus_dram_target_info *dram; | 163 | const struct ahci_mvebu_plat_data *pdata = hpriv->plat_data; |
| 130 | 164 | ||
| 131 | dram = mv_mbus_dram_info(); | 165 | pdata->plat_config(hpriv); |
| 132 | if (dram) | ||
| 133 | ahci_mvebu_mbus_config(hpriv, dram); | ||
| 134 | |||
| 135 | ahci_mvebu_regret_option(hpriv); | ||
| 136 | 166 | ||
| 137 | return ahci_platform_resume_host(&pdev->dev); | 167 | return ahci_platform_resume_host(&pdev->dev); |
| 138 | } | 168 | } |
| @@ -154,29 +184,30 @@ static struct scsi_host_template ahci_platform_sht = { · 15 unmodified lines | |||
| 154 | 184 | ||
| 155 | static int ahci_mvebu_probe(struct platform_device *pdev) | 185 | static int ahci_mvebu_probe(struct platform_device *pdev) |
| 156 | { | 186 | { |
| 187 | const struct ahci_mvebu_plat_data *pdata; | ||
| 157 | struct ahci_host_priv *hpriv; | 188 | struct ahci_host_priv *hpriv; |
| 158 | const struct mbus_dram_target_info *dram; | ||
| 159 | int rc; | 189 | int rc; |
| 160 | 190 | ||
| 191 | pdata = of_device_get_match_data(&pdev->dev); | ||
| 192 | if (!pdata) | ||
| 193 | return -EINVAL; | ||
| 194 | |||
| 161 | hpriv = ahci_platform_get_resources(pdev, 0); | 195 | hpriv = ahci_platform_get_resources(pdev, 0); |
| 162 | if (IS_ERR(hpriv)) | 196 | if (IS_ERR(hpriv)) |
| 163 | return PTR_ERR(hpriv); | 197 | return PTR_ERR(hpriv); |
| 164 | 198 | ||
| 199 | hpriv->flags |= pdata->flags; | ||
| 200 | hpriv->plat_data = (void *)pdata; | ||
| 201 | |||
| 165 | rc = ahci_platform_enable_resources(hpriv); | 202 | rc = ahci_platform_enable_resources(hpriv); |
| 166 | if (rc) | 203 | if (rc) |
| 167 | return rc; | 204 | return rc; |
| 168 | 205 | ||
| 169 | hpriv->stop_engine = ahci_mvebu_stop_engine; | 206 | hpriv->stop_engine = ahci_mvebu_stop_engine; |
| 170 | 207 | ||
| 171 | if (of_device_is_compatible(pdev->dev.of_node, | 208 | rc = pdata->plat_config(hpriv); |
| 172 | "marvell,armada-380-ahci")) { | 209 | if (rc) |
| 173 | dram = mv_mbus_dram_info(); | 210 | goto disable_resources; |
| 174 | if (!dram) | ||
| 175 | return -ENODEV; | ||
| 176 | |||
| 177 | ahci_mvebu_mbus_config(hpriv, dram); | ||
| 178 | ahci_mvebu_regret_option(hpriv); | ||
| 179 | } | ||
| 180 | 211 | ||
| 181 | rc = ahci_platform_init_host(pdev, hpriv, &ahci_mvebu_port_info, | 212 | rc = ahci_platform_init_host(pdev, hpriv, &ahci_mvebu_port_info, |
| 182 | &ahci_platform_sht); | 213 | &ahci_platform_sht); |
| @@ -190,18 +221,28 @@ disable_resources: · 7 unmodified lines | |||
| 190 | return rc; | 221 | return rc; |
| 191 | } | 222 | } |
| 192 | 223 | ||
| 224 | static const struct ahci_mvebu_plat_data ahci_mvebu_armada_380_plat_data = { | ||
| 225 | .plat_config = ahci_mvebu_armada_380_config, | ||
| 226 | }; | ||
| 227 | |||
| 228 | static const struct ahci_mvebu_plat_data ahci_mvebu_armada_3700_plat_data = { | ||
| 229 | .plat_config = ahci_mvebu_armada_3700_config, | ||
| 230 | .flags = AHCI_HFLAG_SUSPEND_PHYS, | ||
| 231 | }; | ||
| 232 | |||
| 193 | static const struct of_device_id ahci_mvebu_of_match[] = { | 233 | static const struct of_device_id ahci_mvebu_of_match[] = { |
| 194 | { .compatible = "marvell,armada-380-ahci", }, | 234 | { |
| 195 | { .compatible = "marvell,armada-3700-ahci", }, | 235 | .compatible = "marvell,armada-380-ahci", |
| 236 | .data = &ahci_mvebu_armada_380_plat_data, | ||
| 237 | }, | ||
| 238 | { | ||
| 239 | .compatible = "marvell,armada-3700-ahci", | ||
| 240 | .data = &ahci_mvebu_armada_3700_plat_data, | ||
| 241 | }, | ||
| 196 | { }, | 242 | { }, |
| 197 | }; | 243 | }; |
| 198 | MODULE_DEVICE_TABLE(of, ahci_mvebu_of_match); | 244 | MODULE_DEVICE_TABLE(of, ahci_mvebu_of_match); |
| 199 | 245 | ||
| 200 | /* | ||
| 201 | * We currently don't provide power management related operations, | ||
| 202 | * since there is no suspend/resume support at the platform level for | ||
| 203 | * Armada 38x for the moment. | ||
| 204 | */ | ||
| 205 | static struct platform_driver ahci_mvebu_driver = { | 246 | static struct platform_driver ahci_mvebu_driver = { |
| 206 | .probe = ahci_mvebu_probe, | 247 | .probe = ahci_mvebu_probe, |
| 207 | .remove = ata_platform_remove_one, | 248 | .remove = ata_platform_remove_one, |
| @@ -56,6 +56,12 @@ static int ahci_platform_enable_phys(struct ahci_host_priv *hpriv) · 55 unmodified lines | |||
| 56 | if (rc) | 56 | if (rc) |
| 57 | goto disable_phys; | 57 | goto disable_phys; |
| 58 | 58 | ||
| 59 | rc = phy_set_mode(hpriv->phys[i], PHY_MODE_SATA); | ||
| 60 | if (rc) { | ||
| 61 | phy_exit(hpriv->phys[i]); | ||
| 62 | goto disable_phys; | ||
| 63 | } | ||
| 64 | |||
| 59 | rc = phy_power_on(hpriv->phys[i]); | 65 | rc = phy_power_on(hpriv->phys[i]); |
| 60 | if (rc) { | 66 | if (rc) { |
| 61 | phy_exit(hpriv->phys[i]); | 67 | phy_exit(hpriv->phys[i]); |
| @@ -738,6 +744,9 @@ int ahci_platform_suspend_host(struct device *dev) · 676 unmodified lines | |||
| 738 | writel(ctl, mmio + HOST_CTL); | 744 | writel(ctl, mmio + HOST_CTL); |
| 739 | readl(mmio + HOST_CTL); /* flush */ | 745 | readl(mmio + HOST_CTL); /* flush */ |
| 740 | 746 | ||
| 747 | if (hpriv->flags & AHCI_HFLAG_SUSPEND_PHYS) | ||
| 748 | ahci_platform_disable_phys(hpriv); | ||
| 749 | |||
| 741 | return ata_host_suspend(host, PMSG_SUSPEND); | 750 | return ata_host_suspend(host, PMSG_SUSPEND); |
| 742 | } | 751 | } |
| 743 | EXPORT_SYMBOL_GPL(ahci_platform_suspend_host); | 752 | EXPORT_SYMBOL_GPL(ahci_platform_suspend_host); |
| @@ -756,6 +765,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_suspend_host); · 12 unmodified lines | |||
| 756 | int ahci_platform_resume_host(struct device *dev) | 765 | int ahci_platform_resume_host(struct device *dev) |
| 757 | { | 766 | { |
| 758 | struct ata_host *host = dev_get_drvdata(dev); | 767 | struct ata_host *host = dev_get_drvdata(dev); |
| 768 | struct ahci_host_priv *hpriv = host->private_data; | ||
| 759 | int rc; | 769 | int rc; |
| 760 | 770 | ||
| 761 | if (dev->power.power_state.event == PM_EVENT_SUSPEND) { | 771 | if (dev->power.power_state.event == PM_EVENT_SUSPEND) { |
| @@ -766,6 +776,9 @@ int ahci_platform_resume_host(struct device *dev) · 4 unmodified lines | |||
| 766 | ahci_init_controller(host); | 776 | ahci_init_controller(host); |
| 767 | } | 777 | } |
| 768 | 778 | ||
| 779 | if (hpriv->flags & AHCI_HFLAG_SUSPEND_PHYS) | ||
| 780 | ahci_platform_enable_phys(hpriv); | ||
| 781 | |||
| 769 | ata_host_resume(host); | 782 | ata_host_resume(host); |
| 770 | 783 | ||
| 771 | return 0; | 784 | return 0; |
| @@ -4554,6 +4554,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { · 4553 unmodified lines | |||
| 4554 | { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM, }, | 4554 | { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM, }, |
| 4555 | { "SAMSUNG SSD PM830 mSATA *", "CXM13D1Q", ATA_HORKAGE_NOLPM, }, | 4555 | { "SAMSUNG SSD PM830 mSATA *", "CXM13D1Q", ATA_HORKAGE_NOLPM, }, |
| 4556 | { "SAMSUNG MZ7TD256HAFV-000L9", NULL, ATA_HORKAGE_NOLPM, }, | 4556 | { "SAMSUNG MZ7TD256HAFV-000L9", NULL, ATA_HORKAGE_NOLPM, }, |
| 4557 | { "SAMSUNG MZ7TE512HMHP-000L1", "EXT06L0Q", ATA_HORKAGE_NOLPM, }, | ||
| 4557 | 4558 | ||
| 4558 | /* devices that don't properly handle queued TRIM commands */ | 4559 | /* devices that don't properly handle queued TRIM commands */ |
| 4559 | { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | | 4560 | { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
| @@ -915,6 +915,10 @@ static struct scsi_host_template pata_macio_sht = { · 914 unmodified lines | |||
| 915 | .sg_tablesize = MAX_DCMDS, | 915 | .sg_tablesize = MAX_DCMDS, |
| 916 | /* We may not need that strict one */ | 916 | /* We may not need that strict one */ |
| 917 | .dma_boundary = ATA_DMA_BOUNDARY, | 917 | .dma_boundary = ATA_DMA_BOUNDARY, |
| 918 | /* Not sure what the real max is but we know it's less than 64K, let's | ||
| 919 | * use 64K minus 256 | ||
| 920 | */ | ||
| 921 | .max_segment_size = MAX_DBDMA_SEG, | ||
| 918 | .slave_configure = pata_macio_slave_config, | 922 | .slave_configure = pata_macio_slave_config, |
| 919 | }; | 923 | }; |
| 920 | 924 | ||
| @@ -1044,11 +1048,6 @@ static int pata_macio_common_init(struct pata_macio_priv *priv, · 123 unmodified lines | |||
| 1044 | /* Make sure we have sane initial timings in the cache */ | 1048 | /* Make sure we have sane initial timings in the cache */ |
| 1045 | pata_macio_default_timings(priv); | 1049 | pata_macio_default_timings(priv); |
| 1046 | 1050 | ||
| 1047 | /* Not sure what the real max is but we know it's less than 64K, let's | ||
| 1048 | * use 64K minus 256 | ||
| 1049 | */ | ||
| 1050 | dma_set_max_seg_size(priv->dev, MAX_DBDMA_SEG); | ||
| 1051 | |||
| 1052 | /* Allocate libata host for 1 port */ | 1051 | /* Allocate libata host for 1 port */ |
| 1053 | memset(&pinfo, 0, sizeof(struct ata_port_info)); | 1052 | memset(&pinfo, 0, sizeof(struct ata_port_info)); |
| 1054 | pmac_macio_calc_timing_masks(priv, &pinfo); | 1053 | pmac_macio_calc_timing_masks(priv, &pinfo); |
| @@ -729,8 +729,8 @@ static int sata_fsl_port_start(struct ata_port *ap) · 728 unmodified lines | |||
| 729 | if (!pp) | 729 | if (!pp) |
| 730 | return -ENOMEM; | 730 | return -ENOMEM; |
| 731 | 731 | ||
| 732 | mem = dma_zalloc_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ, &mem_dma, | 732 | mem = dma_alloc_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ, &mem_dma, |
| 733 | GFP_KERNEL); | 733 | GFP_KERNEL); |
| 734 | if (!mem) { | 734 | if (!mem) { |
| 735 | kfree(pp); | 735 | kfree(pp); |
| 736 | return -ENOMEM; | 736 | return -ENOMEM; |
| @@ -245,8 +245,15 @@ struct inic_port_priv { · 244 unmodified lines | |||
| 245 | 245 | ||
| 246 | static struct scsi_host_template inic_sht = { | 246 | static struct scsi_host_template inic_sht = { |
| 247 | ATA_BASE_SHT(DRV_NAME), | 247 | ATA_BASE_SHT(DRV_NAME), |
| 248 | .sg_tablesize = LIBATA_MAX_PRD, /* maybe it can be larger? */ | 248 | .sg_tablesize = LIBATA_MAX_PRD, /* maybe it can be larger? */ |
| 249 | .dma_boundary = INIC_DMA_BOUNDARY, | 249 | |
| 250 | /* | ||
| 251 | * This controller is braindamaged. dma_boundary is 0xffff like others | ||
| 252 | * but it will lock up the whole machine HARD if 65536 byte PRD entry | ||
| 253 | * is fed. Reduce maximum segment size. | ||
| 254 | */ | ||
| 255 | .dma_boundary = INIC_DMA_BOUNDARY, | ||
| 256 | .max_segment_size = 65536 - 512, | ||
| 250 | }; | 257 | }; |
| 251 | 258 | ||
| 252 | static const int scr_map[] = { | 259 | static const int scr_map[] = { |
| @@ -868,17 +875,6 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 615 unmodified lines | |||
| 868 | return rc; | 875 | return rc; |
| 869 | } | 876 | } |
| 870 | 877 | ||
| 871 | /* | ||
| 872 | * This controller is braindamaged. dma_boundary is 0xffff | ||
| 873 | * like others but it will lock up the whole machine HARD if | ||
| 874 | * 65536 byte PRD entry is fed. Reduce maximum segment size. | ||
| 875 | */ | ||
| 876 | rc = dma_set_max_seg_size(&pdev->dev, 65536 - 512); | ||
| 877 | if (rc) { | ||
| 878 | dev_err(&pdev->dev, "failed to set the maximum segment size\n"); | ||
| 879 | return rc; | ||
| 880 | } | ||
| 881 | |||
| 882 | rc = init_controller(hpriv->mmio_base, hpriv->cached_hctl); | 878 | rc = init_controller(hpriv->mmio_base, hpriv->cached_hctl); |
| 883 | if (rc) { | 879 | if (rc) { |
| 884 | dev_err(&pdev->dev, "failed to initialize controller\n"); | 880 | dev_err(&pdev->dev, "failed to initialize controller\n"); |
| @@ -533,9 +533,10 @@ static void he_init_tx_lbfp(struct he_dev *he_dev) · 532 unmodified lines | |||
| 533 | 533 | ||
| 534 | static int he_init_tpdrq(struct he_dev *he_dev) | 534 | static int he_init_tpdrq(struct he_dev *he_dev) |
| 535 | { | 535 | { |
| 536 | he_dev->tpdrq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev, | 536 | he_dev->tpdrq_base = dma_alloc_coherent(&he_dev->pci_dev->dev, |
| 537 | CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq), | 537 | CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq), |
| 538 | &he_dev->tpdrq_phys, GFP_KERNEL); | 538 | &he_dev->tpdrq_phys, |
| 539 | GFP_KERNEL); | ||
| 539 | if (he_dev->tpdrq_base == NULL) { | 540 | if (he_dev->tpdrq_base == NULL) { |
| 540 | hprintk("failed to alloc tpdrq\n"); | 541 | hprintk("failed to alloc tpdrq\n"); |
| 541 | return -ENOMEM; | 542 | return -ENOMEM; |
| @@ -717,7 +718,7 @@ static int he_init_cs_block_rcm(struct he_dev *he_dev) · 175 unmodified lines | |||
| 717 | instead of '/ 512', use '>> 9' to prevent a call | 718 | instead of '/ 512', use '>> 9' to prevent a call |
| 718 | to divdu3 on x86 platforms | 719 | to divdu3 on x86 platforms |
| 719 | */ | 720 | */ |
| 720 | rate_cps = (unsigned long long) (1 << exp) * (man + 512) >> 9; | 721 | rate_cps = (unsigned long long) (1UL << exp) * (man + 512) >> 9; |
| 721 | 722 | ||
| 722 | if (rate_cps < 10) | 723 | if (rate_cps < 10) |
| 723 | rate_cps = 10; /* 2.2.1 minimum payload rate is 10 cps */ | 724 | rate_cps = 10; /* 2.2.1 minimum payload rate is 10 cps */ |
| @@ -805,9 +806,9 @@ static int he_init_group(struct he_dev *he_dev, int group) · 81 unmodified lines | |||
| 805 | goto out_free_rbpl_virt; | 806 | goto out_free_rbpl_virt; |
| 806 | } | 807 | } |
| 807 | 808 | ||
| 808 | he_dev->rbpl_base = dma_zalloc_coherent(&he_dev->pci_dev->dev, | 809 | he_dev->rbpl_base = dma_alloc_coherent(&he_dev->pci_dev->dev, |
| 809 | CONFIG_RBPL_SIZE * sizeof(struct he_rbp), | 810 | CONFIG_RBPL_SIZE * sizeof(struct he_rbp), |
| 810 | &he_dev->rbpl_phys, GFP_KERNEL); | 811 | &he_dev->rbpl_phys, GFP_KERNEL); |
| 811 | if (he_dev->rbpl_base == NULL) { | 812 | if (he_dev->rbpl_base == NULL) { |
| 812 | hprintk("failed to alloc rbpl_base\n"); | 813 | hprintk("failed to alloc rbpl_base\n"); |
| 813 | goto out_destroy_rbpl_pool; | 814 | goto out_destroy_rbpl_pool; |
| @@ -844,9 +845,9 @@ static int he_init_group(struct he_dev *he_dev, int group) · 30 unmodified lines | |||
| 844 | 845 | ||
| 845 | /* rx buffer ready queue */ | 846 | /* rx buffer ready queue */ |
| 846 | 847 | ||
| 847 | he_dev->rbrq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev, | 848 | he_dev->rbrq_base = dma_alloc_coherent(&he_dev->pci_dev->dev, |
| 848 | CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq), | 849 | CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq), |
| 849 | &he_dev->rbrq_phys, GFP_KERNEL); | 850 | &he_dev->rbrq_phys, GFP_KERNEL); |
| 850 | if (he_dev->rbrq_base == NULL) { | 851 | if (he_dev->rbrq_base == NULL) { |
| 851 | hprintk("failed to allocate rbrq\n"); | 852 | hprintk("failed to allocate rbrq\n"); |
| 852 | goto out_free_rbpl; | 853 | goto out_free_rbpl; |
| @@ -868,9 +869,9 @@ static int he_init_group(struct he_dev *he_dev, int group) · 15 unmodified lines | |||
| 868 | 869 | ||
| 869 | /* tx buffer ready queue */ | 870 | /* tx buffer ready queue */ |
| 870 | 871 | ||
| 871 | he_dev->tbrq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev, | 872 | he_dev->tbrq_base = dma_alloc_coherent(&he_dev->pci_dev->dev, |
| 872 | CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), | 873 | CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), |
| 873 | &he_dev->tbrq_phys, GFP_KERNEL); | 874 | &he_dev->tbrq_phys, GFP_KERNEL); |
| 874 | if (he_dev->tbrq_base == NULL) { | 875 | if (he_dev->tbrq_base == NULL) { |
| 875 | hprintk("failed to allocate tbrq\n"); | 876 | hprintk("failed to allocate tbrq\n"); |
| 876 | goto out_free_rbpq_base; | 877 | goto out_free_rbpq_base; |
| @@ -913,11 +914,9 @@ static int he_init_irq(struct he_dev *he_dev) · 36 unmodified lines | |||
| 913 | /* 2.9.3.5 tail offset for each interrupt queue is located after the | 914 | /* 2.9.3.5 tail offset for each interrupt queue is located after the |
| 914 | end of the interrupt queue */ | 915 | end of the interrupt queue */ |
| 915 | 916 | ||
| 916 | he_dev->irq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev, | 917 | he_dev->irq_base = dma_alloc_coherent(&he_dev->pci_dev->dev, |
| 917 | (CONFIG_IRQ_SIZE + 1) | 918 | (CONFIG_IRQ_SIZE + 1) * sizeof(struct he_irq), |
| 918 | * sizeof(struct he_irq), | 919 | &he_dev->irq_phys, GFP_KERNEL); |
| 919 | &he_dev->irq_phys, | ||
| 920 | GFP_KERNEL); | ||
| 921 | if (he_dev->irq_base == NULL) { | 920 | if (he_dev->irq_base == NULL) { |
| 922 | hprintk("failed to allocate irq\n"); | 921 | hprintk("failed to allocate irq\n"); |
| 923 | return -ENOMEM; | 922 | return -ENOMEM; |
| @@ -1464,9 +1463,9 @@ static int he_start(struct atm_dev *dev) · 540 unmodified lines | |||
| 1464 | 1463 | ||
| 1465 | /* host status page */ | 1464 | /* host status page */ |
| 1466 | 1465 | ||
| 1467 | he_dev->hsp = dma_zalloc_coherent(&he_dev->pci_dev->dev, | 1466 | he_dev->hsp = dma_alloc_coherent(&he_dev->pci_dev->dev, |
| 1468 | sizeof(struct he_hsp), | 1467 | sizeof(struct he_hsp), |
| 1469 | &he_dev->hsp_phys, GFP_KERNEL); | 1468 | &he_dev->hsp_phys, GFP_KERNEL); |
| 1470 | if (he_dev->hsp == NULL) { | 1469 | if (he_dev->hsp == NULL) { |
| 1471 | hprintk("failed to allocate host status page\n"); | 1470 | hprintk("failed to allocate host status page\n"); |
| 1472 | return -ENOMEM; | 1471 | return -ENOMEM; |
| @@ -641,8 +641,8 @@ alloc_scq(struct idt77252_dev *card, int class) · 640 unmodified lines | |||
| 641 | scq = kzalloc(sizeof(struct scq_info), GFP_KERNEL); | 641 | scq = kzalloc(sizeof(struct scq_info), GFP_KERNEL); |
| 642 | if (!scq) | 642 | if (!scq) |
| 643 | return NULL; | 643 | return NULL; |
| 644 | scq->base = dma_zalloc_coherent(&card->pcidev->dev, SCQ_SIZE, | 644 | scq->base = dma_alloc_coherent(&card->pcidev->dev, SCQ_SIZE, |
| 645 | &scq->paddr, GFP_KERNEL); | 645 | &scq->paddr, GFP_KERNEL); |
| 646 | if (scq->base == NULL) { | 646 | if (scq->base == NULL) { |
| 647 | kfree(scq); | 647 | kfree(scq); |
| 648 | return NULL; | 648 | return NULL; |
| @@ -971,8 +971,8 @@ init_rsq(struct idt77252_dev *card) · 322 unmodified lines | |||
| 971 | { | 971 | { |
| 972 | struct rsq_entry *rsqe; | 972 | struct rsq_entry *rsqe; |
| 973 | 973 | ||
| 974 | card->rsq.base = dma_zalloc_coherent(&card->pcidev->dev, RSQSIZE, | 974 | card->rsq.base = dma_alloc_coherent(&card->pcidev->dev, RSQSIZE, |
| 975 | &card->rsq.paddr, GFP_KERNEL); | 975 | &card->rsq.paddr, GFP_KERNEL); |
| 976 | if (card->rsq.base == NULL) { | 976 | if (card->rsq.base == NULL) { |
| 977 | printk("%s: can't allocate RSQ.\n", card->name); | 977 | printk("%s: can't allocate RSQ.\n", card->name); |
| 978 | return -1; | 978 | return -1; |
| @@ -3390,10 +3390,10 @@ static int init_card(struct atm_dev *dev) · 2411 unmodified lines | |||
| 3390 | writel(0, SAR_REG_GP); | 3390 | writel(0, SAR_REG_GP); |
| 3391 | 3391 | ||
| 3392 | /* Initialize RAW Cell Handle Register */ | 3392 | /* Initialize RAW Cell Handle Register */ |
| 3393 | card->raw_cell_hnd = dma_zalloc_coherent(&card->pcidev->dev, | 3393 | card->raw_cell_hnd = dma_alloc_coherent(&card->pcidev->dev, |
| 3394 | 2 * sizeof(u32), | 3394 | 2 * sizeof(u32), |
| 3395 | &card->raw_cell_paddr, | 3395 | &card->raw_cell_paddr, |
| 3396 | GFP_KERNEL); | 3396 | GFP_KERNEL); |
| 3397 | if (!card->raw_cell_hnd) { | 3397 | if (!card->raw_cell_hnd) { |
| 3398 | printk("%s: memory allocation failure.\n", card->name); | 3398 | printk("%s: memory allocation failure.\n", card->name); |
| 3399 | deinit_card(card); | 3399 | deinit_card(card); |
| @@ -79,8 +79,7 @@ static void cache_size(struct cacheinfo *this_leaf, struct device_node *np) · 78 unmodified lines | |||
| 79 | ct_idx = get_cacheinfo_idx(this_leaf->type); | 79 | ct_idx = get_cacheinfo_idx(this_leaf->type); |
| 80 | propname = cache_type_info[ct_idx].size_prop; | 80 | propname = cache_type_info[ct_idx].size_prop; |
| 81 | 81 | ||
| 82 | if (of_property_read_u32(np, propname, &this_leaf->size)) | 82 | of_property_read_u32(np, propname, &this_leaf->size); |
| 83 | this_leaf->size = 0; | ||
| 84 | } | 83 | } |
| 85 | 84 | ||
| 86 | /* not cache_line_size() because that's a macro in include/linux/cache.h */ | 85 | /* not cache_line_size() because that's a macro in include/linux/cache.h */ |
| @@ -114,8 +113,7 @@ static void cache_nr_sets(struct cacheinfo *this_leaf, struct device_node *np) · 27 unmodified lines | |||
| 114 | ct_idx = get_cacheinfo_idx(this_leaf->type); | 113 | ct_idx = get_cacheinfo_idx(this_leaf->type); |
| 115 | propname = cache_type_info[ct_idx].nr_sets_prop; | 114 | propname = cache_type_info[ct_idx].nr_sets_prop; |
| 116 | 115 | ||
| 117 | if (of_property_read_u32(np, propname, &this_leaf->number_of_sets)) | 116 | of_property_read_u32(np, propname, &this_leaf->number_of_sets); |
| 118 | this_leaf->number_of_sets = 0; | ||
| 119 | } | 117 | } |
| 120 | 118 | ||
| 121 | static void cache_associativity(struct cacheinfo *this_leaf) | 119 | static void cache_associativity(struct cacheinfo *this_leaf) |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | |||
| 32 | #include <trace/events/power.h> | 32 | #include <trace/events/power.h> |
| 33 | #include <linux/cpufreq.h> | 33 | #include <linux/cpufreq.h> |
| 34 | #include <linux/cpuidle.h> | 34 | #include <linux/cpuidle.h> |
| 35 | #include <linux/devfreq.h> | ||
| 35 | #include <linux/timer.h> | 36 | #include <linux/timer.h> |
| 36 | 37 | ||
| 37 | #include "../base.h" | 38 | #include "../base.h" |
| @@ -1078,6 +1079,7 @@ void dpm_resume(pm_message_t state) · 1040 unmodified lines | |||
| 1078 | dpm_show_time(starttime, state, 0, NULL); | 1079 | dpm_show_time(starttime, state, 0, NULL); |
| 1079 | 1080 | ||
| 1080 | cpufreq_resume(); | 1081 | cpufreq_resume(); |
| 1082 | devfreq_resume(); | ||
| 1081 | trace_suspend_resume(TPS("dpm_resume"), state.event, false); | 1083 | trace_suspend_resume(TPS("dpm_resume"), state.event, false); |
| 1082 | } | 1084 | } |
| 1083 | 1085 | ||
| @@ -1852,6 +1854,7 @@ int dpm_suspend(pm_message_t state) · 768 unmodified lines | |||
| 1852 | trace_suspend_resume(TPS("dpm_suspend"), state.event, true); | 1854 | trace_suspend_resume(TPS("dpm_suspend"), state.event, true); |
| 1853 | might_sleep(); | 1855 | might_sleep(); |
| 1854 | 1856 | ||
| 1857 | devfreq_suspend(); | ||
| 1855 | cpufreq_suspend(); | 1858 | cpufreq_suspend(); |
| 1856 | 1859 | ||
| 1857 | mutex_lock(&dpm_list_mtx); | 1860 | mutex_lock(&dpm_list_mtx); |
| @@ -121,7 +121,7 @@ static void pm_runtime_cancel_pending(struct device *dev) · 120 unmodified lines | |||
| 121 | * Compute the autosuspend-delay expiration time based on the device's | 121 | * Compute the autosuspend-delay expiration time based on the device's |
| 122 | * power.last_busy time. If the delay has already expired or is disabled | 122 | * power.last_busy time. If the delay has already expired or is disabled |
| 123 | * (negative) or the power.use_autosuspend flag isn't set, return 0. | 123 | * (negative) or the power.use_autosuspend flag isn't set, return 0. |
| 124 | * Otherwise return the expiration time in jiffies (adjusted to be nonzero). | 124 | * Otherwise return the expiration time in nanoseconds (adjusted to be nonzero). |
| 125 | * | 125 | * |
| 126 | * This function may be called either with or without dev->power.lock held. | 126 | * This function may be called either with or without dev->power.lock held. |
| 127 | * Either way it can be racy, since power.last_busy may be updated at any time. | 127 | * Either way it can be racy, since power.last_busy may be updated at any time. |
| @@ -130,7 +130,7 @@ u64 pm_runtime_autosuspend_expiration(struct device *dev) · 2 unmodified lines | |||
| 130 | { | 130 | { |
| 131 | int autosuspend_delay; | 131 | int autosuspend_delay; |
| 132 | u64 last_busy, expires = 0; | 132 | u64 last_busy, expires = 0; |
| 133 | u64 now = ktime_to_ns(ktime_get()); | 133 | u64 now = ktime_get_mono_fast_ns(); |
| 134 | 134 | ||
| 135 | if (!dev->power.use_autosuspend) | 135 | if (!dev->power.use_autosuspend) |
| 136 | goto out; | 136 | goto out; |
| @@ -141,7 +141,7 @@ u64 pm_runtime_autosuspend_expiration(struct device *dev) · 4 unmodified lines | |||
| 141 | 141 | ||
| 142 | last_busy = READ_ONCE(dev->power.last_busy); | 142 | last_busy = READ_ONCE(dev->power.last_busy); |
| 143 | 143 | ||
| 144 | expires = last_busy + autosuspend_delay * NSEC_PER_MSEC; | 144 | expires = last_busy + (u64)autosuspend_delay * NSEC_PER_MSEC; |
| 145 | if (expires <= now) | 145 | if (expires <= now) |
| 146 | expires = 0; /* Already expired. */ | 146 | expires = 0; /* Already expired. */ |
| 147 | 147 | ||
| @@ -525,7 +525,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) · 377 unmodified lines | |||
| 525 | * We add a slack of 25% to gather wakeups | 525 | * We add a slack of 25% to gather wakeups |
| 526 | * without sacrificing the granularity. | 526 | * without sacrificing the granularity. |
| 527 | */ | 527 | */ |
| 528 | u64 slack = READ_ONCE(dev->power.autosuspend_delay) * | 528 | u64 slack = (u64)READ_ONCE(dev->power.autosuspend_delay) * |
| 529 | (NSEC_PER_MSEC >> 2); | 529 | (NSEC_PER_MSEC >> 2); |
| 530 | 530 | ||
| 531 | dev->power.timer_expires = expires; | 531 | dev->power.timer_expires = expires; |
| @@ -905,8 +905,11 @@ static enum hrtimer_restart pm_suspend_timer_fn(struct hrtimer *timer) · 373 unmodified lines | |||
| 905 | spin_lock_irqsave(&dev->power.lock, flags); | 905 | spin_lock_irqsave(&dev->power.lock, flags); |
| 906 | 906 | ||
| 907 | expires = dev->power.timer_expires; | 907 | expires = dev->power.timer_expires; |
| 908 | /* If 'expire' is after 'jiffies' we've been called too early. */ | 908 | /* |
| 909 | if (expires > 0 && expires < ktime_to_ns(ktime_get())) { | 909 | * If 'expires' is after the current time, we've been called |
| 910 | * too early. | ||
| 911 | */ | ||
| 912 | if (expires > 0 && expires < ktime_get_mono_fast_ns()) { | ||
| 910 | dev->power.timer_expires = 0; | 913 | dev->power.timer_expires = 0; |
| 911 | rpm_suspend(dev, dev->power.timer_autosuspends ? | 914 | rpm_suspend(dev, dev->power.timer_autosuspends ? |
| 912 | (RPM_ASYNC | RPM_AUTO) : RPM_ASYNC); | 915 | (RPM_ASYNC | RPM_AUTO) : RPM_ASYNC); |
| @@ -925,7 +928,7 @@ static enum hrtimer_restart pm_suspend_timer_fn(struct hrtimer *timer) · 12 unmodified lines | |||
| 925 | int pm_schedule_suspend(struct device *dev, unsigned int delay) | 928 | int pm_schedule_suspend(struct device *dev, unsigned int delay) |
| 926 | { | 929 | { |
| 927 | unsigned long flags; | 930 | unsigned long flags; |
| 928 | ktime_t expires; | 931 | u64 expires; |
| 929 | int retval; | 932 | int retval; |
| 930 | 933 | ||
| 931 | spin_lock_irqsave(&dev->power.lock, flags); | 934 | spin_lock_irqsave(&dev->power.lock, flags); |
| @@ -942,8 +945,8 @@ int pm_schedule_suspend(struct device *dev, unsigned int delay) · 10 unmodified lines | |||
| 942 | /* Other scheduled or pending requests need to be canceled. */ | 945 | /* Other scheduled or pending requests need to be canceled. */ |
| 943 | pm_runtime_cancel_pending(dev); | 946 | pm_runtime_cancel_pending(dev); |
| 944 | 947 | ||
| 945 | expires = ktime_add(ktime_get(), ms_to_ktime(delay)); | 948 | expires = ktime_get_mono_fast_ns() + (u64)delay * NSEC_PER_MSEC; |
| 946 | dev->power.timer_expires = ktime_to_ns(expires); | 949 | dev->power.timer_expires = expires; |
| 947 | dev->power.timer_autosuspends = 0; | 950 | dev->power.timer_autosuspends = 0; |
| 948 | hrtimer_start(&dev->power.suspend_timer, expires, HRTIMER_MODE_ABS); | 951 | hrtimer_start(&dev->power.suspend_timer, expires, HRTIMER_MODE_ABS); |
| 949 | 952 | ||
| @@ -108,6 +108,9 @@ static void regmap_irq_sync_unlock(struct irq_data *data) · 107 unmodified lines | |||
| 108 | * suppress pointless writes. | 108 | * suppress pointless writes. |
| 109 | */ | 109 | */ |
| 110 | for (i = 0; i < d->chip->num_regs; i++) { | 110 | for (i = 0; i < d->chip->num_regs; i++) { |
| 111 | if (!d->chip->mask_base) | ||
| 112 | continue; | ||
| 113 | |||
| 111 | reg = d->chip->mask_base + | 114 | reg = d->chip->mask_base + |
| 112 | (i * map->reg_stride * d->irq_reg_stride); | 115 | (i * map->reg_stride * d->irq_reg_stride); |
| 113 | if (d->chip->mask_invert) { | 116 | if (d->chip->mask_invert) { |
| @@ -258,7 +261,7 @@ static int regmap_irq_set_type(struct irq_data *data, unsigned int type) · 144 unmodified lines | |||
| 258 | const struct regmap_irq_type *t = &irq_data->type; | 261 | const struct regmap_irq_type *t = &irq_data->type; |
| 259 | 262 | ||
| 260 | if ((t->types_supported & type) != type) | 263 | if ((t->types_supported & type) != type) |
| 261 | return -ENOTSUPP; | 264 | return 0; |
| 262 | 265 | ||
| 263 | reg = t->type_reg_offset / map->reg_stride; | 266 | reg = t->type_reg_offset / map->reg_stride; |
| 264 | 267 | ||
| @@ -588,6 +591,9 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags, · 323 unmodified lines | |||
| 588 | /* Mask all the interrupts by default */ | 591 | /* Mask all the interrupts by default */ |
| 589 | for (i = 0; i < chip->num_regs; i++) { | 592 | for (i = 0; i < chip->num_regs; i++) { |
| 590 | d->mask_buf[i] = d->mask_buf_def[i]; | 593 | d->mask_buf[i] = d->mask_buf_def[i]; |
| 594 | if (!chip->mask_base) | ||
| 595 | continue; | ||
| 596 | |||
| 591 | reg = chip->mask_base + | 597 | reg = chip->mask_base + |
| 592 | (i * map->reg_stride * d->irq_reg_stride); | 598 | (i * map->reg_stride * d->irq_reg_stride); |
| 593 | if (chip->mask_invert) | 599 | if (chip->mask_invert) |
| @@ -1190,6 +1190,12 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) · 1189 unmodified lines | |||
| 1190 | goto out_unlock; | 1190 | goto out_unlock; |
| 1191 | } | 1191 | } |
| 1192 | 1192 | ||
| 1193 | if (lo->lo_offset != info->lo_offset || | ||
| 1194 | lo->lo_sizelimit != info->lo_sizelimit) { | ||
| 1195 | sync_blockdev(lo->lo_device); | ||
| 1196 | kill_bdev(lo->lo_device); | ||
| 1197 | } | ||
| 1198 | |||
| 1193 | /* I/O need to be drained during transfer transition */ | 1199 | /* I/O need to be drained during transfer transition */ |
| 1194 | blk_mq_freeze_queue(lo->lo_queue); | 1200 | blk_mq_freeze_queue(lo->lo_queue); |
| 1195 | 1201 | ||
| @@ -1218,6 +1224,14 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) · 22 unmodified lines | |||
| 1218 | 1224 | ||
| 1219 | if (lo->lo_offset != info->lo_offset || | 1225 | if (lo->lo_offset != info->lo_offset || |
| 1220 | lo->lo_sizelimit != info->lo_sizelimit) { | 1226 | lo->lo_sizelimit != info->lo_sizelimit) { |
| 1227 | /* kill_bdev should have truncated all the pages */ | ||
| 1228 | if (lo->lo_device->bd_inode->i_mapping->nrpages) { | ||
| 1229 | err = -EAGAIN; | ||
| 1230 | pr_warn("%s: loop%d (%s) has still dirty pages (nrpages=%lu)\n", | ||
| 1231 | __func__, lo->lo_number, lo->lo_file_name, | ||
| 1232 | lo->lo_device->bd_inode->i_mapping->nrpages); | ||
| 1233 | goto out_unfreeze; | ||
| 1234 | } | ||
| 1221 | if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit)) { | 1235 | if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit)) { |
| 1222 | err = -EFBIG; | 1236 | err = -EFBIG; |
| 1223 | goto out_unfreeze; | 1237 | goto out_unfreeze; |
| @@ -1443,22 +1457,39 @@ static int loop_set_dio(struct loop_device *lo, unsigned long arg) · 219 unmodified lines | |||
| 1443 | 1457 | ||
| 1444 | static int loop_set_block_size(struct loop_device *lo, unsigned long arg) | 1458 | static int loop_set_block_size(struct loop_device *lo, unsigned long arg) |
| 1445 | { | 1459 | { |
| 1460 | int err = 0; | ||
| 1461 | |||
| 1446 | if (lo->lo_state != Lo_bound) | 1462 | if (lo->lo_state != Lo_bound) |
| 1447 | return -ENXIO; | 1463 | return -ENXIO; |
| 1448 | 1464 | ||
| 1449 | if (arg < 512 || arg > PAGE_SIZE || !is_power_of_2(arg)) | 1465 | if (arg < 512 || arg > PAGE_SIZE || !is_power_of_2(arg)) |
| 1450 | return -EINVAL; | 1466 | return -EINVAL; |
| 1451 | 1467 | ||
| 1468 | if (lo->lo_queue->limits.logical_block_size != arg) { | ||
| 1469 | sync_blockdev(lo->lo_device); | ||
| 1470 | kill_bdev(lo->lo_device); | ||
| 1471 | } | ||
| 1472 | |||
| 1452 | blk_mq_freeze_queue(lo->lo_queue); | 1473 | blk_mq_freeze_queue(lo->lo_queue); |
| 1453 | 1474 | ||
| 1475 | /* kill_bdev should have truncated all the pages */ | ||
| 1476 | if (lo->lo_queue->limits.logical_block_size != arg && | ||
| 1477 | lo->lo_device->bd_inode->i_mapping->nrpages) { | ||
| 1478 | err = -EAGAIN; | ||
| 1479 | pr_warn("%s: loop%d (%s) has still dirty pages (nrpages=%lu)\n", | ||
| 1480 | __func__, lo->lo_number, lo->lo_file_name, | ||
| 1481 | lo->lo_device->bd_inode->i_mapping->nrpages); | ||
| 1482 | goto out_unfreeze; | ||
| 1483 | } | ||
| 1484 | |||
| 1454 | blk_queue_logical_block_size(lo->lo_queue, arg); | 1485 | blk_queue_logical_block_size(lo->lo_queue, arg); |
| 1455 | blk_queue_physical_block_size(lo->lo_queue, arg); | 1486 | blk_queue_physical_block_size(lo->lo_queue, arg); |
| 1456 | blk_queue_io_min(lo->lo_queue, arg); | 1487 | blk_queue_io_min(lo->lo_queue, arg); |
| 1457 | loop_update_dio(lo); | 1488 | loop_update_dio(lo); |
| 1458 | 1489 | out_unfreeze: | |
| 1459 | blk_mq_unfreeze_queue(lo->lo_queue); | 1490 | blk_mq_unfreeze_queue(lo->lo_queue); |
| 1460 | 1491 | ||
| 1461 | return 0; | 1492 | return err; |
| 1462 | } | 1493 | } |
| 1463 | 1494 | ||
| 1464 | static int lo_simple_ioctl(struct loop_device *lo, unsigned int cmd, | 1495 | static int lo_simple_ioctl(struct loop_device *lo, unsigned int cmd, |
| @@ -288,9 +288,10 @@ static void nbd_size_update(struct nbd_device *nbd) · 287 unmodified lines | |||
| 288 | blk_queue_physical_block_size(nbd->disk->queue, config->blksize); | 288 | blk_queue_physical_block_size(nbd->disk->queue, config->blksize); |
| 289 | set_capacity(nbd->disk, config->bytesize >> 9); | 289 | set_capacity(nbd->disk, config->bytesize >> 9); |
| 290 | if (bdev) { | 290 | if (bdev) { |
| 291 | if (bdev->bd_disk) | 291 | if (bdev->bd_disk) { |
| 292 | bd_set_size(bdev, config->bytesize); | 292 | bd_set_size(bdev, config->bytesize); |
| 293 | else | 293 | set_blocksize(bdev, config->blksize); |
| 294 | } else | ||
| 294 | bdev->bd_invalidated = 1; | 295 | bdev->bd_invalidated = 1; |
| 295 | bdput(bdev); | 296 | bdput(bdev); |
| 296 | } | 297 | } |
| @@ -97,6 +97,7 @@ void null_zone_reset(struct nullb_cmd *cmd, sector_t sector); · 96 unmodified lines | |||
| 97 | #else | 97 | #else |
| 98 | static inline int null_zone_init(struct nullb_device *dev) | 98 | static inline int null_zone_init(struct nullb_device *dev) |
| 99 | { | 99 | { |
| 100 | pr_err("null_blk: CONFIG_BLK_DEV_ZONED not enabled\n"); | ||
| 100 | return -EINVAL; | 101 | return -EINVAL; |
| 101 | } | 102 | } |
| 102 | static inline void null_zone_exit(struct nullb_device *dev) {} | 103 | static inline void null_zone_exit(struct nullb_device *dev) {} |
| @@ -5986,7 +5986,6 @@ static ssize_t do_rbd_remove(struct bus_type *bus, · 5985 unmodified lines | |||
| 5986 | struct list_head *tmp; | 5986 | struct list_head *tmp; |
| 5987 | int dev_id; | 5987 | int dev_id; |
| 5988 | char opt_buf[6]; | 5988 | char opt_buf[6]; |
| 5989 | bool already = false; | ||
| 5990 | bool force = false; | 5989 | bool force = false; |
| 5991 | int ret; | 5990 | int ret; |
| 5992 | 5991 | ||
| @@ -6019,13 +6018,13 @@ static ssize_t do_rbd_remove(struct bus_type *bus, · 26 unmodified lines | |||
| 6019 | spin_lock_irq(&rbd_dev->lock); | 6018 | spin_lock_irq(&rbd_dev->lock); |
| 6020 | if (rbd_dev->open_count && !force) | 6019 | if (rbd_dev->open_count && !force) |
| 6021 | ret = -EBUSY; | 6020 | ret = -EBUSY; |
| 6022 | else | 6021 | else if (test_and_set_bit(RBD_DEV_FLAG_REMOVING, |
| 6023 | already = test_and_set_bit(RBD_DEV_FLAG_REMOVING, | 6022 | &rbd_dev->flags)) |
| 6024 | &rbd_dev->flags); | 6023 | ret = -EINPROGRESS; |
| 6025 | spin_unlock_irq(&rbd_dev->lock); | 6024 | spin_unlock_irq(&rbd_dev->lock); |
| 6026 | } | 6025 | } |
| 6027 | spin_unlock(&rbd_dev_list_lock); | 6026 | spin_unlock(&rbd_dev_list_lock); |
| 6028 | if (ret < 0 || already) | 6027 | if (ret) |
| 6029 | return ret; | 6028 | return ret; |
| 6030 | 6029 | ||
| 6031 | if (force) { | 6030 | if (force) { |
| @@ -2641,8 +2641,8 @@ static int skd_cons_skcomp(struct skd_device *skdev) · 2640 unmodified lines | |||
| 2641 | "comp pci_alloc, total bytes %zd entries %d\n", | 2641 | "comp pci_alloc, total bytes %zd entries %d\n", |
| 2642 | SKD_SKCOMP_SIZE, SKD_N_COMPLETION_ENTRY); | 2642 | SKD_SKCOMP_SIZE, SKD_N_COMPLETION_ENTRY); |
| 2643 | 2643 | ||
| 2644 | skcomp = dma_zalloc_coherent(&skdev->pdev->dev, SKD_SKCOMP_SIZE, | 2644 | skcomp = dma_alloc_coherent(&skdev->pdev->dev, SKD_SKCOMP_SIZE, |
| 2645 | &skdev->cq_dma_address, GFP_KERNEL); | 2645 | &skdev->cq_dma_address, GFP_KERNEL); |
| 2646 | 2646 | ||
| 2647 | if (skcomp == NULL) { | 2647 | if (skcomp == NULL) { |
| 2648 | rc = -ENOMEM; | 2648 | rc = -ENOMEM; |
| @@ -316,11 +316,9 @@ static ssize_t idle_store(struct device *dev, · 315 unmodified lines | |||
| 316 | * See the comment in writeback_store. | 316 | * See the comment in writeback_store. |
| 317 | */ | 317 | */ |
| 318 | zram_slot_lock(zram, index); | 318 | zram_slot_lock(zram, index); |
| 319 | if (!zram_allocated(zram, index) || | 319 | if (zram_allocated(zram, index) && |
| 320 | zram_test_flag(zram, index, ZRAM_UNDER_WB)) | 320 | !zram_test_flag(zram, index, ZRAM_UNDER_WB)) |
| 321 | goto next; | 321 | zram_set_flag(zram, index, ZRAM_IDLE); |
| 322 | zram_set_flag(zram, index, ZRAM_IDLE); | ||
| 323 | next: | ||
| 324 | zram_slot_unlock(zram, index); | 322 | zram_slot_unlock(zram, index); |
| 325 | } | 323 | } |
| 326 | 324 | ||
| @@ -330,6 +328,41 @@ next: · 3 unmodified lines | |||
| 330 | } | 328 | } |
| 331 | 329 | ||
| 332 | #ifdef CONFIG_ZRAM_WRITEBACK | 330 | #ifdef CONFIG_ZRAM_WRITEBACK |
| 331 | static ssize_t writeback_limit_enable_store(struct device *dev, | ||
| 332 | struct device_attribute *attr, const char *buf, size_t len) | ||
| 333 | { | ||
| 334 | struct zram *zram = dev_to_zram(dev); | ||
| 335 | u64 val; | ||
| 336 | ssize_t ret = -EINVAL; | ||
| 337 | |||
| 338 | if (kstrtoull(buf, 10, &val)) | ||
| 339 | return ret; | ||
| 340 | |||
| 341 | down_read(&zram->init_lock); | ||
| 342 | spin_lock(&zram->wb_limit_lock); | ||
| 343 | zram->wb_limit_enable = val; | ||
| 344 | spin_unlock(&zram->wb_limit_lock); | ||
| 345 | up_read(&zram->init_lock); | ||
| 346 | ret = len; | ||
| 347 | |||
| 348 | return ret; | ||
| 349 | } | ||
| 350 | |||
| 351 | static ssize_t writeback_limit_enable_show(struct device *dev, | ||
| 352 | struct device_attribute *attr, char *buf) | ||
| 353 | { | ||
| 354 | bool val; | ||
| 355 | struct zram *zram = dev_to_zram(dev); | ||
| 356 | |||
| 357 | down_read(&zram->init_lock); | ||
| 358 | spin_lock(&zram->wb_limit_lock); | ||
| 359 | val = zram->wb_limit_enable; | ||
| 360 | spin_unlock(&zram->wb_limit_lock); | ||
| 361 | up_read(&zram->init_lock); | ||
| 362 | |||
| 363 | return scnprintf(buf, PAGE_SIZE, "%d\n", val); | ||
| 364 | } | ||
| 365 | |||
| 333 | static ssize_t writeback_limit_store(struct device *dev, | 366 | static ssize_t writeback_limit_store(struct device *dev, |
| 334 | struct device_attribute *attr, const char *buf, size_t len) | 367 | struct device_attribute *attr, const char *buf, size_t len) |
| 335 | { | 368 | { |
| @@ -341,9 +374,9 @@ static ssize_t writeback_limit_store(struct device *dev, · 5 unmodified lines | |||
| 341 | return ret; | 374 | return ret; |
| 342 | 375 | ||
| 343 | down_read(&zram->init_lock); | 376 | down_read(&zram->init_lock); |
| 344 | atomic64_set(&zram->stats.bd_wb_limit, val); | 377 | spin_lock(&zram->wb_limit_lock); |
| 345 | if (val == 0) | 378 | zram->bd_wb_limit = val; |
| 346 | zram->stop_writeback = false; | 379 | spin_unlock(&zram->wb_limit_lock); |
| 347 | up_read(&zram->init_lock); | 380 | up_read(&zram->init_lock); |
| 348 | ret = len; | 381 | ret = len; |
| 349 | 382 | ||
| @@ -357,7 +390,9 @@ static ssize_t writeback_limit_show(struct device *dev, · 7 unmodified lines | |||
| 357 | struct zram *zram = dev_to_zram(dev); | 390 | struct zram *zram = dev_to_zram(dev); |
| 358 | 391 | ||
| 359 | down_read(&zram->init_lock); | 392 | down_read(&zram->init_lock); |
| 360 | val = atomic64_read(&zram->stats.bd_wb_limit); | 393 | spin_lock(&zram->wb_limit_lock); |
| 394 | val = zram->bd_wb_limit; | ||
| 395 | spin_unlock(&zram->wb_limit_lock); | ||
| 361 | up_read(&zram->init_lock); | 396 | up_read(&zram->init_lock); |
| 362 | 397 | ||
| 363 | return scnprintf(buf, PAGE_SIZE, "%llu\n", val); | 398 | return scnprintf(buf, PAGE_SIZE, "%llu\n", val); |
| @@ -588,8 +623,8 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec, · 224 unmodified lines | |||
| 588 | return 1; | 623 | return 1; |
| 589 | } | 624 | } |
| 590 | 625 | ||
| 591 | #define HUGE_WRITEBACK 0x1 | 626 | #define HUGE_WRITEBACK 1 |
| 592 | #define IDLE_WRITEBACK 0x2 | 627 | #define IDLE_WRITEBACK 2 |
| 593 | 628 | ||
| 594 | static ssize_t writeback_store(struct device *dev, | 629 | static ssize_t writeback_store(struct device *dev, |
| 595 | struct device_attribute *attr, const char *buf, size_t len) | 630 | struct device_attribute *attr, const char *buf, size_t len) |
| @@ -602,7 +637,7 @@ static ssize_t writeback_store(struct device *dev, · 6 unmodified lines | |||
| 602 | struct page *page; | 637 | struct page *page; |
| 603 | ssize_t ret, sz; | 638 | ssize_t ret, sz; |
| 604 | char mode_buf[8]; | 639 | char mode_buf[8]; |
| 605 | unsigned long mode = -1UL; | 640 | int mode = -1; |
| 606 | unsigned long blk_idx = 0; | 641 | unsigned long blk_idx = 0; |
| 607 | 642 | ||
| 608 | sz = strscpy(mode_buf, buf, sizeof(mode_buf)); | 643 | sz = strscpy(mode_buf, buf, sizeof(mode_buf)); |
| @@ -618,7 +653,7 @@ static ssize_t writeback_store(struct device *dev, · 9 unmodified lines | |||
| 618 | else if (!strcmp(mode_buf, "huge")) | 653 | else if (!strcmp(mode_buf, "huge")) |
| 619 | mode = HUGE_WRITEBACK; | 654 | mode = HUGE_WRITEBACK; |
| 620 | 655 | ||
| 621 | if (mode == -1UL) | 656 | if (mode == -1) |
| 622 | return -EINVAL; | 657 | return -EINVAL; |
| 623 | 658 | ||
| 624 | down_read(&zram->init_lock); | 659 | down_read(&zram->init_lock); |
| @@ -645,10 +680,13 @@ static ssize_t writeback_store(struct device *dev, · 20 unmodified lines | |||
| 645 | bvec.bv_len = PAGE_SIZE; | 680 | bvec.bv_len = PAGE_SIZE; |
| 646 | bvec.bv_offset = 0; | 681 | bvec.bv_offset = 0; |
| 647 | 682 | ||
| 648 | if (zram->stop_writeback) { | 683 | spin_lock(&zram->wb_limit_lock); |
| 684 | if (zram->wb_limit_enable && !zram->bd_wb_limit) { | ||
| 685 | spin_unlock(&zram->wb_limit_lock); | ||
| 649 | ret = -EIO; | 686 | ret = -EIO; |
| 650 | break; | 687 | break; |
| 651 | } | 688 | } |
| 689 | spin_unlock(&zram->wb_limit_lock); | ||
| 652 | 690 | ||
| 653 | if (!blk_idx) { | 691 | if (!blk_idx) { |
| 654 | blk_idx = alloc_block_bdev(zram); | 692 | blk_idx = alloc_block_bdev(zram); |
| @@ -667,10 +705,11 @@ static ssize_t writeback_store(struct device *dev, · 12 unmodified lines | |||
| 667 | zram_test_flag(zram, index, ZRAM_UNDER_WB)) | 705 | zram_test_flag(zram, index, ZRAM_UNDER_WB)) |
| 668 | goto next; | 706 | goto next; |
| 669 | 707 | ||
| 670 | if ((mode & IDLE_WRITEBACK && | 708 | if (mode == IDLE_WRITEBACK && |
| 671 | !zram_test_flag(zram, index, ZRAM_IDLE)) && | 709 | !zram_test_flag(zram, index, ZRAM_IDLE)) |
| 672 | (mode & HUGE_WRITEBACK && | 710 | goto next; |
| 673 | !zram_test_flag(zram, index, ZRAM_HUGE))) | 711 | if (mode == HUGE_WRITEBACK && |
| 712 | !zram_test_flag(zram, index, ZRAM_HUGE)) | ||
| 674 | goto next; | 713 | goto next; |
| 675 | /* | 714 | /* |
| 676 | * Clearing ZRAM_UNDER_WB is duty of caller. | 715 | * Clearing ZRAM_UNDER_WB is duty of caller. |
| @@ -732,11 +771,10 @@ static ssize_t writeback_store(struct device *dev, · 55 unmodified lines | |||
| 732 | zram_set_element(zram, index, blk_idx); | 771 | zram_set_element(zram, index, blk_idx); |
| 733 | blk_idx = 0; | 772 | blk_idx = 0; |
| 734 | atomic64_inc(&zram->stats.pages_stored); | 773 | atomic64_inc(&zram->stats.pages_stored); |
| 735 | if (atomic64_add_unless(&zram->stats.bd_wb_limit, | 774 | spin_lock(&zram->wb_limit_lock); |
| 736 | -1 << (PAGE_SHIFT - 12), 0)) { | 775 | if (zram->wb_limit_enable && zram->bd_wb_limit > 0) |
| 737 | if (atomic64_read(&zram->stats.bd_wb_limit) == 0) | 776 | zram->bd_wb_limit -= 1UL << (PAGE_SHIFT - 12); |
| 738 | zram->stop_writeback = true; | 777 | spin_unlock(&zram->wb_limit_lock); |
| 739 | } | ||
| 740 | next: | 778 | next: |
| 741 | zram_slot_unlock(zram, index); | 779 | zram_slot_unlock(zram, index); |
| 742 | } | 780 | } |
| @@ -1812,6 +1850,7 @@ static DEVICE_ATTR_RW(comp_algorithm); · 1069 unmodified lines | |||
| 1812 | static DEVICE_ATTR_RW(backing_dev); | 1850 | static DEVICE_ATTR_RW(backing_dev); |
| 1813 | static DEVICE_ATTR_WO(writeback); | 1851 | static DEVICE_ATTR_WO(writeback); |
| 1814 | static DEVICE_ATTR_RW(writeback_limit); | 1852 | static DEVICE_ATTR_RW(writeback_limit); |
| 1853 | static DEVICE_ATTR_RW(writeback_limit_enable); | ||
| 1815 | #endif | 1854 | #endif |
| 1816 | 1855 | ||
| 1817 | static struct attribute *zram_disk_attrs[] = { | 1856 | static struct attribute *zram_disk_attrs[] = { |
| @@ -1828,6 +1867,7 @@ static struct attribute *zram_disk_attrs[] = { · 10 unmodified lines | |||
| 1828 | &dev_attr_backing_dev.attr, | 1867 | &dev_attr_backing_dev.attr, |
| 1829 | &dev_attr_writeback.attr, | 1868 | &dev_attr_writeback.attr, |
| 1830 | &dev_attr_writeback_limit.attr, | 1869 | &dev_attr_writeback_limit.attr, |
| 1870 | &dev_attr_writeback_limit_enable.attr, | ||
| 1831 | #endif | 1871 | #endif |
| 1832 | &dev_attr_io_stat.attr, | 1872 | &dev_attr_io_stat.attr, |
| 1833 | &dev_attr_mm_stat.attr, | 1873 | &dev_attr_mm_stat.attr, |
| @@ -1867,7 +1907,9 @@ static int zram_add(void) · 33 unmodified lines | |||
| 1867 | device_id = ret; | 1907 | device_id = ret; |
| 1868 | 1908 | ||
| 1869 | init_rwsem(&zram->init_lock); | 1909 | init_rwsem(&zram->init_lock); |
| 1870 | 1910 | #ifdef CONFIG_ZRAM_WRITEBACK | |
| 1911 | spin_lock_init(&zram->wb_limit_lock); | ||
| 1912 | #endif | ||
| 1871 | queue = blk_alloc_queue(GFP_KERNEL); | 1913 | queue = blk_alloc_queue(GFP_KERNEL); |
| 1872 | if (!queue) { | 1914 | if (!queue) { |
| 1873 | pr_err("Error allocating disk queue for device %d\n", | 1915 | pr_err("Error allocating disk queue for device %d\n", |
| @@ -86,7 +86,6 @@ struct zram_stats { · 85 unmodified lines | |||
| 86 | atomic64_t bd_count; /* no. of pages in backing device */ | 86 | atomic64_t bd_count; /* no. of pages in backing device */ |
| 87 | atomic64_t bd_reads; /* no. of reads from backing device */ | 87 | atomic64_t bd_reads; /* no. of reads from backing device */ |
| 88 | atomic64_t bd_writes; /* no. of writes from backing device */ | 88 | atomic64_t bd_writes; /* no. of writes from backing device */ |
| 89 | atomic64_t bd_wb_limit; /* writeback limit of backing device */ | ||
| 90 | #endif | 89 | #endif |
| 91 | }; | 90 | }; |
| 92 | 91 | ||
| @@ -114,8 +113,10 @@ struct zram { · 21 unmodified lines | |||
| 114 | */ | 113 | */ |
| 115 | bool claim; /* Protected by bdev->bd_mutex */ | 114 | bool claim; /* Protected by bdev->bd_mutex */ |
| 116 | struct file *backing_dev; | 115 | struct file *backing_dev; |
| 117 | bool stop_writeback; | ||
| 118 | #ifdef CONFIG_ZRAM_WRITEBACK | 116 | #ifdef CONFIG_ZRAM_WRITEBACK |
| 117 | spinlock_t wb_limit_lock; | ||
| 118 | bool wb_limit_enable; | ||
| 119 | u64 bd_wb_limit; | ||
| 119 | struct block_device *bdev; | 120 | struct block_device *bdev; |
| 120 | unsigned int old_block_size; | 121 | unsigned int old_block_size; |
| 121 | unsigned long *bitmap; | 122 | unsigned long *bitmap; |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | |||
| 32 | #include <linux/moduleparam.h> | 32 | #include <linux/moduleparam.h> |
| 33 | #include <linux/workqueue.h> | 33 | #include <linux/workqueue.h> |
| 34 | #include <linux/uuid.h> | 34 | #include <linux/uuid.h> |
| 35 | #include <linux/nospec.h> | ||
| 35 | 36 | ||
| 36 | #define IPMI_DRIVER_VERSION "39.2" | 37 | #define IPMI_DRIVER_VERSION "39.2" |
| 37 | 38 | ||
| @@ -62,7 +63,8 @@ static void ipmi_debug_msg(const char *title, unsigned char *data, · 24 unmodified lines | |||
| 62 | { } | 63 | { } |
| 63 | #endif | 64 | #endif |
| 64 | 65 | ||
| 65 | static int initialized; | 66 | static bool initialized; |
| 67 | static bool drvregistered; | ||
| 66 | 68 | ||
| 67 | enum ipmi_panic_event_op { | 69 | enum ipmi_panic_event_op { |
| 68 | IPMI_SEND_PANIC_EVENT_NONE, | 70 | IPMI_SEND_PANIC_EVENT_NONE, |
| @@ -612,7 +614,7 @@ static DEFINE_MUTEX(ipmidriver_mutex); · 543 unmodified lines | |||
| 612 | 614 | ||
| 613 | static LIST_HEAD(ipmi_interfaces); | 615 | static LIST_HEAD(ipmi_interfaces); |
| 614 | static DEFINE_MUTEX(ipmi_interfaces_mutex); | 616 | static DEFINE_MUTEX(ipmi_interfaces_mutex); |
| 615 | DEFINE_STATIC_SRCU(ipmi_interfaces_srcu); | 617 | struct srcu_struct ipmi_interfaces_srcu; |
| 616 | 618 | ||
| 617 | /* | 619 | /* |
| 618 | * List of watchers that want to know when smi's are added and deleted. | 620 | * List of watchers that want to know when smi's are added and deleted. |
| @@ -720,7 +722,15 @@ struct watcher_entry { · 101 unmodified lines | |||
| 720 | int ipmi_smi_watcher_register(struct ipmi_smi_watcher *watcher) | 722 | int ipmi_smi_watcher_register(struct ipmi_smi_watcher *watcher) |
| 721 | { | 723 | { |
| 722 | struct ipmi_smi *intf; | 724 | struct ipmi_smi *intf; |
| 723 | int index; | 725 | int index, rv; |
| 726 | |||
| 727 | /* | ||
| 728 | * Make sure the driver is actually initialized, this handles | ||
| 729 | * problems with initialization order. | ||
| 730 | */ | ||
| 731 | rv = ipmi_init_msghandler(); | ||
| 732 | if (rv) | ||
| 733 | return rv; | ||
| 724 | 734 | ||
| 725 | mutex_lock(&smi_watchers_mutex); | 735 | mutex_lock(&smi_watchers_mutex); |
| 726 | 736 | ||
| @@ -884,7 +894,7 @@ static int deliver_response(struct ipmi_smi *intf, struct ipmi_recv_msg *msg) · 157 unmodified lines | |||
| 884 | 894 | ||
| 885 | if (user) { | 895 | if (user) { |
| 886 | user->handler->ipmi_recv_hndl(msg, user->handler_data); | 896 | user->handler->ipmi_recv_hndl(msg, user->handler_data); |
| 887 | release_ipmi_user(msg->user, index); | 897 | release_ipmi_user(user, index); |
| 888 | } else { | 898 | } else { |
| 889 | /* User went away, give up. */ | 899 | /* User went away, give up. */ |
| 890 | ipmi_free_recv_msg(msg); | 900 | ipmi_free_recv_msg(msg); |
| @@ -1076,7 +1086,7 @@ int ipmi_create_user(unsigned int if_num, · 185 unmodified lines | |||
| 1076 | { | 1086 | { |
| 1077 | unsigned long flags; | 1087 | unsigned long flags; |
| 1078 | struct ipmi_user *new_user; | 1088 | struct ipmi_user *new_user; |
| 1079 | int rv = 0, index; | 1089 | int rv, index; |
| 1080 | struct ipmi_smi *intf; | 1090 | struct ipmi_smi *intf; |
| 1081 | 1091 | ||
| 1082 | /* | 1092 | /* |
| @@ -1094,18 +1104,9 @@ int ipmi_create_user(unsigned int if_num, · 11 unmodified lines | |||
| 1094 | * Make sure the driver is actually initialized, this handles | 1104 | * Make sure the driver is actually initialized, this handles |
| 1095 | * problems with initialization order. | 1105 | * problems with initialization order. |
| 1096 | */ | 1106 | */ |
| 1097 | if (!initialized) { | 1107 | rv = ipmi_init_msghandler(); |
| 1098 | rv = ipmi_init_msghandler(); | 1108 | if (rv) |
| 1099 | if (rv) | 1109 | return rv; |
| 1100 | return rv; | ||
| 1101 | |||
| 1102 | /* | ||
| 1103 | * The init code doesn't return an error if it was turned | ||
| 1104 | * off, but it won't initialize. Check that. | ||
| 1105 | */ | ||
| 1106 | if (!initialized) | ||
| 1107 | return -ENODEV; | ||
| 1108 | } | ||
| 1109 | 1110 | ||
| 1110 | new_user = kmalloc(sizeof(*new_user), GFP_KERNEL); | 1111 | new_user = kmalloc(sizeof(*new_user), GFP_KERNEL); |
| 1111 | if (!new_user) | 1112 | if (!new_user) |
| @@ -1183,6 +1184,7 @@ EXPORT_SYMBOL(ipmi_get_smi_info); · 71 unmodified lines | |||
| 1183 | static void free_user(struct kref *ref) | 1184 | static void free_user(struct kref *ref) |
| 1184 | { | 1185 | { |
| 1185 | struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount); | 1186 | struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount); |
| 1187 | cleanup_srcu_struct(&user->release_barrier); | ||
| 1186 | kfree(user); | 1188 | kfree(user); |
| 1187 | } | 1189 | } |
| 1188 | 1190 | ||
| @@ -1259,7 +1261,6 @@ int ipmi_destroy_user(struct ipmi_user *user) · 70 unmodified lines | |||
| 1259 | { | 1261 | { |
| 1260 | _ipmi_destroy_user(user); | 1262 | _ipmi_destroy_user(user); |
| 1261 | 1263 | ||
| 1262 | cleanup_srcu_struct(&user->release_barrier); | ||
| 1263 | kref_put(&user->refcount, free_user); | 1264 | kref_put(&user->refcount, free_user); |
| 1264 | 1265 | ||
| 1265 | return 0; | 1266 | return 0; |
| @@ -1298,10 +1299,12 @@ int ipmi_set_my_address(struct ipmi_user *user, · 32 unmodified lines | |||
| 1298 | if (!user) | 1299 | if (!user) |
| 1299 | return -ENODEV; | 1300 | return -ENODEV; |
| 1300 | 1301 | ||
| 1301 | if (channel >= IPMI_MAX_CHANNELS) | 1302 | if (channel >= IPMI_MAX_CHANNELS) { |
| 1302 | rv = -EINVAL; | 1303 | rv = -EINVAL; |
| 1303 | else | 1304 | } else { |
| 1305 | channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); | ||
| 1304 | user->intf->addrinfo[channel].address = address; | 1306 | user->intf->addrinfo[channel].address = address; |
| 1307 | } | ||
| 1305 | release_ipmi_user(user, index); | 1308 | release_ipmi_user(user, index); |
| 1306 | 1309 | ||
| 1307 | return rv; | 1310 | return rv; |
| @@ -1318,10 +1321,12 @@ int ipmi_get_my_address(struct ipmi_user *user, · 10 unmodified lines | |||
| 1318 | if (!user) | 1321 | if (!user) |
| 1319 | return -ENODEV; | 1322 | return -ENODEV; |
| 1320 | 1323 | ||
| 1321 | if (channel >= IPMI_MAX_CHANNELS) | 1324 | if (channel >= IPMI_MAX_CHANNELS) { |
| 1322 | rv = -EINVAL; | 1325 | rv = -EINVAL; |
| 1323 | else | 1326 | } else { |
| 1327 | channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); | ||
| 1324 | *address = user->intf->addrinfo[channel].address; | 1328 | *address = user->intf->addrinfo[channel].address; |
| 1329 | } | ||
| 1325 | release_ipmi_user(user, index); | 1330 | release_ipmi_user(user, index); |
| 1326 | 1331 | ||
| 1327 | return rv; | 1332 | return rv; |
| @@ -1338,10 +1343,12 @@ int ipmi_set_my_LUN(struct ipmi_user *user, · 10 unmodified lines | |||
| 1338 | if (!user) | 1343 | if (!user) |
| 1339 | return -ENODEV; | 1344 | return -ENODEV; |
| 1340 | 1345 | ||
| 1341 | if (channel >= IPMI_MAX_CHANNELS) | 1346 | if (channel >= IPMI_MAX_CHANNELS) { |
| 1342 | rv = -EINVAL; | 1347 | rv = -EINVAL; |
| 1343 | else | 1348 | } else { |
| 1349 | channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); | ||
| 1344 | user->intf->addrinfo[channel].lun = LUN & 0x3; | 1350 | user->intf->addrinfo[channel].lun = LUN & 0x3; |
| 1351 | } | ||
| 1345 | release_ipmi_user(user, index); | 1352 | release_ipmi_user(user, index); |
| 1346 | 1353 | ||
| 1347 | return rv; | 1354 | return rv; |
| @@ -1358,10 +1365,12 @@ int ipmi_get_my_LUN(struct ipmi_user *user, · 10 unmodified lines | |||
| 1358 | if (!user) | 1365 | if (!user) |
| 1359 | return -ENODEV; | 1366 | return -ENODEV; |
| 1360 | 1367 | ||
| 1361 | if (channel >= IPMI_MAX_CHANNELS) | 1368 | if (channel >= IPMI_MAX_CHANNELS) { |
| 1362 | rv = -EINVAL; | 1369 | rv = -EINVAL; |
| 1363 | else | 1370 | } else { |
| 1371 | channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); | ||
| 1364 | *address = user->intf->addrinfo[channel].lun; | 1372 | *address = user->intf->addrinfo[channel].lun; |
| 1373 | } | ||
| 1365 | release_ipmi_user(user, index); | 1374 | release_ipmi_user(user, index); |
| 1366 | 1375 | ||
| 1367 | return rv; | 1376 | return rv; |
| @@ -2184,6 +2193,7 @@ static int check_addr(struct ipmi_smi *intf, · 816 unmodified lines | |||
| 2184 | { | 2193 | { |
| 2185 | if (addr->channel >= IPMI_MAX_CHANNELS) | 2194 | if (addr->channel >= IPMI_MAX_CHANNELS) |
| 2186 | return -EINVAL; | 2195 | return -EINVAL; |
| 2196 | addr->channel = array_index_nospec(addr->channel, IPMI_MAX_CHANNELS); | ||
| 2187 | *lun = intf->addrinfo[addr->channel].lun; | 2197 | *lun = intf->addrinfo[addr->channel].lun; |
| 2188 | *saddr = intf->addrinfo[addr->channel].address; | 2198 | *saddr = intf->addrinfo[addr->channel].address; |
| 2189 | return 0; | 2199 | return 0; |
| @@ -3291,17 +3301,9 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, · 1101 unmodified lines | |||
| 3291 | * Make sure the driver is actually initialized, this handles | 3301 | * Make sure the driver is actually initialized, this handles |
| 3292 | * problems with initialization order. | 3302 | * problems with initialization order. |
| 3293 | */ | 3303 | */ |
| 3294 | if (!initialized) { | 3304 | rv = ipmi_init_msghandler(); |
| 3295 | rv = ipmi_init_msghandler(); | 3305 | if (rv) |
| 3296 | if (rv) | 3306 | return rv; |
| 3297 | return rv; | ||
| 3298 | /* | ||
| 3299 | * The init code doesn't return an error if it was turned | ||
| 3300 | * off, but it won't initialize. Check that. | ||
| 3301 | */ | ||
| 3302 | if (!initialized) | ||
| 3303 | return -ENODEV; | ||
| 3304 | } | ||
| 3305 | 3307 | ||
| 3306 | intf = kzalloc(sizeof(*intf), GFP_KERNEL); | 3308 | intf = kzalloc(sizeof(*intf), GFP_KERNEL); |
| 3307 | if (!intf) | 3309 | if (!intf) |
| @@ -5017,6 +5019,22 @@ static int panic_event(struct notifier_block *this, · 1709 unmodified lines | |||
| 5017 | return NOTIFY_DONE; | 5019 | return NOTIFY_DONE; |
| 5018 | } | 5020 | } |
| 5019 | 5021 | ||
| 5022 | /* Must be called with ipmi_interfaces_mutex held. */ | ||
| 5023 | static int ipmi_register_driver(void) | ||
| 5024 | { | ||
| 5025 | int rv; | ||
| 5026 | |||
| 5027 | if (drvregistered) | ||
| 5028 | return 0; | ||
| 5029 | |||
| 5030 | rv = driver_register(&ipmidriver.driver); | ||
| 5031 | if (rv) | ||
| 5032 | pr_err("Could not register IPMI driver\n"); | ||
| 5033 | else | ||
| 5034 | drvregistered = true; | ||
| 5035 | return rv; | ||
| 5036 | } | ||
| 5037 | |||
| 5020 | static struct notifier_block panic_block = { | 5038 | static struct notifier_block panic_block = { |
| 5021 | .notifier_call = panic_event, | 5039 | .notifier_call = panic_event, |
| 5022 | .next = NULL, | 5040 | .next = NULL, |
| @@ -5027,66 +5045,75 @@ static int ipmi_init_msghandler(void) · 4 unmodified lines | |||
| 5027 | { | 5045 | { |
| 5028 | int rv; | 5046 | int rv; |
| 5029 | 5047 | ||
| 5048 | mutex_lock(&ipmi_interfaces_mutex); | ||
| 5049 | rv = ipmi_register_driver(); | ||
| 5050 | if (rv) | ||
| 5051 | goto out; | ||
| 5030 | if (initialized) | 5052 | if (initialized) |
| 5031 | return 0; | 5053 | goto out; |
| 5032 | |||
| 5033 | rv = driver_register(&ipmidriver.driver); | ||
| 5034 | if (rv) { | ||
| 5035 | pr_err("Could not register IPMI driver\n"); | ||
| 5036 | return rv; | ||
| 5037 | } | ||
| 5038 | 5054 | ||
| 5039 | pr_info("version " IPMI_DRIVER_VERSION "\n"); | 5055 | init_srcu_struct(&ipmi_interfaces_srcu); |
| 5040 | 5056 | ||
| 5041 | timer_setup(&ipmi_timer, ipmi_timeout, 0); | 5057 | timer_setup(&ipmi_timer, ipmi_timeout, 0); |
| 5042 | mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); | 5058 | mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); |
| 5043 | 5059 | ||
| 5044 | atomic_notifier_chain_register(&panic_notifier_list, &panic_block); | 5060 | atomic_notifier_chain_register(&panic_notifier_list, &panic_block); |
| 5045 | 5061 | ||
| 5046 | initialized = 1; | 5062 | initialized = true; |
| 5047 | 5063 | ||
| 5048 | return 0; | 5064 | out: |
| 5065 | mutex_unlock(&ipmi_interfaces_mutex); | ||
| 5066 | return rv; | ||
| 5049 | } | 5067 | } |
| 5050 | 5068 | ||
| 5051 | static int __init ipmi_init_msghandler_mod(void) | 5069 | static int __init ipmi_init_msghandler_mod(void) |
| 5052 | { | 5070 | { |
| 5053 | ipmi_init_msghandler(); | 5071 | int rv; |
| 5054 | return 0; | 5072 | |
| 5073 | pr_info("version " IPMI_DRIVER_VERSION "\n"); | ||
| 5074 | |||
| 5075 | mutex_lock(&ipmi_interfaces_mutex); | ||
| 5076 | rv = ipmi_register_driver(); | ||
| 5077 | mutex_unlock(&ipmi_interfaces_mutex); | ||
| 5078 | |||
| 5079 | return rv; | ||
| 5055 | } | 5080 | } |
| 5056 | 5081 | ||
| 5057 | static void __exit cleanup_ipmi(void) | 5082 | static void __exit cleanup_ipmi(void) |
| 5058 | { | 5083 | { |
| 5059 | int count; | 5084 | int count; |
| 5060 | 5085 | ||
| 5061 | if (!initialized) | 5086 | if (initialized) { |
| 5062 | return; | 5087 | atomic_notifier_chain_unregister(&panic_notifier_list, |
| 5063 | 5088 | &panic_block); | |
| 5064 | atomic_notifier_chain_unregister(&panic_notifier_list, &panic_block); | ||
| 5065 | 5089 | ||
| 5066 | /* | 5090 | /* |
| 5067 | * This can't be called if any interfaces exist, so no worry | 5091 | * This can't be called if any interfaces exist, so no worry |
| 5068 | * about shutting down the interfaces. | 5092 | * about shutting down the interfaces. |
| 5069 | */ | 5093 | */ |
| 5070 | 5094 | ||
| 5071 | /* | 5095 | /* |
| 5072 | * Tell the timer to stop, then wait for it to stop. This | 5096 | * Tell the timer to stop, then wait for it to stop. This |
| 5073 | * avoids problems with race conditions removing the timer | 5097 | * avoids problems with race conditions removing the timer |
| 5074 | * here. | 5098 | * here. |
| 5075 | */ | 5099 | */ |
| 5076 | atomic_inc(&stop_operation); | 5100 | atomic_inc(&stop_operation); |
| 5077 | del_timer_sync(&ipmi_timer); | 5101 | del_timer_sync(&ipmi_timer); |
| 5078 | 5102 | ||
| 5079 | driver_unregister(&ipmidriver.driver); | 5103 | initialized = false; |
| 5080 | 5104 | ||
| 5081 | initialized = 0; | 5105 | /* Check for buffer leaks. */ |
| 5106 | count = atomic_read(&smi_msg_inuse_count); | ||
| 5107 | if (count != 0) | ||
| 5108 | pr_warn("SMI message count %d at exit\n", count); | ||
| 5109 | count = atomic_read(&recv_msg_inuse_count); | ||
| 5110 | if (count != 0) | ||
| 5111 | pr_warn("recv message count %d at exit\n", count); | ||
| 5082 | 5112 | ||
| 5083 | /* Check for buffer leaks. */ | 5113 | cleanup_srcu_struct(&ipmi_interfaces_srcu); |
| 5084 | count = atomic_read(&smi_msg_inuse_count); | 5114 | } |
| 5085 | if (count != 0) | 5115 | if (drvregistered) |
| 5086 | pr_warn("SMI message count %d at exit\n", count); | 5116 | driver_unregister(&ipmidriver.driver); |
| 5087 | count = atomic_read(&recv_msg_inuse_count); | ||
| 5088 | if (count != 0) | ||
| 5089 | pr_warn("recv message count %d at exit\n", count); | ||
| 5090 | } | 5117 | } |
| 5091 | module_exit(cleanup_ipmi); | 5118 | module_exit(cleanup_ipmi); |
| 5092 | 5119 | ||
| @@ -632,8 +632,9 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, · 631 unmodified lines | |||
| 632 | 632 | ||
| 633 | /* Remove the multi-part read marker. */ | 633 | /* Remove the multi-part read marker. */ |
| 634 | len -= 2; | 634 | len -= 2; |
| 635 | data += 2; | ||
| 635 | for (i = 0; i < len; i++) | 636 | for (i = 0; i < len; i++) |
| 636 | ssif_info->data[i] = data[i+2]; | 637 | ssif_info->data[i] = data[i]; |
| 637 | ssif_info->multi_len = len; | 638 | ssif_info->multi_len = len; |
| 638 | ssif_info->multi_pos = 1; | 639 | ssif_info->multi_pos = 1; |
| 639 | 640 | ||
| @@ -661,8 +662,19 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, · 21 unmodified lines | |||
| 661 | } | 662 | } |
| 662 | 663 | ||
| 663 | blocknum = data[0]; | 664 | blocknum = data[0]; |
| 665 | len--; | ||
| 666 | data++; | ||
| 667 | |||
| 668 | if (blocknum != 0xff && len != 31) { | ||
| 669 | /* All blocks but the last must have 31 data bytes. */ | ||
| 670 | result = -EIO; | ||
| 671 | if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) | ||
| 672 | pr_info("Received middle message <31\n"); | ||
| 664 | 673 | ||
| 665 | if (ssif_info->multi_len + len - 1 > IPMI_MAX_MSG_LENGTH) { | 674 | goto continue_op; |
| 675 | } | ||
| 676 | |||
| 677 | if (ssif_info->multi_len + len > IPMI_MAX_MSG_LENGTH) { | ||
| 666 | /* Received message too big, abort the operation. */ | 678 | /* Received message too big, abort the operation. */ |
| 667 | result = -E2BIG; | 679 | result = -E2BIG; |
| 668 | if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) | 680 | if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) |
| @@ -671,16 +683,14 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, · 2 unmodified lines | |||
| 671 | goto continue_op; | 683 | goto continue_op; |
| 672 | } | 684 | } |
| 673 | 685 | ||
| 674 | /* Remove the blocknum from the data. */ | ||
| 675 | len--; | ||
| 676 | for (i = 0; i < len; i++) | 686 | for (i = 0; i < len; i++) |
| 677 | ssif_info->data[i + ssif_info->multi_len] = data[i + 1]; | 687 | ssif_info->data[i + ssif_info->multi_len] = data[i]; |
| 678 | ssif_info->multi_len += len; | 688 | ssif_info->multi_len += len; |
| 679 | if (blocknum == 0xff) { | 689 | if (blocknum == 0xff) { |
| 680 | /* End of read */ | 690 | /* End of read */ |
| 681 | len = ssif_info->multi_len; | 691 | len = ssif_info->multi_len; |
| 682 | data = ssif_info->data; | 692 | data = ssif_info->data; |
| 683 | } else if (blocknum + 1 != ssif_info->multi_pos) { | 693 | } else if (blocknum != ssif_info->multi_pos) { |
| 684 | /* | 694 | /* |
| 685 | * Out of sequence block, just abort. Block | 695 | * Out of sequence block, just abort. Block |
| 686 | * numbers start at zero for the second block, | 696 | * numbers start at zero for the second block, |
| @@ -707,6 +717,7 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, · 20 unmodified lines | |||
| 707 | } | 717 | } |
| 708 | } | 718 | } |
| 709 | 719 | ||
| 720 | continue_op: | ||
| 710 | if (result < 0) { | 721 | if (result < 0) { |
| 711 | ssif_inc_stat(ssif_info, receive_errors); | 722 | ssif_inc_stat(ssif_info, receive_errors); |
| 712 | } else { | 723 | } else { |
| @@ -714,8 +725,6 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, · 1 unmodified line | |||
| 714 | ssif_inc_stat(ssif_info, received_message_parts); | 725 | ssif_inc_stat(ssif_info, received_message_parts); |
| 715 | } | 726 | } |
| 716 | 727 | ||
| 717 | |||
| 718 | continue_op: | ||
| 719 | if (ssif_info->ssif_debug & SSIF_DEBUG_STATE) | 728 | if (ssif_info->ssif_debug & SSIF_DEBUG_STATE) |
| 720 | pr_info("DONE 1: state = %d, result=%d\n", | 729 | pr_info("DONE 1: state = %d, result=%d\n", |
| 721 | ssif_info->ssif_state, result); | 730 | ssif_info->ssif_state, result); |
| @@ -59,6 +59,7 @@ · 58 unmodified lines | |||
| 59 | #include <linux/mutex.h> | 59 | #include <linux/mutex.h> |
| 60 | #include <linux/delay.h> | 60 | #include <linux/delay.h> |
| 61 | #include <linux/serial_8250.h> | 61 | #include <linux/serial_8250.h> |
| 62 | #include <linux/nospec.h> | ||
| 62 | #include "smapi.h" | 63 | #include "smapi.h" |
| 63 | #include "mwavedd.h" | 64 | #include "mwavedd.h" |
| 64 | #include "3780i.h" | 65 | #include "3780i.h" |
| @@ -289,6 +290,8 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, · 224 unmodified lines | |||
| 289 | ipcnum); | 290 | ipcnum); |
| 290 | return -EINVAL; | 291 | return -EINVAL; |
| 291 | } | 292 | } |
| 293 | ipcnum = array_index_nospec(ipcnum, | ||
| 294 | ARRAY_SIZE(pDrvData->IPCs)); | ||
| 292 | PRINTK_3(TRACE_MWAVE, | 295 | PRINTK_3(TRACE_MWAVE, |
| 293 | "mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC" | 296 | "mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC" |
| 294 | " ipcnum %x entry usIntCount %x\n", | 297 | " ipcnum %x entry usIntCount %x\n", |
| @@ -317,6 +320,8 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, · 22 unmodified lines | |||
| 317 | " Invalid ipcnum %x\n", ipcnum); | 320 | " Invalid ipcnum %x\n", ipcnum); |
| 318 | return -EINVAL; | 321 | return -EINVAL; |
| 319 | } | 322 | } |
| 323 | ipcnum = array_index_nospec(ipcnum, | ||
| 324 | ARRAY_SIZE(pDrvData->IPCs)); | ||
| 320 | PRINTK_3(TRACE_MWAVE, | 325 | PRINTK_3(TRACE_MWAVE, |
| 321 | "mwavedd::mwave_ioctl IOCTL_MW_GET_IPC" | 326 | "mwavedd::mwave_ioctl IOCTL_MW_GET_IPC" |
| 322 | " ipcnum %x, usIntCount %x\n", | 327 | " ipcnum %x, usIntCount %x\n", |
| @@ -383,6 +388,8 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, · 60 unmodified lines | |||
| 383 | ipcnum); | 388 | ipcnum); |
| 384 | return -EINVAL; | 389 | return -EINVAL; |
| 385 | } | 390 | } |
| 391 | ipcnum = array_index_nospec(ipcnum, | ||
| 392 | ARRAY_SIZE(pDrvData->IPCs)); | ||
| 386 | mutex_lock(&mwave_mutex); | 393 | mutex_lock(&mwave_mutex); |
| 387 | if (pDrvData->IPCs[ipcnum].bIsEnabled == true) { | 394 | if (pDrvData->IPCs[ipcnum].bIsEnabled == true) { |
| 388 | pDrvData->IPCs[ipcnum].bIsEnabled = false; | 395 | pDrvData->IPCs[ipcnum].bIsEnabled = false; |
| @@ -293,7 +293,6 @@ config COMMON_CLK_BD718XX · 292 unmodified lines | |||
| 293 | source "drivers/clk/actions/Kconfig" | 293 | source "drivers/clk/actions/Kconfig" |
| 294 | source "drivers/clk/bcm/Kconfig" | 294 | source "drivers/clk/bcm/Kconfig" |
| 295 | source "drivers/clk/hisilicon/Kconfig" | 295 | source "drivers/clk/hisilicon/Kconfig" |
| 296 | source "drivers/clk/imx/Kconfig" | ||
| 297 | source "drivers/clk/imgtec/Kconfig" | 296 | source "drivers/clk/imgtec/Kconfig" |
| 298 | source "drivers/clk/imx/Kconfig" | 297 | source "drivers/clk/imx/Kconfig" |
| 299 | source "drivers/clk/ingenic/Kconfig" | 298 | source "drivers/clk/ingenic/Kconfig" |
| @@ -262,8 +262,10 @@ static int vc5_mux_set_parent(struct clk_hw *hw, u8 index) · 261 unmodified lines | |||
| 262 | 262 | ||
| 263 | if (vc5->clk_mux_ins == VC5_MUX_IN_XIN) | 263 | if (vc5->clk_mux_ins == VC5_MUX_IN_XIN) |
| 264 | src = VC5_PRIM_SRC_SHDN_EN_XTAL; | 264 | src = VC5_PRIM_SRC_SHDN_EN_XTAL; |
| 265 | if (vc5->clk_mux_ins == VC5_MUX_IN_CLKIN) | 265 | else if (vc5->clk_mux_ins == VC5_MUX_IN_CLKIN) |
| 266 | src = VC5_PRIM_SRC_SHDN_EN_CLKIN; | 266 | src = VC5_PRIM_SRC_SHDN_EN_CLKIN; |
| 267 | else /* Invalid; should have been caught by vc5_probe() */ | ||
| 268 | return -EINVAL; | ||
| 267 | } | 269 | } |
| 268 | 270 | ||
| 269 | return regmap_update_bits(vc5->regmap, VC5_PRIM_SRC_SHDN, mask, src); | 271 | return regmap_update_bits(vc5->regmap, VC5_PRIM_SRC_SHDN, mask, src); |
| @@ -1513,9 +1513,19 @@ static int clk_fetch_parent_index(struct clk_core *core, · 1512 unmodified lines | |||
| 1513 | if (!parent) | 1513 | if (!parent) |
| 1514 | return -EINVAL; | 1514 | return -EINVAL; |
| 1515 | 1515 | ||
| 1516 | for (i = 0; i < core->num_parents; i++) | 1516 | for (i = 0; i < core->num_parents; i++) { |
| 1517 | if (clk_core_get_parent_by_index(core, i) == parent) | 1517 | if (core->parents[i] == parent) |
| 1518 | return i; | ||
| 1519 | |||
| 1520 | if (core->parents[i]) | ||
| 1521 | continue; | ||
| 1522 | |||
| 1523 | /* Fallback to comparing globally unique names */ | ||
| 1524 | if (!strcmp(parent->name, core->parent_names[i])) { | ||
| 1525 | core->parents[i] = parent; | ||
| 1518 | return i; | 1526 | return i; |
| 1527 | } | ||
| 1528 | } | ||
| 1519 | 1529 | ||
| 1520 | return -EINVAL; | 1530 | return -EINVAL; |
| 1521 | } | 1531 | } |
| @@ -2779,7 +2789,7 @@ static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level) · 1257 unmodified lines | |||
| 2779 | seq_printf(s, "\"protect_count\": %d,", c->protect_count); | 2789 | seq_printf(s, "\"protect_count\": %d,", c->protect_count); |
| 2780 | seq_printf(s, "\"rate\": %lu,", clk_core_get_rate(c)); | 2790 | seq_printf(s, "\"rate\": %lu,", clk_core_get_rate(c)); |
| 2781 | seq_printf(s, "\"accuracy\": %lu,", clk_core_get_accuracy(c)); | 2791 | seq_printf(s, "\"accuracy\": %lu,", clk_core_get_accuracy(c)); |
| 2782 | seq_printf(s, "\"phase\": %d", clk_core_get_phase(c)); | 2792 | seq_printf(s, "\"phase\": %d,", clk_core_get_phase(c)); |
| 2783 | seq_printf(s, "\"duty_cycle\": %u", | 2793 | seq_printf(s, "\"duty_cycle\": %u", |
| 2784 | clk_core_get_scaled_duty_cycle(c, 100000)); | 2794 | clk_core_get_scaled_duty_cycle(c, 100000)); |
| 2785 | } | 2795 | } |
| @@ -155,13 +155,14 @@ static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, · 154 unmodified lines | |||
| 155 | { | 155 | { |
| 156 | struct clk_frac_pll *pll = to_clk_frac_pll(hw); | 156 | struct clk_frac_pll *pll = to_clk_frac_pll(hw); |
| 157 | u32 val, divfi, divff; | 157 | u32 val, divfi, divff; |
| 158 | u64 temp64 = parent_rate; | 158 | u64 temp64; |
| 159 | int ret; | 159 | int ret; |
| 160 | 160 | ||
| 161 | parent_rate *= 8; | 161 | parent_rate *= 8; |
| 162 | rate *= 2; | 162 | rate *= 2; |
| 163 | divfi = rate / parent_rate; | 163 | divfi = rate / parent_rate; |
| 164 | temp64 *= rate - divfi; | 164 | temp64 = parent_rate * divfi; |
| 165 | temp64 = rate - temp64; | ||
| 165 | temp64 *= PLL_FRAC_DENOM; | 166 | temp64 *= PLL_FRAC_DENOM; |
| 166 | do_div(temp64, parent_rate); | 167 | do_div(temp64, parent_rate); |
| 167 | divff = temp64; | 168 | divff = temp64; |
| @@ -169,6 +169,8 @@ static int imx8qxp_lpcg_clk_probe(struct platform_device *pdev) · 168 unmodified lines | |||
| 169 | return -ENODEV; | 169 | return -ENODEV; |
| 170 | 170 | ||
| 171 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 171 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 172 | if (!res) | ||
| 173 | return -EINVAL; | ||
| 172 | base = devm_ioremap(dev, res->start, resource_size(res)); | 174 | base = devm_ioremap(dev, res->start, resource_size(res)); |
| 173 | if (!base) | 175 | if (!base) |
| 174 | return -ENOMEM; | 176 | return -ENOMEM; |
| @@ -53,7 +53,6 @@ · 52 unmodified lines | |||
| 53 | #define APMU_DISP1 0x110 | 53 | #define APMU_DISP1 0x110 |
| 54 | #define APMU_CCIC0 0x50 | 54 | #define APMU_CCIC0 0x50 |
| 55 | #define APMU_CCIC1 0xf4 | 55 | #define APMU_CCIC1 0xf4 |
| 56 | #define APMU_SP 0x68 | ||
| 57 | #define MPMU_UART_PLL 0x14 | 56 | #define MPMU_UART_PLL 0x14 |
| 58 | 57 | ||
| 59 | struct mmp2_clk_unit { | 58 | struct mmp2_clk_unit { |
| @@ -210,8 +209,6 @@ static struct mmp_clk_mix_config ccic1_mix_config = { · 150 unmodified lines | |||
| 210 | .reg_info = DEFINE_MIX_REG_INFO(4, 16, 2, 6, 32), | 209 | .reg_info = DEFINE_MIX_REG_INFO(4, 16, 2, 6, 32), |
| 211 | }; | 210 | }; |
| 212 | 211 | ||
| 213 | static DEFINE_SPINLOCK(sp_lock); | ||
| 214 | |||
| 215 | static struct mmp_param_mux_clk apmu_mux_clks[] = { | 212 | static struct mmp_param_mux_clk apmu_mux_clks[] = { |
| 216 | {MMP2_CLK_DISP0_MUX, "disp0_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP0, 6, 2, 0, &disp0_lock}, | 213 | {MMP2_CLK_DISP0_MUX, "disp0_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP0, 6, 2, 0, &disp0_lock}, |
| 217 | {MMP2_CLK_DISP1_MUX, "disp1_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP1, 6, 2, 0, &disp1_lock}, | 214 | {MMP2_CLK_DISP1_MUX, "disp1_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP1, 6, 2, 0, &disp1_lock}, |
| @@ -242,7 +239,6 @@ static struct mmp_param_gate_clk apmu_gate_clks[] = { · 24 unmodified lines | |||
| 242 | {MMP2_CLK_CCIC1, "ccic1_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x1b, 0x1b, 0x0, 0, &ccic1_lock}, | 239 | {MMP2_CLK_CCIC1, "ccic1_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x1b, 0x1b, 0x0, 0, &ccic1_lock}, |
| 243 | {MMP2_CLK_CCIC1_PHY, "ccic1_phy_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x24, 0x24, 0x0, 0, &ccic1_lock}, | 240 | {MMP2_CLK_CCIC1_PHY, "ccic1_phy_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x24, 0x24, 0x0, 0, &ccic1_lock}, |
| 244 | {MMP2_CLK_CCIC1_SPHY, "ccic1_sphy_clk", "ccic1_sphy_div", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x300, 0x300, 0x0, 0, &ccic1_lock}, | 241 | {MMP2_CLK_CCIC1_SPHY, "ccic1_sphy_clk", "ccic1_sphy_div", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x300, 0x300, 0x0, 0, &ccic1_lock}, |
| 245 | {MMP2_CLK_SP, "sp_clk", NULL, CLK_SET_RATE_PARENT, APMU_SP, 0x1b, 0x1b, 0x0, 0, &sp_lock}, | ||
| 246 | }; | 242 | }; |
| 247 | 243 | ||
| 248 | static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit) | 244 | static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit) |
| @@ -215,6 +215,7 @@ config MSM_MMCC_8996 · 214 unmodified lines | |||
| 215 | 215 | ||
| 216 | config MSM_GCC_8998 | 216 | config MSM_GCC_8998 |
| 217 | tristate "MSM8998 Global Clock Controller" | 217 | tristate "MSM8998 Global Clock Controller" |
| 218 | select QCOM_GDSC | ||
| 218 | help | 219 | help |
| 219 | Support for the global clock controller on msm8998 devices. | 220 | Support for the global clock controller on msm8998 devices. |
| 220 | Say Y if you want to use peripheral devices such as UART, SPI, | 221 | Say Y if you want to use peripheral devices such as UART, SPI, |
| @@ -115,8 +115,8 @@ static const char * const gcc_parent_names_6[] = { · 114 unmodified lines | |||
| 115 | "core_bi_pll_test_se", | 115 | "core_bi_pll_test_se", |
| 116 | }; | 116 | }; |
| 117 | 117 | ||
| 118 | static const char * const gcc_parent_names_7[] = { | 118 | static const char * const gcc_parent_names_7_ao[] = { |
| 119 | "bi_tcxo", | 119 | "bi_tcxo_ao", |
| 120 | "gpll0", | 120 | "gpll0", |
| 121 | "gpll0_out_even", | 121 | "gpll0_out_even", |
| 122 | "core_bi_pll_test_se", | 122 | "core_bi_pll_test_se", |
| @@ -128,6 +128,12 @@ static const char * const gcc_parent_names_8[] = { · 5 unmodified lines | |||
| 128 | "core_bi_pll_test_se", | 128 | "core_bi_pll_test_se", |
| 129 | }; | 129 | }; |
| 130 | 130 | ||
| 131 | static const char * const gcc_parent_names_8_ao[] = { | ||
| 132 | "bi_tcxo_ao", | ||
| 133 | "gpll0", | ||
| 134 | "core_bi_pll_test_se", | ||
| 135 | }; | ||
| 136 | |||
| 131 | static const struct parent_map gcc_parent_map_10[] = { | 137 | static const struct parent_map gcc_parent_map_10[] = { |
| 132 | { P_BI_TCXO, 0 }, | 138 | { P_BI_TCXO, 0 }, |
| 133 | { P_GPLL0_OUT_MAIN, 1 }, | 139 | { P_GPLL0_OUT_MAIN, 1 }, |
| @@ -210,7 +216,7 @@ static struct clk_rcg2 gcc_cpuss_ahb_clk_src = { · 76 unmodified lines | |||
| 210 | .freq_tbl = ftbl_gcc_cpuss_ahb_clk_src, | 216 | .freq_tbl = ftbl_gcc_cpuss_ahb_clk_src, |
| 211 | .clkr.hw.init = &(struct clk_init_data){ | 217 | .clkr.hw.init = &(struct clk_init_data){ |
| 212 | .name = "gcc_cpuss_ahb_clk_src", | 218 | .name = "gcc_cpuss_ahb_clk_src", |
| 213 | .parent_names = gcc_parent_names_7, | 219 | .parent_names = gcc_parent_names_7_ao, |
| 214 | .num_parents = 4, | 220 | .num_parents = 4, |
| 215 | .ops = &clk_rcg2_ops, | 221 | .ops = &clk_rcg2_ops, |
| 216 | }, | 222 | }, |
| @@ -229,7 +235,7 @@ static struct clk_rcg2 gcc_cpuss_rbcpr_clk_src = { · 12 unmodified lines | |||
| 229 | .freq_tbl = ftbl_gcc_cpuss_rbcpr_clk_src, | 235 | .freq_tbl = ftbl_gcc_cpuss_rbcpr_clk_src, |
| 230 | .clkr.hw.init = &(struct clk_init_data){ | 236 | .clkr.hw.init = &(struct clk_init_data){ |
| 231 | .name = "gcc_cpuss_rbcpr_clk_src", | 237 | .name = "gcc_cpuss_rbcpr_clk_src", |
| 232 | .parent_names = gcc_parent_names_8, | 238 | .parent_names = gcc_parent_names_8_ao, |
| 233 | .num_parents = 3, | 239 | .num_parents = 3, |
| 234 | .ops = &clk_rcg2_ops, | 240 | .ops = &clk_rcg2_ops, |
| 235 | }, | 241 | }, |
| @@ -43,7 +43,7 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hwclk, · 42 unmodified lines | |||
| 43 | /* Read mdiv and fdiv from the fdbck register */ | 43 | /* Read mdiv and fdiv from the fdbck register */ |
| 44 | reg = readl(socfpgaclk->hw.reg + 0x4); | 44 | reg = readl(socfpgaclk->hw.reg + 0x4); |
| 45 | mdiv = (reg & SOCFPGA_PLL_MDIV_MASK) >> SOCFPGA_PLL_MDIV_SHIFT; | 45 | mdiv = (reg & SOCFPGA_PLL_MDIV_MASK) >> SOCFPGA_PLL_MDIV_SHIFT; |
| 46 | vco_freq = (unsigned long long)parent_rate * (mdiv + 6); | 46 | vco_freq = (unsigned long long)vco_freq * (mdiv + 6); |
| 47 | 47 | ||
| 48 | return (unsigned long)vco_freq; | 48 | return (unsigned long)vco_freq; |
| 49 | } | 49 | } |
| @@ -12,17 +12,17 @@ · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | #include "stratix10-clk.h" | 13 | #include "stratix10-clk.h" |
| 14 | 14 | ||
| 15 | static const char * const pll_mux[] = { "osc1", "cb_intosc_hs_div2_clk", | 15 | static const char * const pll_mux[] = { "osc1", "cb-intosc-hs-div2-clk", |
| 16 | "f2s_free_clk",}; | 16 | "f2s-free-clk",}; |
| 17 | static const char * const cntr_mux[] = { "main_pll", "periph_pll", | 17 | static const char * const cntr_mux[] = { "main_pll", "periph_pll", |
| 18 | "osc1", "cb_intosc_hs_div2_clk", | 18 | "osc1", "cb-intosc-hs-div2-clk", |
| 19 | "f2s_free_clk"}; | 19 | "f2s-free-clk"}; |
| 20 | static const char * const boot_mux[] = { "osc1", "cb_intosc_hs_div2_clk",}; | 20 | static const char * const boot_mux[] = { "osc1", "cb-intosc-hs-div2-clk",}; |
| 21 | 21 | ||
| 22 | static const char * const noc_free_mux[] = {"main_noc_base_clk", | 22 | static const char * const noc_free_mux[] = {"main_noc_base_clk", |
| 23 | "peri_noc_base_clk", | 23 | "peri_noc_base_clk", |
| 24 | "osc1", "cb_intosc_hs_div2_clk", | 24 | "osc1", "cb-intosc-hs-div2-clk", |
| 25 | "f2s_free_clk"}; | 25 | "f2s-free-clk"}; |
| 26 | 26 | ||
| 27 | static const char * const emaca_free_mux[] = {"peri_emaca_clk", "boot_clk"}; | 27 | static const char * const emaca_free_mux[] = {"peri_emaca_clk", "boot_clk"}; |
| 28 | static const char * const emacb_free_mux[] = {"peri_emacb_clk", "boot_clk"}; | 28 | static const char * const emacb_free_mux[] = {"peri_emacb_clk", "boot_clk"}; |
| @@ -33,14 +33,14 @@ static const char * const s2f_usr1_free_mux[] = {"peri_s2f_usr1_clk", "boot_clk" · 4 unmodified lines | |||
| 33 | static const char * const psi_ref_free_mux[] = {"peri_psi_ref_clk", "boot_clk"}; | 33 | static const char * const psi_ref_free_mux[] = {"peri_psi_ref_clk", "boot_clk"}; |
| 34 | static const char * const mpu_mux[] = { "mpu_free_clk", "boot_clk",}; | 34 | static const char * const mpu_mux[] = { "mpu_free_clk", "boot_clk",}; |
| 35 | 35 | ||
| 36 | static const char * const s2f_usr0_mux[] = {"f2s_free_clk", "boot_clk"}; | 36 | static const char * const s2f_usr0_mux[] = {"f2s-free-clk", "boot_clk"}; |
| 37 | static const char * const emac_mux[] = {"emaca_free_clk", "emacb_free_clk"}; | 37 | static const char * const emac_mux[] = {"emaca_free_clk", "emacb_free_clk"}; |
| 38 | static const char * const noc_mux[] = {"noc_free_clk", "boot_clk"}; | 38 | static const char * const noc_mux[] = {"noc_free_clk", "boot_clk"}; |
| 39 | 39 | ||
| 40 | static const char * const mpu_free_mux[] = {"main_mpu_base_clk", | 40 | static const char * const mpu_free_mux[] = {"main_mpu_base_clk", |
| 41 | "peri_mpu_base_clk", | 41 | "peri_mpu_base_clk", |
| 42 | "osc1", "cb_intosc_hs_div2_clk", | 42 | "osc1", "cb-intosc-hs-div2-clk", |
| 43 | "f2s_free_clk"}; | 43 | "f2s-free-clk"}; |
| 44 | 44 | ||
| 45 | /* clocks in AO (always on) controller */ | 45 | /* clocks in AO (always on) controller */ |
| 46 | static const struct stratix10_pll_clock s10_pll_clks[] = { | 46 | static const struct stratix10_pll_clock s10_pll_clks[] = { |
| @@ -133,9 +133,11 @@ static int tegra124_dfll_fcpu_remove(struct platform_device *pdev) · 132 unmodified lines | |||
| 133 | struct tegra_dfll_soc_data *soc; | 133 | struct tegra_dfll_soc_data *soc; |
| 134 | 134 | ||
| 135 | soc = tegra_dfll_unregister(pdev); | 135 | soc = tegra_dfll_unregister(pdev); |
| 136 | if (IS_ERR(soc)) | 136 | if (IS_ERR(soc)) { |
| 137 | dev_err(&pdev->dev, "failed to unregister DFLL: %ld\n", | 137 | dev_err(&pdev->dev, "failed to unregister DFLL: %ld\n", |
| 138 | PTR_ERR(soc)); | 138 | PTR_ERR(soc)); |
| 139 | return PTR_ERR(soc); | ||
| 140 | } | ||
| 139 | 141 | ||
| 140 | tegra_cvb_remove_opp_table(soc->dev, soc->cvb, soc->max_freq); | 142 | tegra_cvb_remove_opp_table(soc->dev, soc->cvb, soc->max_freq); |
| 141 | 143 | ||
| @@ -403,8 +403,10 @@ int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div, · 402 unmodified lines | |||
| 403 | num_dividers = i; | 403 | num_dividers = i; |
| 404 | 404 | ||
| 405 | tmp = kcalloc(valid_div + 1, sizeof(*tmp), GFP_KERNEL); | 405 | tmp = kcalloc(valid_div + 1, sizeof(*tmp), GFP_KERNEL); |
| 406 | if (!tmp) | 406 | if (!tmp) { |
| 407 | *table = ERR_PTR(-ENOMEM); | ||
| 407 | return -ENOMEM; | 408 | return -ENOMEM; |
| 409 | } | ||
| 408 | 410 | ||
| 409 | valid_div = 0; | 411 | valid_div = 0; |
| 410 | *width = 0; | 412 | *width = 0; |
| @@ -439,6 +441,7 @@ struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup) · 28 unmodified lines | |||
| 439 | { | 441 | { |
| 440 | struct clk_omap_divider *div; | 442 | struct clk_omap_divider *div; |
| 441 | struct clk_omap_reg *reg; | 443 | struct clk_omap_reg *reg; |
| 444 | int ret; | ||
| 442 | 445 | ||
| 443 | if (!setup) | 446 | if (!setup) |
| 444 | return NULL; | 447 | return NULL; |
| @@ -458,6 +461,12 @@ struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup) · 13 unmodified lines | |||
| 458 | div->flags |= CLK_DIVIDER_POWER_OF_TWO; | 461 | div->flags |= CLK_DIVIDER_POWER_OF_TWO; |
| 459 | 462 | ||
| 460 | div->table = _get_div_table_from_setup(setup, &div->width); | 463 | div->table = _get_div_table_from_setup(setup, &div->width); |
| 464 | if (IS_ERR(div->table)) { | ||
| 465 | ret = PTR_ERR(div->table); | ||
| 466 | kfree(div); | ||
| 467 | return ERR_PTR(ret); | ||
| 468 | } | ||
| 469 | |||
| 461 | 470 | ||
| 462 | div->shift = setup->bit_shift; | 471 | div->shift = setup->bit_shift; |
| 463 | div->latch = -EINVAL; | 472 | div->latch = -EINVAL; |
| @@ -669,8 +669,8 @@ static int zynqmp_clk_setup(struct device_node *np) · 668 unmodified lines | |||
| 669 | if (ret) | 669 | if (ret) |
| 670 | return ret; | 670 | return ret; |
| 671 | 671 | ||
| 672 | zynqmp_data = kzalloc(sizeof(*zynqmp_data) + sizeof(*zynqmp_data) * | 672 | zynqmp_data = kzalloc(struct_size(zynqmp_data, hws, clock_max_idx), |
| 673 | clock_max_idx, GFP_KERNEL); | 673 | GFP_KERNEL); |
| 674 | if (!zynqmp_data) | 674 | if (!zynqmp_data) |
| 675 | return -ENOMEM; | 675 | return -ENOMEM; |
| 676 | 676 | ||
| @@ -1530,17 +1530,16 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy) · 1529 unmodified lines | |||
| 1530 | { | 1530 | { |
| 1531 | unsigned int ret_freq = 0; | 1531 | unsigned int ret_freq = 0; |
| 1532 | 1532 | ||
| 1533 | if (!cpufreq_driver->get) | 1533 | if (unlikely(policy_is_inactive(policy)) || !cpufreq_driver->get) |
| 1534 | return ret_freq; | 1534 | return ret_freq; |
| 1535 | 1535 | ||
| 1536 | ret_freq = cpufreq_driver->get(policy->cpu); | 1536 | ret_freq = cpufreq_driver->get(policy->cpu); |
| 1537 | 1537 | ||
| 1538 | /* | 1538 | /* |
| 1539 | * Updating inactive policies is invalid, so avoid doing that. Also | 1539 | * If fast frequency switching is used with the given policy, the check |
| 1540 | * if fast frequency switching is used with the given policy, the check | ||
| 1541 | * against policy->cur is pointless, so skip it in that case too. | 1540 | * against policy->cur is pointless, so skip it in that case too. |
| 1542 | */ | 1541 | */ |
| 1543 | if (unlikely(policy_is_inactive(policy)) || policy->fast_switch_enabled) | 1542 | if (policy->fast_switch_enabled) |
| 1544 | return ret_freq; | 1543 | return ret_freq; |
| 1545 | 1544 | ||
| 1546 | if (ret_freq && policy->cur && | 1545 | if (ret_freq && policy->cur && |
| @@ -1569,10 +1568,7 @@ unsigned int cpufreq_get(unsigned int cpu) · 22 unmodified lines | |||
| 1569 | 1568 | ||
| 1570 | if (policy) { | 1569 | if (policy) { |
| 1571 | down_read(&policy->rwsem); | 1570 | down_read(&policy->rwsem); |
| 1572 | 1571 | ret_freq = __cpufreq_get(policy); | |
| 1573 | if (!policy_is_inactive(policy)) | ||
| 1574 | ret_freq = __cpufreq_get(policy); | ||
| 1575 | |||
| 1576 | up_read(&policy->rwsem); | 1572 | up_read(&policy->rwsem); |
| 1577 | 1573 | ||
| 1578 | cpufreq_cpu_put(policy); | 1574 | cpufreq_cpu_put(policy); |
| @@ -52,9 +52,9 @@ scmi_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index) · 51 unmodified lines | |||
| 52 | int ret; | 52 | int ret; |
| 53 | struct scmi_data *priv = policy->driver_data; | 53 | struct scmi_data *priv = policy->driver_data; |
| 54 | struct scmi_perf_ops *perf_ops = handle->perf_ops; | 54 | struct scmi_perf_ops *perf_ops = handle->perf_ops; |
| 55 | u64 freq = policy->freq_table[index].frequency * 1000; | 55 | u64 freq = policy->freq_table[index].frequency; |
| 56 | 56 | ||
| 57 | ret = perf_ops->freq_set(handle, priv->domain_id, freq, false); | 57 | ret = perf_ops->freq_set(handle, priv->domain_id, freq * 1000, false); |
| 58 | if (!ret) | 58 | if (!ret) |
| 59 | arch_set_freq_scale(policy->related_cpus, freq, | 59 | arch_set_freq_scale(policy->related_cpus, freq, |
| 60 | policy->cpuinfo.max_freq); | 60 | policy->cpuinfo.max_freq); |
| @@ -176,7 +176,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) · 115 unmodified lines | |||
| 176 | out_free_priv: | 176 | out_free_priv: |
| 177 | kfree(priv); | 177 | kfree(priv); |
| 178 | out_free_opp: | 178 | out_free_opp: |
| 179 | dev_pm_opp_cpumask_remove_table(policy->cpus); | 179 | dev_pm_opp_remove_all_dynamic(cpu_dev); |
| 180 | 180 | ||
| 181 | return ret; | 181 | return ret; |
| 182 | } | 182 | } |
| @@ -188,7 +188,7 @@ static int scmi_cpufreq_exit(struct cpufreq_policy *policy) · 5 unmodified lines | |||
| 188 | cpufreq_cooling_unregister(priv->cdev); | 188 | cpufreq_cooling_unregister(priv->cdev); |
| 189 | dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); | 189 | dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); |
| 190 | kfree(priv); | 190 | kfree(priv); |
| 191 | dev_pm_opp_cpumask_remove_table(policy->related_cpus); | 191 | dev_pm_opp_remove_all_dynamic(priv->cpu_dev); |
| 192 | 192 | ||
| 193 | return 0; | 193 | return 0; |
| 194 | } | 194 | } |
| @@ -177,7 +177,7 @@ out_free_cpufreq_table: · 176 unmodified lines | |||
| 177 | out_free_priv: | 177 | out_free_priv: |
| 178 | kfree(priv); | 178 | kfree(priv); |
| 179 | out_free_opp: | 179 | out_free_opp: |
| 180 | dev_pm_opp_cpumask_remove_table(policy->cpus); | 180 | dev_pm_opp_remove_all_dynamic(cpu_dev); |
| 181 | 181 | ||
| 182 | return ret; | 182 | return ret; |
| 183 | } | 183 | } |
| @@ -190,7 +190,7 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy) · 6 unmodified lines | |||
| 190 | clk_put(priv->clk); | 190 | clk_put(priv->clk); |
| 191 | dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); | 191 | dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); |
| 192 | kfree(priv); | 192 | kfree(priv); |
| 193 | dev_pm_opp_cpumask_remove_table(policy->related_cpus); | 193 | dev_pm_opp_remove_all_dynamic(priv->cpu_dev); |
| 194 | 194 | ||
| 195 | return 0; | 195 | return 0; |
| 196 | } | 196 | } |
| @@ -21,7 +21,7 @@ static int __cpuidle poll_idle(struct cpuidle_device *dev, · 20 unmodified lines | |||
| 21 | local_irq_enable(); | 21 | local_irq_enable(); |
| 22 | if (!current_set_polling_and_test()) { | 22 | if (!current_set_polling_and_test()) { |
| 23 | unsigned int loop_count = 0; | 23 | unsigned int loop_count = 0; |
| 24 | u64 limit = TICK_USEC; | 24 | u64 limit = TICK_NSEC; |
| 25 | int i; | 25 | int i; |
| 26 | 26 | ||
| 27 | for (i = 1; i < drv->state_count; i++) { | 27 | for (i = 1; i < drv->state_count; i++) { |
| @@ -692,6 +692,7 @@ config CRYPTO_DEV_BCM_SPU · 691 unmodified lines | |||
| 692 | depends on ARCH_BCM_IPROC | 692 | depends on ARCH_BCM_IPROC |
| 693 | depends on MAILBOX | 693 | depends on MAILBOX |
| 694 | default m | 694 | default m |
| 695 | select CRYPTO_AUTHENC | ||
| 695 | select CRYPTO_DES | 696 | select CRYPTO_DES |
| 696 | select CRYPTO_MD5 | 697 | select CRYPTO_MD5 |
| 697 | select CRYPTO_SHA1 | 698 | select CRYPTO_SHA1 |
| @@ -283,9 +283,9 @@ static u32 crypto4xx_put_pd_to_pdr(struct crypto4xx_device *dev, u32 idx) · 282 unmodified lines | |||
| 283 | */ | 283 | */ |
| 284 | static u32 crypto4xx_build_gdr(struct crypto4xx_device *dev) | 284 | static u32 crypto4xx_build_gdr(struct crypto4xx_device *dev) |
| 285 | { | 285 | { |
| 286 | dev->gdr = dma_zalloc_coherent(dev->core_dev->device, | 286 | dev->gdr = dma_alloc_coherent(dev->core_dev->device, |
| 287 | sizeof(struct ce_gd) * PPC4XX_NUM_GD, | 287 | sizeof(struct ce_gd) * PPC4XX_NUM_GD, |
| 288 | &dev->gdr_pa, GFP_ATOMIC); | 288 | &dev->gdr_pa, GFP_ATOMIC); |
| 289 | if (!dev->gdr) | 289 | if (!dev->gdr) |
| 290 | return -ENOMEM; | 290 | return -ENOMEM; |
| 291 | 291 | ||
| @@ -2845,44 +2845,28 @@ static int aead_authenc_setkey(struct crypto_aead *cipher, · 2844 unmodified lines | |||
| 2845 | struct spu_hw *spu = &iproc_priv.spu; | 2845 | struct spu_hw *spu = &iproc_priv.spu; |
| 2846 | struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher); | 2846 | struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher); |
| 2847 | struct crypto_tfm *tfm = crypto_aead_tfm(cipher); | 2847 | struct crypto_tfm *tfm = crypto_aead_tfm(cipher); |
| 2848 | struct rtattr *rta = (void *)key; | 2848 | struct crypto_authenc_keys keys; |
| 2849 | struct crypto_authenc_key_param *param; | 2849 | int ret; |
| 2850 | const u8 *origkey = key; | ||
| 2851 | const unsigned int origkeylen = keylen; | ||
| 2852 | |||
| 2853 | int ret = 0; | ||
| 2854 | 2850 | ||
| 2855 | flow_log("%s() aead:%p key:%p keylen:%u\n", __func__, cipher, key, | 2851 | flow_log("%s() aead:%p key:%p keylen:%u\n", __func__, cipher, key, |
| 2856 | keylen); | 2852 | keylen); |
| 2857 | flow_dump(" key: ", key, keylen); | 2853 | flow_dump(" key: ", key, keylen); |
| 2858 | 2854 | ||
| 2859 | if (!RTA_OK(rta, keylen)) | 2855 | ret = crypto_authenc_extractkeys(&keys, key, keylen); |
| 2860 | goto badkey; | 2856 | if (ret) |
| 2861 | if (rta->rta_type != CRYPTO_AUTHENC_KEYA_PARAM) | ||
| 2862 | goto badkey; | ||
| 2863 | if (RTA_PAYLOAD(rta) < sizeof(*param)) | ||
| 2864 | goto badkey; | 2857 | goto badkey; |
| 2865 | 2858 | ||
| 2866 | param = RTA_DATA(rta); | 2859 | if (keys.enckeylen > MAX_KEY_SIZE || |
| 2867 | ctx->enckeylen = be32_to_cpu(param->enckeylen); | 2860 | keys.authkeylen > MAX_KEY_SIZE) |
| 2868 | |||
| 2869 | key += RTA_ALIGN(rta->rta_len); | ||
| 2870 | keylen -= RTA_ALIGN(rta->rta_len); | ||
| 2871 | |||
| 2872 | if (keylen < ctx->enckeylen) | ||
| 2873 | goto badkey; | ||
| 2874 | if (ctx->enckeylen > MAX_KEY_SIZE) | ||
| 2875 | goto badkey; | 2861 | goto badkey; |
| 2876 | 2862 | ||
| 2877 | ctx->authkeylen = keylen - ctx->enckeylen; | 2863 | ctx->enckeylen = keys.enckeylen; |
| 2878 | 2864 | ctx->authkeylen = keys.authkeylen; | |
| 2879 | if (ctx->authkeylen > MAX_KEY_SIZE) | ||
| 2880 | goto badkey; | ||
| 2881 | 2865 | ||
| 2882 | memcpy(ctx->enckey, key + ctx->authkeylen, ctx->enckeylen); | 2866 | memcpy(ctx->enckey, keys.enckey, keys.enckeylen); |
| 2883 | /* May end up padding auth key. So make sure it's zeroed. */ | 2867 | /* May end up padding auth key. So make sure it's zeroed. */ |
| 2884 | memset(ctx->authkey, 0, sizeof(ctx->authkey)); | 2868 | memset(ctx->authkey, 0, sizeof(ctx->authkey)); |
| 2885 | memcpy(ctx->authkey, key, ctx->authkeylen); | 2869 | memcpy(ctx->authkey, keys.authkey, keys.authkeylen); |
| 2886 | 2870 | ||
| 2887 | switch (ctx->alg->cipher_info.alg) { | 2871 | switch (ctx->alg->cipher_info.alg) { |
| 2888 | case CIPHER_ALG_DES: | 2872 | case CIPHER_ALG_DES: |
| @@ -2890,7 +2874,7 @@ static int aead_authenc_setkey(struct crypto_aead *cipher, · 1 unmodified line | |||
| 2890 | u32 tmp[DES_EXPKEY_WORDS]; | 2874 | u32 tmp[DES_EXPKEY_WORDS]; |
| 2891 | u32 flags = CRYPTO_TFM_RES_WEAK_KEY; | 2875 | u32 flags = CRYPTO_TFM_RES_WEAK_KEY; |
| 2892 | 2876 | ||
| 2893 | if (des_ekey(tmp, key) == 0) { | 2877 | if (des_ekey(tmp, keys.enckey) == 0) { |
| 2894 | if (crypto_aead_get_flags(cipher) & | 2878 | if (crypto_aead_get_flags(cipher) & |
| 2895 | CRYPTO_TFM_REQ_WEAK_KEY) { | 2879 | CRYPTO_TFM_REQ_WEAK_KEY) { |
| 2896 | crypto_aead_set_flags(cipher, flags); | 2880 | crypto_aead_set_flags(cipher, flags); |
| @@ -2905,7 +2889,7 @@ static int aead_authenc_setkey(struct crypto_aead *cipher, · 8 unmodified lines | |||
| 2905 | break; | 2889 | break; |
| 2906 | case CIPHER_ALG_3DES: | 2890 | case CIPHER_ALG_3DES: |
| 2907 | if (ctx->enckeylen == (DES_KEY_SIZE * 3)) { | 2891 | if (ctx->enckeylen == (DES_KEY_SIZE * 3)) { |
| 2908 | const u32 *K = (const u32 *)key; | 2892 | const u32 *K = (const u32 *)keys.enckey; |
| 2909 | u32 flags = CRYPTO_TFM_RES_BAD_KEY_SCHED; | 2893 | u32 flags = CRYPTO_TFM_RES_BAD_KEY_SCHED; |
| 2910 | 2894 | ||
| 2911 | if (!((K[0] ^ K[2]) | (K[1] ^ K[3])) || | 2895 | if (!((K[0] ^ K[2]) | (K[1] ^ K[3])) || |
| @@ -2956,9 +2940,7 @@ static int aead_authenc_setkey(struct crypto_aead *cipher, · 44 unmodified lines | |||
| 2956 | ctx->fallback_cipher->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; | 2940 | ctx->fallback_cipher->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; |
| 2957 | ctx->fallback_cipher->base.crt_flags |= | 2941 | ctx->fallback_cipher->base.crt_flags |= |
| 2958 | tfm->crt_flags & CRYPTO_TFM_REQ_MASK; | 2942 | tfm->crt_flags & CRYPTO_TFM_REQ_MASK; |
| 2959 | ret = | 2943 | ret = crypto_aead_setkey(ctx->fallback_cipher, key, keylen); |
| 2960 | crypto_aead_setkey(ctx->fallback_cipher, origkey, | ||
| 2961 | origkeylen); | ||
| 2962 | if (ret) { | 2944 | if (ret) { |
| 2963 | flow_log(" fallback setkey() returned:%d\n", ret); | 2945 | flow_log(" fallback setkey() returned:%d\n", ret); |
| 2964 | tfm->crt_flags &= ~CRYPTO_TFM_RES_MASK; | 2946 | tfm->crt_flags &= ~CRYPTO_TFM_RES_MASK; |
| @@ -3476,7 +3476,7 @@ static int __init caam_algapi_init(void) · 3475 unmodified lines | |||
| 3476 | * Skip algorithms requiring message digests | 3476 | * Skip algorithms requiring message digests |
| 3477 | * if MD or MD size is not supported by device. | 3477 | * if MD or MD size is not supported by device. |
| 3478 | */ | 3478 | */ |
| 3479 | if ((c2_alg_sel & ~OP_ALG_ALGSEL_SUBMASK) == 0x40 && | 3479 | if (is_mdha(c2_alg_sel) && |
| 3480 | (!md_inst || t_alg->aead.maxauthsize > md_limit)) | 3480 | (!md_inst || t_alg->aead.maxauthsize > md_limit)) |
| 3481 | continue; | 3481 | continue; |
| 3482 | 3482 | ||
| @@ -1072,13 +1072,16 @@ static int ahash_final_no_ctx(struct ahash_request *req) · 1071 unmodified lines | |||
| 1072 | 1072 | ||
| 1073 | desc = edesc->hw_desc; | 1073 | desc = edesc->hw_desc; |
| 1074 | 1074 | ||
| 1075 | state->buf_dma = dma_map_single(jrdev, buf, buflen, DMA_TO_DEVICE); | 1075 | if (buflen) { |
| 1076 | if (dma_mapping_error(jrdev, state->buf_dma)) { | 1076 | state->buf_dma = dma_map_single(jrdev, buf, buflen, |
| 1077 | dev_err(jrdev, "unable to map src\n"); | 1077 | DMA_TO_DEVICE); |
| 1078 | goto unmap; | 1078 | if (dma_mapping_error(jrdev, state->buf_dma)) { |
| 1079 | } | 1079 | dev_err(jrdev, "unable to map src\n"); |
| 1080 | goto unmap; | ||
| 1081 | } | ||
| 1080 | 1082 | ||
| 1081 | append_seq_in_ptr(desc, state->buf_dma, buflen, 0); | 1083 | append_seq_in_ptr(desc, state->buf_dma, buflen, 0); |
| 1084 | } | ||
| 1082 | 1085 | ||
| 1083 | edesc->dst_dma = map_seq_out_ptr_result(desc, jrdev, req->result, | 1086 | edesc->dst_dma = map_seq_out_ptr_result(desc, jrdev, req->result, |
| 1084 | digestsize); | 1087 | digestsize); |
| @@ -1155,6 +1155,7 @@ · 1154 unmodified lines | |||
| 1155 | #define OP_ALG_ALGSEL_DES (0x20 << OP_ALG_ALGSEL_SHIFT) | 1155 | #define OP_ALG_ALGSEL_DES (0x20 << OP_ALG_ALGSEL_SHIFT) |
| 1156 | #define OP_ALG_ALGSEL_3DES (0x21 << OP_ALG_ALGSEL_SHIFT) | 1156 | #define OP_ALG_ALGSEL_3DES (0x21 << OP_ALG_ALGSEL_SHIFT) |
| 1157 | #define OP_ALG_ALGSEL_ARC4 (0x30 << OP_ALG_ALGSEL_SHIFT) | 1157 | #define OP_ALG_ALGSEL_ARC4 (0x30 << OP_ALG_ALGSEL_SHIFT) |
| 1158 | #define OP_ALG_CHA_MDHA (0x40 << OP_ALG_ALGSEL_SHIFT) | ||
| 1158 | #define OP_ALG_ALGSEL_MD5 (0x40 << OP_ALG_ALGSEL_SHIFT) | 1159 | #define OP_ALG_ALGSEL_MD5 (0x40 << OP_ALG_ALGSEL_SHIFT) |
| 1159 | #define OP_ALG_ALGSEL_SHA1 (0x41 << OP_ALG_ALGSEL_SHIFT) | 1160 | #define OP_ALG_ALGSEL_SHA1 (0x41 << OP_ALG_ALGSEL_SHIFT) |
| 1160 | #define OP_ALG_ALGSEL_SHA224 (0x42 << OP_ALG_ALGSEL_SHIFT) | 1161 | #define OP_ALG_ALGSEL_SHA224 (0x42 << OP_ALG_ALGSEL_SHIFT) |
| @@ -7,6 +7,9 @@ · 6 unmodified lines | |||
| 7 | 7 | ||
| 8 | #ifndef CAAM_ERROR_H | 8 | #ifndef CAAM_ERROR_H |
| 9 | #define CAAM_ERROR_H | 9 | #define CAAM_ERROR_H |
| 10 | |||
| 11 | #include "desc.h" | ||
| 12 | |||
| 10 | #define CAAM_ERROR_STR_MAX 302 | 13 | #define CAAM_ERROR_STR_MAX 302 |
| 11 | 14 | ||
| 12 | void caam_strstatus(struct device *dev, u32 status, bool qi_v2); | 15 | void caam_strstatus(struct device *dev, u32 status, bool qi_v2); |
| @@ -17,4 +20,10 @@ void caam_strstatus(struct device *dev, u32 status, bool qi_v2); · 4 unmodified lines | |||
| 17 | void caam_dump_sg(const char *level, const char *prefix_str, int prefix_type, | 20 | void caam_dump_sg(const char *level, const char *prefix_str, int prefix_type, |
| 18 | int rowsize, int groupsize, struct scatterlist *sg, | 21 | int rowsize, int groupsize, struct scatterlist *sg, |
| 19 | size_t tlen, bool ascii); | 22 | size_t tlen, bool ascii); |
| 23 | |||
| 24 | static inline bool is_mdha(u32 algtype) | ||
| 25 | { | ||
| 26 | return (algtype & OP_ALG_ALGSEL_MASK & ~OP_ALG_ALGSEL_SUBMASK) == | ||
| 27 | OP_ALG_CHA_MDHA; | ||
| 28 | } | ||
| 20 | #endif /* CAAM_ERROR_H */ | 29 | #endif /* CAAM_ERROR_H */ |
| @@ -278,8 +278,8 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae) · 277 unmodified lines | |||
| 278 | mcode->num_cores = is_ae ? 6 : 10; | 278 | mcode->num_cores = is_ae ? 6 : 10; |
| 279 | 279 | ||
| 280 | /* Allocate DMAable space */ | 280 | /* Allocate DMAable space */ |
| 281 | mcode->code = dma_zalloc_coherent(&cpt->pdev->dev, mcode->code_size, | 281 | mcode->code = dma_alloc_coherent(&cpt->pdev->dev, mcode->code_size, |
| 282 | &mcode->phys_base, GFP_KERNEL); | 282 | &mcode->phys_base, GFP_KERNEL); |
| 283 | if (!mcode->code) { | 283 | if (!mcode->code) { |
| 284 | dev_err(dev, "Unable to allocate space for microcode"); | 284 | dev_err(dev, "Unable to allocate space for microcode"); |
| 285 | ret = -ENOMEM; | 285 | ret = -ENOMEM; |
| @@ -236,9 +236,10 @@ static int alloc_command_queues(struct cpt_vf *cptvf, · 235 unmodified lines | |||
| 236 | 236 | ||
| 237 | c_size = (rem_q_size > qcsize_bytes) ? qcsize_bytes : | 237 | c_size = (rem_q_size > qcsize_bytes) ? qcsize_bytes : |
| 238 | rem_q_size; | 238 | rem_q_size; |
| 239 | curr->head = (u8 *)dma_zalloc_coherent(&pdev->dev, | 239 | curr->head = (u8 *)dma_alloc_coherent(&pdev->dev, |
| 240 | c_size + CPT_NEXT_CHUNK_PTR_SIZE, | 240 | c_size + CPT_NEXT_CHUNK_PTR_SIZE, |
| 241 | &curr->dma_addr, GFP_KERNEL); | 241 | &curr->dma_addr, |
| 242 | GFP_KERNEL); | ||
| 242 | if (!curr->head) { | 243 | if (!curr->head) { |
| 243 | dev_err(&pdev->dev, "Command Q (%d) chunk (%d) allocation failed\n", | 244 | dev_err(&pdev->dev, "Command Q (%d) chunk (%d) allocation failed\n", |
| 244 | i, queue->nchunks); | 245 | i, queue->nchunks); |
| @@ -25,9 +25,9 @@ static int nitrox_cmdq_init(struct nitrox_cmdq *cmdq, int align_bytes) · 24 unmodified lines | |||
| 25 | struct nitrox_device *ndev = cmdq->ndev; | 25 | struct nitrox_device *ndev = cmdq->ndev; |
| 26 | 26 | ||
| 27 | cmdq->qsize = (ndev->qlen * cmdq->instr_size) + align_bytes; | 27 | cmdq->qsize = (ndev->qlen * cmdq->instr_size) + align_bytes; |
| 28 | cmdq->unalign_base = dma_zalloc_coherent(DEV(ndev), cmdq->qsize, | 28 | cmdq->unalign_base = dma_alloc_coherent(DEV(ndev), cmdq->qsize, |
| 29 | &cmdq->unalign_dma, | 29 | &cmdq->unalign_dma, |
| 30 | GFP_KERNEL); | 30 | GFP_KERNEL); |
| 31 | if (!cmdq->unalign_base) | 31 | if (!cmdq->unalign_base) |
| 32 | return -ENOMEM; | 32 | return -ENOMEM; |
| 33 | 33 | ||
| @@ -537,6 +537,8 @@ static void process_response_list(struct nitrox_cmdq *cmdq) · 536 unmodified lines | |||
| 537 | struct nitrox_device *ndev = cmdq->ndev; | 537 | struct nitrox_device *ndev = cmdq->ndev; |
| 538 | struct nitrox_softreq *sr; | 538 | struct nitrox_softreq *sr; |
| 539 | int req_completed = 0, err = 0, budget; | 539 | int req_completed = 0, err = 0, budget; |
| 540 | completion_t callback; | ||
| 541 | void *cb_arg; | ||
| 540 | 542 | ||
| 541 | /* check all pending requests */ | 543 | /* check all pending requests */ |
| 542 | budget = atomic_read(&cmdq->pending_count); | 544 | budget = atomic_read(&cmdq->pending_count); |
| @@ -564,13 +566,13 @@ static void process_response_list(struct nitrox_cmdq *cmdq) · 21 unmodified lines | |||
| 564 | smp_mb__after_atomic(); | 566 | smp_mb__after_atomic(); |
| 565 | /* remove from response list */ | 567 | /* remove from response list */ |
| 566 | response_list_del(sr, cmdq); | 568 | response_list_del(sr, cmdq); |
| 567 | |||
| 568 | /* ORH error code */ | 569 | /* ORH error code */ |
| 569 | err = READ_ONCE(*sr->resp.orh) & 0xff; | 570 | err = READ_ONCE(*sr->resp.orh) & 0xff; |
| 571 | callback = sr->callback; | ||
| 572 | cb_arg = sr->cb_arg; | ||
| 570 | softreq_destroy(sr); | 573 | softreq_destroy(sr); |
| 571 | 574 | if (callback) | |
| 572 | if (sr->callback) | 575 | callback(cb_arg, err); |
| 573 | sr->callback(sr->cb_arg, err); | ||
| 574 | 576 | ||
| 575 | req_completed++; | 577 | req_completed++; |
| 576 | } | 578 | } |
| @@ -822,9 +822,9 @@ static int ccp5_init(struct ccp_device *ccp) · 821 unmodified lines | |||
| 822 | /* Page alignment satisfies our needs for N <= 128 */ | 822 | /* Page alignment satisfies our needs for N <= 128 */ |
| 823 | BUILD_BUG_ON(COMMANDS_PER_QUEUE > 128); | 823 | BUILD_BUG_ON(COMMANDS_PER_QUEUE > 128); |
| 824 | cmd_q->qsize = Q_SIZE(Q_DESC_SIZE); | 824 | cmd_q->qsize = Q_SIZE(Q_DESC_SIZE); |
| 825 | cmd_q->qbase = dma_zalloc_coherent(dev, cmd_q->qsize, | 825 | cmd_q->qbase = dma_alloc_coherent(dev, cmd_q->qsize, |
| 826 | &cmd_q->qbase_dma, | 826 | &cmd_q->qbase_dma, |
| 827 | GFP_KERNEL); | 827 | GFP_KERNEL); |
| 828 | if (!cmd_q->qbase) { | 828 | if (!cmd_q->qbase) { |
| 829 | dev_err(dev, "unable to allocate command queue\n"); | 829 | dev_err(dev, "unable to allocate command queue\n"); |
| 830 | ret = -ENOMEM; | 830 | ret = -ENOMEM; |
| @@ -549,13 +549,12 @@ static int cc_aead_setkey(struct crypto_aead *tfm, const u8 *key, · 548 unmodified lines | |||
| 549 | unsigned int keylen) | 549 | unsigned int keylen) |
| 550 | { | 550 | { |
| 551 | struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); | 551 | struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); |
| 552 | struct rtattr *rta = (struct rtattr *)key; | ||
| 553 | struct cc_crypto_req cc_req = {}; | 552 | struct cc_crypto_req cc_req = {}; |
| 554 | struct crypto_authenc_key_param *param; | ||
| 555 | struct cc_hw_desc desc[MAX_AEAD_SETKEY_SEQ]; | 553 | struct cc_hw_desc desc[MAX_AEAD_SETKEY_SEQ]; |
| 556 | int rc = -EINVAL; | ||
| 557 | unsigned int seq_len = 0; | 554 | unsigned int seq_len = 0; |
| 558 | struct device *dev = drvdata_to_dev(ctx->drvdata); | 555 | struct device *dev = drvdata_to_dev(ctx->drvdata); |
| 556 | const u8 *enckey, *authkey; | ||
| 557 | int rc; | ||
| 559 | 558 | ||
| 560 | dev_dbg(dev, "Setting key in context @%p for %s. key=%p keylen=%u\n", | 559 | dev_dbg(dev, "Setting key in context @%p for %s. key=%p keylen=%u\n", |
| 561 | ctx, crypto_tfm_alg_name(crypto_aead_tfm(tfm)), key, keylen); | 560 | ctx, crypto_tfm_alg_name(crypto_aead_tfm(tfm)), key, keylen); |
| @@ -563,35 +562,33 @@ static int cc_aead_setkey(struct crypto_aead *tfm, const u8 *key, · 1 unmodified line | |||
| 563 | /* STAT_PHASE_0: Init and sanity checks */ | 562 | /* STAT_PHASE_0: Init and sanity checks */ |
| 564 | 563 | ||
| 565 | if (ctx->auth_mode != DRV_HASH_NULL) { /* authenc() alg. */ | 564 | if (ctx->auth_mode != DRV_HASH_NULL) { /* authenc() alg. */ |
| 566 | if (!RTA_OK(rta, keylen)) | 565 | struct crypto_authenc_keys keys; |
| 567 | goto badkey; | 566 | |
| 568 | if (rta->rta_type != CRYPTO_AUTHENC_KEYA_PARAM) | 567 | rc = crypto_authenc_extractkeys(&keys, key, keylen); |
| 569 | goto badkey; | 568 | if (rc) |
| 570 | if (RTA_PAYLOAD(rta) < sizeof(*param)) | ||
| 571 | goto badkey; | ||
| 572 | param = RTA_DATA(rta); | ||
| 573 | ctx->enc_keylen = be32_to_cpu(param->enckeylen); | ||
| 574 | key += RTA_ALIGN(rta->rta_len); | ||
| 575 | keylen -= RTA_ALIGN(rta->rta_len); | ||
| 576 | if (keylen < ctx->enc_keylen) | ||
| 577 | goto badkey; | 569 | goto badkey; |
| 578 | ctx->auth_keylen = keylen - ctx->enc_keylen; | 570 | enckey = keys.enckey; |
| 571 | authkey = keys.authkey; | ||
| 572 | ctx->enc_keylen = keys.enckeylen; | ||
| 573 | ctx->auth_keylen = keys.authkeylen; | ||
| 579 | 574 | ||
| 580 | if (ctx->cipher_mode == DRV_CIPHER_CTR) { | 575 | if (ctx->cipher_mode == DRV_CIPHER_CTR) { |
| 581 | /* the nonce is stored in bytes at end of key */ | 576 | /* the nonce is stored in bytes at end of key */ |
| 577 | rc = -EINVAL; | ||
| 582 | if (ctx->enc_keylen < | 578 | if (ctx->enc_keylen < |
| 583 | (AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE)) | 579 | (AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE)) |
| 584 | goto badkey; | 580 | goto badkey; |
| 585 | /* Copy nonce from last 4 bytes in CTR key to | 581 | /* Copy nonce from last 4 bytes in CTR key to |
| 586 | * first 4 bytes in CTR IV | 582 | * first 4 bytes in CTR IV |
| 587 | */ | 583 | */ |
| 588 | memcpy(ctx->ctr_nonce, key + ctx->auth_keylen + | 584 | memcpy(ctx->ctr_nonce, enckey + ctx->enc_keylen - |
| 589 | ctx->enc_keylen - CTR_RFC3686_NONCE_SIZE, | 585 | CTR_RFC3686_NONCE_SIZE, CTR_RFC3686_NONCE_SIZE); |
| 590 | CTR_RFC3686_NONCE_SIZE); | ||
| 591 | /* Set CTR key size */ | 586 | /* Set CTR key size */ |
| 592 | ctx->enc_keylen -= CTR_RFC3686_NONCE_SIZE; | 587 | ctx->enc_keylen -= CTR_RFC3686_NONCE_SIZE; |
| 593 | } | 588 | } |
| 594 | } else { /* non-authenc - has just one key */ | 589 | } else { /* non-authenc - has just one key */ |
| 590 | enckey = key; | ||
| 591 | authkey = NULL; | ||
| 595 | ctx->enc_keylen = keylen; | 592 | ctx->enc_keylen = keylen; |
| 596 | ctx->auth_keylen = 0; | 593 | ctx->auth_keylen = 0; |
| 597 | } | 594 | } |
| @@ -603,13 +600,14 @@ static int cc_aead_setkey(struct crypto_aead *tfm, const u8 *key, · 5 unmodified lines | |||
| 603 | /* STAT_PHASE_1: Copy key to ctx */ | 600 | /* STAT_PHASE_1: Copy key to ctx */ |
| 604 | 601 | ||
| 605 | /* Get key material */ | 602 | /* Get key material */ |
| 606 | memcpy(ctx->enckey, key + ctx->auth_keylen, ctx->enc_keylen); | 603 | memcpy(ctx->enckey, enckey, ctx->enc_keylen); |
| 607 | if (ctx->enc_keylen == 24) | 604 | if (ctx->enc_keylen == 24) |
| 608 | memset(ctx->enckey + 24, 0, CC_AES_KEY_SIZE_MAX - 24); | 605 | memset(ctx->enckey + 24, 0, CC_AES_KEY_SIZE_MAX - 24); |
| 609 | if (ctx->auth_mode == DRV_HASH_XCBC_MAC) { | 606 | if (ctx->auth_mode == DRV_HASH_XCBC_MAC) { |
| 610 | memcpy(ctx->auth_state.xcbc.xcbc_keys, key, ctx->auth_keylen); | 607 | memcpy(ctx->auth_state.xcbc.xcbc_keys, authkey, |
| 608 | ctx->auth_keylen); | ||
| 611 | } else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC */ | 609 | } else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC */ |
| 612 | rc = cc_get_plain_hmac_key(tfm, key, ctx->auth_keylen); | 610 | rc = cc_get_plain_hmac_key(tfm, authkey, ctx->auth_keylen); |
| 613 | if (rc) | 611 | if (rc) |
| 614 | goto badkey; | 612 | goto badkey; |
| 615 | } | 613 | } |
| @@ -241,8 +241,8 @@ static int sec_alg_skcipher_setkey(struct crypto_skcipher *tfm, · 240 unmodified lines | |||
| 241 | memset(ctx->key, 0, SEC_MAX_CIPHER_KEY); | 241 | memset(ctx->key, 0, SEC_MAX_CIPHER_KEY); |
| 242 | } else { | 242 | } else { |
| 243 | /* new key */ | 243 | /* new key */ |
| 244 | ctx->key = dma_zalloc_coherent(dev, SEC_MAX_CIPHER_KEY, | 244 | ctx->key = dma_alloc_coherent(dev, SEC_MAX_CIPHER_KEY, |
| 245 | &ctx->pkey, GFP_KERNEL); | 245 | &ctx->pkey, GFP_KERNEL); |
| 246 | if (!ctx->key) { | 246 | if (!ctx->key) { |
| 247 | mutex_unlock(&ctx->lock); | 247 | mutex_unlock(&ctx->lock); |
| 248 | return -ENOMEM; | 248 | return -ENOMEM; |
| @@ -1082,9 +1082,8 @@ static int sec_queue_res_cfg(struct sec_queue *queue) · 1081 unmodified lines | |||
| 1082 | struct sec_queue_ring_db *ring_db = &queue->ring_db; | 1082 | struct sec_queue_ring_db *ring_db = &queue->ring_db; |
| 1083 | int ret; | 1083 | int ret; |
| 1084 | 1084 | ||
| 1085 | ring_cmd->vaddr = dma_zalloc_coherent(dev, SEC_Q_CMD_SIZE, | 1085 | ring_cmd->vaddr = dma_alloc_coherent(dev, SEC_Q_CMD_SIZE, |
| 1086 | &ring_cmd->paddr, | 1086 | &ring_cmd->paddr, GFP_KERNEL); |
| 1087 | GFP_KERNEL); | ||
| 1088 | if (!ring_cmd->vaddr) | 1087 | if (!ring_cmd->vaddr) |
| 1089 | return -ENOMEM; | 1088 | return -ENOMEM; |
| 1090 | 1089 | ||
| @@ -1092,17 +1091,15 @@ static int sec_queue_res_cfg(struct sec_queue *queue) · 1 unmodified line | |||
| 1092 | mutex_init(&ring_cmd->lock); | 1091 | mutex_init(&ring_cmd->lock); |
| 1093 | ring_cmd->callback = sec_alg_callback; | 1092 | ring_cmd->callback = sec_alg_callback; |
| 1094 | 1093 | ||
| 1095 | ring_cq->vaddr = dma_zalloc_coherent(dev, SEC_Q_CQ_SIZE, | 1094 | ring_cq->vaddr = dma_alloc_coherent(dev, SEC_Q_CQ_SIZE, |
| 1096 | &ring_cq->paddr, | 1095 | &ring_cq->paddr, GFP_KERNEL); |
| 1097 | GFP_KERNEL); | ||
| 1098 | if (!ring_cq->vaddr) { | 1096 | if (!ring_cq->vaddr) { |
| 1099 | ret = -ENOMEM; | 1097 | ret = -ENOMEM; |
| 1100 | goto err_free_ring_cmd; | 1098 | goto err_free_ring_cmd; |
| 1101 | } | 1099 | } |
| 1102 | 1100 | ||
| 1103 | ring_db->vaddr = dma_zalloc_coherent(dev, SEC_Q_DB_SIZE, | 1101 | ring_db->vaddr = dma_alloc_coherent(dev, SEC_Q_DB_SIZE, |
| 1104 | &ring_db->paddr, | 1102 | &ring_db->paddr, GFP_KERNEL); |
| 1105 | GFP_KERNEL); | ||
| 1106 | if (!ring_db->vaddr) { | 1103 | if (!ring_db->vaddr) { |
| 1107 | ret = -ENOMEM; | 1104 | ret = -ENOMEM; |
| 1108 | goto err_free_ring_cq; | 1105 | goto err_free_ring_cq; |
| @@ -260,9 +260,9 @@ static int setup_crypt_desc(void) · 259 unmodified lines | |||
| 260 | { | 260 | { |
| 261 | struct device *dev = &pdev->dev; | 261 | struct device *dev = &pdev->dev; |
| 262 | BUILD_BUG_ON(sizeof(struct crypt_ctl) != 64); | 262 | BUILD_BUG_ON(sizeof(struct crypt_ctl) != 64); |
| 263 | crypt_virt = dma_zalloc_coherent(dev, | 263 | crypt_virt = dma_alloc_coherent(dev, |
| 264 | NPE_QLEN * sizeof(struct crypt_ctl), | 264 | NPE_QLEN * sizeof(struct crypt_ctl), |
| 265 | &crypt_phys, GFP_ATOMIC); | 265 | &crypt_phys, GFP_ATOMIC); |
| 266 | if (!crypt_virt) | 266 | if (!crypt_virt) |
| 267 | return -ENOMEM; | 267 | return -ENOMEM; |
| 268 | return 0; | 268 | return 0; |
| @@ -453,17 +453,17 @@ static int mtk_desc_ring_alloc(struct mtk_cryp *cryp) · 452 unmodified lines | |||
| 453 | if (!ring[i]) | 453 | if (!ring[i]) |
| 454 | goto err_cleanup; | 454 | goto err_cleanup; |
| 455 | 455 | ||
| 456 | ring[i]->cmd_base = dma_zalloc_coherent(cryp->dev, | 456 | ring[i]->cmd_base = dma_alloc_coherent(cryp->dev, |
| 457 | MTK_DESC_RING_SZ, | 457 | MTK_DESC_RING_SZ, |
| 458 | &ring[i]->cmd_dma, | 458 | &ring[i]->cmd_dma, |
| 459 | GFP_KERNEL); | 459 | GFP_KERNEL); |
| 460 | if (!ring[i]->cmd_base) | 460 | if (!ring[i]->cmd_base) |
| 461 | goto err_cleanup; | 461 | goto err_cleanup; |
| 462 | 462 | ||
| 463 | ring[i]->res_base = dma_zalloc_coherent(cryp->dev, | 463 | ring[i]->res_base = dma_alloc_coherent(cryp->dev, |
| 464 | MTK_DESC_RING_SZ, | 464 | MTK_DESC_RING_SZ, |
| 465 | &ring[i]->res_dma, | 465 | &ring[i]->res_dma, |
| 466 | GFP_KERNEL); | 466 | GFP_KERNEL); |
| 467 | if (!ring[i]->res_base) | 467 | if (!ring[i]->res_base) |
| 468 | goto err_cleanup; | 468 | goto err_cleanup; |
| 469 | 469 | ||
| @@ -244,18 +244,18 @@ int adf_init_admin_comms(struct adf_accel_dev *accel_dev) · 243 unmodified lines | |||
| 244 | dev_to_node(&GET_DEV(accel_dev))); | 244 | dev_to_node(&GET_DEV(accel_dev))); |
| 245 | if (!admin) | 245 | if (!admin) |
| 246 | return -ENOMEM; | 246 | return -ENOMEM; |
| 247 | admin->virt_addr = dma_zalloc_coherent(&GET_DEV(accel_dev), PAGE_SIZE, | 247 | admin->virt_addr = dma_alloc_coherent(&GET_DEV(accel_dev), PAGE_SIZE, |
| 248 | &admin->phy_addr, GFP_KERNEL); | 248 | &admin->phy_addr, GFP_KERNEL); |
| 249 | if (!admin->virt_addr) { | 249 | if (!admin->virt_addr) { |
| 250 | dev_err(&GET_DEV(accel_dev), "Failed to allocate dma buff\n"); | 250 | dev_err(&GET_DEV(accel_dev), "Failed to allocate dma buff\n"); |
| 251 | kfree(admin); | 251 | kfree(admin); |
| 252 | return -ENOMEM; | 252 | return -ENOMEM; |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | admin->virt_tbl_addr = dma_zalloc_coherent(&GET_DEV(accel_dev), | 255 | admin->virt_tbl_addr = dma_alloc_coherent(&GET_DEV(accel_dev), |
| 256 | PAGE_SIZE, | 256 | PAGE_SIZE, |
| 257 | &admin->const_tbl_addr, | 257 | &admin->const_tbl_addr, |
| 258 | GFP_KERNEL); | 258 | GFP_KERNEL); |
| 259 | if (!admin->virt_tbl_addr) { | 259 | if (!admin->virt_tbl_addr) { |
| 260 | dev_err(&GET_DEV(accel_dev), "Failed to allocate const_tbl\n"); | 260 | dev_err(&GET_DEV(accel_dev), "Failed to allocate const_tbl\n"); |
| 261 | dma_free_coherent(&GET_DEV(accel_dev), PAGE_SIZE, | 261 | dma_free_coherent(&GET_DEV(accel_dev), PAGE_SIZE, |
| @@ -601,15 +601,15 @@ static int qat_alg_aead_setkey(struct crypto_aead *tfm, const uint8_t *key, · 600 unmodified lines | |||
| 601 | 601 | ||
| 602 | dev = &GET_DEV(inst->accel_dev); | 602 | dev = &GET_DEV(inst->accel_dev); |
| 603 | ctx->inst = inst; | 603 | ctx->inst = inst; |
| 604 | ctx->enc_cd = dma_zalloc_coherent(dev, sizeof(*ctx->enc_cd), | 604 | ctx->enc_cd = dma_alloc_coherent(dev, sizeof(*ctx->enc_cd), |
| 605 | &ctx->enc_cd_paddr, | 605 | &ctx->enc_cd_paddr, |
| 606 | GFP_ATOMIC); | 606 | GFP_ATOMIC); |
| 607 | if (!ctx->enc_cd) { | 607 | if (!ctx->enc_cd) { |
| 608 | return -ENOMEM; | 608 | return -ENOMEM; |
| 609 | } | 609 | } |
| 610 | ctx->dec_cd = dma_zalloc_coherent(dev, sizeof(*ctx->dec_cd), | 610 | ctx->dec_cd = dma_alloc_coherent(dev, sizeof(*ctx->dec_cd), |
| 611 | &ctx->dec_cd_paddr, | 611 | &ctx->dec_cd_paddr, |
| 612 | GFP_ATOMIC); | 612 | GFP_ATOMIC); |
| 613 | if (!ctx->dec_cd) { | 613 | if (!ctx->dec_cd) { |
| 614 | goto out_free_enc; | 614 | goto out_free_enc; |
| 615 | } | 615 | } |
| @@ -933,16 +933,16 @@ static int qat_alg_ablkcipher_setkey(struct crypto_ablkcipher *tfm, · 317 unmodified lines | |||
| 933 | 933 | ||
| 934 | dev = &GET_DEV(inst->accel_dev); | 934 | dev = &GET_DEV(inst->accel_dev); |
| 935 | ctx->inst = inst; | 935 | ctx->inst = inst; |
| 936 | ctx->enc_cd = dma_zalloc_coherent(dev, sizeof(*ctx->enc_cd), | 936 | ctx->enc_cd = dma_alloc_coherent(dev, sizeof(*ctx->enc_cd), |
| 937 | &ctx->enc_cd_paddr, | 937 | &ctx->enc_cd_paddr, |
| 938 | GFP_ATOMIC); | 938 | GFP_ATOMIC); |
| 939 | if (!ctx->enc_cd) { | 939 | if (!ctx->enc_cd) { |
| 940 | spin_unlock(&ctx->lock); | 940 | spin_unlock(&ctx->lock); |
| 941 | return -ENOMEM; | 941 | return -ENOMEM; |
| 942 | } | 942 | } |
| 943 | ctx->dec_cd = dma_zalloc_coherent(dev, sizeof(*ctx->dec_cd), | 943 | ctx->dec_cd = dma_alloc_coherent(dev, sizeof(*ctx->dec_cd), |
| 944 | &ctx->dec_cd_paddr, | 944 | &ctx->dec_cd_paddr, |
| 945 | GFP_ATOMIC); | 945 | GFP_ATOMIC); |
| 946 | if (!ctx->dec_cd) { | 946 | if (!ctx->dec_cd) { |
| 947 | spin_unlock(&ctx->lock); | 947 | spin_unlock(&ctx->lock); |
| 948 | goto out_free_enc; | 948 | goto out_free_enc; |
| @@ -332,10 +332,10 @@ static int qat_dh_compute_value(struct kpp_request *req) · 331 unmodified lines | |||
| 332 | } else { | 332 | } else { |
| 333 | int shift = ctx->p_size - req->src_len; | 333 | int shift = ctx->p_size - req->src_len; |
| 334 | 334 | ||
| 335 | qat_req->src_align = dma_zalloc_coherent(dev, | 335 | qat_req->src_align = dma_alloc_coherent(dev, |
| 336 | ctx->p_size, | 336 | ctx->p_size, |
| 337 | &qat_req->in.dh.in.b, | 337 | &qat_req->in.dh.in.b, |
| 338 | GFP_KERNEL); | 338 | GFP_KERNEL); |
| 339 | if (unlikely(!qat_req->src_align)) | 339 | if (unlikely(!qat_req->src_align)) |
| 340 | return ret; | 340 | return ret; |
| 341 | 341 | ||
| @@ -360,9 +360,9 @@ static int qat_dh_compute_value(struct kpp_request *req) · 18 unmodified lines | |||
| 360 | goto unmap_src; | 360 | goto unmap_src; |
| 361 | 361 | ||
| 362 | } else { | 362 | } else { |
| 363 | qat_req->dst_align = dma_zalloc_coherent(dev, ctx->p_size, | 363 | qat_req->dst_align = dma_alloc_coherent(dev, ctx->p_size, |
| 364 | &qat_req->out.dh.r, | 364 | &qat_req->out.dh.r, |
| 365 | GFP_KERNEL); | 365 | GFP_KERNEL); |
| 366 | if (unlikely(!qat_req->dst_align)) | 366 | if (unlikely(!qat_req->dst_align)) |
| 367 | goto unmap_src; | 367 | goto unmap_src; |
| 368 | } | 368 | } |
| @@ -447,7 +447,7 @@ static int qat_dh_set_params(struct qat_dh_ctx *ctx, struct dh *params) · 78 unmodified lines | |||
| 447 | return -EINVAL; | 447 | return -EINVAL; |
| 448 | 448 | ||
| 449 | ctx->p_size = params->p_size; | 449 | ctx->p_size = params->p_size; |
| 450 | ctx->p = dma_zalloc_coherent(dev, ctx->p_size, &ctx->dma_p, GFP_KERNEL); | 450 | ctx->p = dma_alloc_coherent(dev, ctx->p_size, &ctx->dma_p, GFP_KERNEL); |
| 451 | if (!ctx->p) | 451 | if (!ctx->p) |
| 452 | return -ENOMEM; | 452 | return -ENOMEM; |
| 453 | memcpy(ctx->p, params->p, ctx->p_size); | 453 | memcpy(ctx->p, params->p, ctx->p_size); |
| @@ -458,7 +458,7 @@ static int qat_dh_set_params(struct qat_dh_ctx *ctx, struct dh *params) · 4 unmodified lines | |||
| 458 | return 0; | 458 | return 0; |
| 459 | } | 459 | } |
| 460 | 460 | ||
| 461 | ctx->g = dma_zalloc_coherent(dev, ctx->p_size, &ctx->dma_g, GFP_KERNEL); | 461 | ctx->g = dma_alloc_coherent(dev, ctx->p_size, &ctx->dma_g, GFP_KERNEL); |
| 462 | if (!ctx->g) | 462 | if (!ctx->g) |
| 463 | return -ENOMEM; | 463 | return -ENOMEM; |
| 464 | memcpy(ctx->g + (ctx->p_size - params->g_size), params->g, | 464 | memcpy(ctx->g + (ctx->p_size - params->g_size), params->g, |
| @@ -503,8 +503,8 @@ static int qat_dh_set_secret(struct crypto_kpp *tfm, const void *buf, · 38 unmodified lines | |||
| 503 | if (ret < 0) | 503 | if (ret < 0) |
| 504 | goto err_clear_ctx; | 504 | goto err_clear_ctx; |
| 505 | 505 | ||
| 506 | ctx->xa = dma_zalloc_coherent(dev, ctx->p_size, &ctx->dma_xa, | 506 | ctx->xa = dma_alloc_coherent(dev, ctx->p_size, &ctx->dma_xa, |
| 507 | GFP_KERNEL); | 507 | GFP_KERNEL); |
| 508 | if (!ctx->xa) { | 508 | if (!ctx->xa) { |
| 509 | ret = -ENOMEM; | 509 | ret = -ENOMEM; |
| 510 | goto err_clear_ctx; | 510 | goto err_clear_ctx; |
| @@ -737,9 +737,9 @@ static int qat_rsa_enc(struct akcipher_request *req) · 226 unmodified lines | |||
| 737 | } else { | 737 | } else { |
| 738 | int shift = ctx->key_sz - req->src_len; | 738 | int shift = ctx->key_sz - req->src_len; |
| 739 | 739 | ||
| 740 | qat_req->src_align = dma_zalloc_coherent(dev, ctx->key_sz, | 740 | qat_req->src_align = dma_alloc_coherent(dev, ctx->key_sz, |
| 741 | &qat_req->in.rsa.enc.m, | 741 | &qat_req->in.rsa.enc.m, |
| 742 | GFP_KERNEL); | 742 | GFP_KERNEL); |
| 743 | if (unlikely(!qat_req->src_align)) | 743 | if (unlikely(!qat_req->src_align)) |
| 744 | return ret; | 744 | return ret; |
| 745 | 745 | ||
| @@ -756,9 +756,9 @@ static int qat_rsa_enc(struct akcipher_request *req) · 10 unmodified lines | |||
| 756 | goto unmap_src; | 756 | goto unmap_src; |
| 757 | 757 | ||
| 758 | } else { | 758 | } else { |
| 759 | qat_req->dst_align = dma_zalloc_coherent(dev, ctx->key_sz, | 759 | qat_req->dst_align = dma_alloc_coherent(dev, ctx->key_sz, |
| 760 | &qat_req->out.rsa.enc.c, | 760 | &qat_req->out.rsa.enc.c, |
| 761 | GFP_KERNEL); | 761 | GFP_KERNEL); |
| 762 | if (unlikely(!qat_req->dst_align)) | 762 | if (unlikely(!qat_req->dst_align)) |
| 763 | goto unmap_src; | 763 | goto unmap_src; |
| 764 | 764 | ||
| @@ -881,9 +881,9 @@ static int qat_rsa_dec(struct akcipher_request *req) · 116 unmodified lines | |||
| 881 | } else { | 881 | } else { |
| 882 | int shift = ctx->key_sz - req->src_len; | 882 | int shift = ctx->key_sz - req->src_len; |
| 883 | 883 | ||
| 884 | qat_req->src_align = dma_zalloc_coherent(dev, ctx->key_sz, | 884 | qat_req->src_align = dma_alloc_coherent(dev, ctx->key_sz, |
| 885 | &qat_req->in.rsa.dec.c, | 885 | &qat_req->in.rsa.dec.c, |
| 886 | GFP_KERNEL); | 886 | GFP_KERNEL); |
| 887 | if (unlikely(!qat_req->src_align)) | 887 | if (unlikely(!qat_req->src_align)) |
| 888 | return ret; | 888 | return ret; |
| 889 | 889 | ||
| @@ -900,9 +900,9 @@ static int qat_rsa_dec(struct akcipher_request *req) · 10 unmodified lines | |||
| 900 | goto unmap_src; | 900 | goto unmap_src; |
| 901 | 901 | ||
| 902 | } else { | 902 | } else { |
| 903 | qat_req->dst_align = dma_zalloc_coherent(dev, ctx->key_sz, | 903 | qat_req->dst_align = dma_alloc_coherent(dev, ctx->key_sz, |
| 904 | &qat_req->out.rsa.dec.m, | 904 | &qat_req->out.rsa.dec.m, |
| 905 | GFP_KERNEL); | 905 | GFP_KERNEL); |
| 906 | if (unlikely(!qat_req->dst_align)) | 906 | if (unlikely(!qat_req->dst_align)) |
| 907 | goto unmap_src; | 907 | goto unmap_src; |
| 908 | 908 | ||
| @@ -989,7 +989,7 @@ static int qat_rsa_set_n(struct qat_rsa_ctx *ctx, const char *value, · 80 unmodified lines | |||
| 989 | goto err; | 989 | goto err; |
| 990 | 990 | ||
| 991 | ret = -ENOMEM; | 991 | ret = -ENOMEM; |
| 992 | ctx->n = dma_zalloc_coherent(dev, ctx->key_sz, &ctx->dma_n, GFP_KERNEL); | 992 | ctx->n = dma_alloc_coherent(dev, ctx->key_sz, &ctx->dma_n, GFP_KERNEL); |
| 993 | if (!ctx->n) | 993 | if (!ctx->n) |
| 994 | goto err; | 994 | goto err; |
| 995 | 995 | ||
| @@ -1018,7 +1018,7 @@ static int qat_rsa_set_e(struct qat_rsa_ctx *ctx, const char *value, · 22 unmodified lines | |||
| 1018 | return -EINVAL; | 1018 | return -EINVAL; |
| 1019 | } | 1019 | } |
| 1020 | 1020 | ||
| 1021 | ctx->e = dma_zalloc_coherent(dev, ctx->key_sz, &ctx->dma_e, GFP_KERNEL); | 1021 | ctx->e = dma_alloc_coherent(dev, ctx->key_sz, &ctx->dma_e, GFP_KERNEL); |
| 1022 | if (!ctx->e) | 1022 | if (!ctx->e) |
| 1023 | return -ENOMEM; | 1023 | return -ENOMEM; |
| 1024 | 1024 | ||
| @@ -1044,7 +1044,7 @@ static int qat_rsa_set_d(struct qat_rsa_ctx *ctx, const char *value, · 19 unmodified lines | |||
| 1044 | goto err; | 1044 | goto err; |
| 1045 | 1045 | ||
| 1046 | ret = -ENOMEM; | 1046 | ret = -ENOMEM; |
| 1047 | ctx->d = dma_zalloc_coherent(dev, ctx->key_sz, &ctx->dma_d, GFP_KERNEL); | 1047 | ctx->d = dma_alloc_coherent(dev, ctx->key_sz, &ctx->dma_d, GFP_KERNEL); |
| 1048 | if (!ctx->d) | 1048 | if (!ctx->d) |
| 1049 | goto err; | 1049 | goto err; |
| 1050 | 1050 | ||
| @@ -1077,7 +1077,7 @@ static void qat_rsa_setkey_crt(struct qat_rsa_ctx *ctx, struct rsa_key *rsa_key) · 26 unmodified lines | |||
| 1077 | qat_rsa_drop_leading_zeros(&ptr, &len); | 1077 | qat_rsa_drop_leading_zeros(&ptr, &len); |
| 1078 | if (!len) | 1078 | if (!len) |
| 1079 | goto err; | 1079 | goto err; |
| 1080 | ctx->p = dma_zalloc_coherent(dev, half_key_sz, &ctx->dma_p, GFP_KERNEL); | 1080 | ctx->p = dma_alloc_coherent(dev, half_key_sz, &ctx->dma_p, GFP_KERNEL); |
| 1081 | if (!ctx->p) | 1081 | if (!ctx->p) |
| 1082 | goto err; | 1082 | goto err; |
| 1083 | memcpy(ctx->p + (half_key_sz - len), ptr, len); | 1083 | memcpy(ctx->p + (half_key_sz - len), ptr, len); |
| @@ -1088,7 +1088,7 @@ static void qat_rsa_setkey_crt(struct qat_rsa_ctx *ctx, struct rsa_key *rsa_key) · 4 unmodified lines | |||
| 1088 | qat_rsa_drop_leading_zeros(&ptr, &len); | 1088 | qat_rsa_drop_leading_zeros(&ptr, &len); |
| 1089 | if (!len) | 1089 | if (!len) |
| 1090 | goto free_p; | 1090 | goto free_p; |
| 1091 | ctx->q = dma_zalloc_coherent(dev, half_key_sz, &ctx->dma_q, GFP_KERNEL); | 1091 | ctx->q = dma_alloc_coherent(dev, half_key_sz, &ctx->dma_q, GFP_KERNEL); |
| 1092 | if (!ctx->q) | 1092 | if (!ctx->q) |
| 1093 | goto free_p; | 1093 | goto free_p; |
| 1094 | memcpy(ctx->q + (half_key_sz - len), ptr, len); | 1094 | memcpy(ctx->q + (half_key_sz - len), ptr, len); |
| @@ -1099,8 +1099,8 @@ static void qat_rsa_setkey_crt(struct qat_rsa_ctx *ctx, struct rsa_key *rsa_key) · 4 unmodified lines | |||
| 1099 | qat_rsa_drop_leading_zeros(&ptr, &len); | 1099 | qat_rsa_drop_leading_zeros(&ptr, &len); |
| 1100 | if (!len) | 1100 | if (!len) |
| 1101 | goto free_q; | 1101 | goto free_q; |
| 1102 | ctx->dp = dma_zalloc_coherent(dev, half_key_sz, &ctx->dma_dp, | 1102 | ctx->dp = dma_alloc_coherent(dev, half_key_sz, &ctx->dma_dp, |
| 1103 | GFP_KERNEL); | 1103 | GFP_KERNEL); |
| 1104 | if (!ctx->dp) | 1104 | if (!ctx->dp) |
| 1105 | goto free_q; | 1105 | goto free_q; |
| 1106 | memcpy(ctx->dp + (half_key_sz - len), ptr, len); | 1106 | memcpy(ctx->dp + (half_key_sz - len), ptr, len); |
| @@ -1111,8 +1111,8 @@ static void qat_rsa_setkey_crt(struct qat_rsa_ctx *ctx, struct rsa_key *rsa_key) · 4 unmodified lines | |||
| 1111 | qat_rsa_drop_leading_zeros(&ptr, &len); | 1111 | qat_rsa_drop_leading_zeros(&ptr, &len); |
| 1112 | if (!len) | 1112 | if (!len) |
| 1113 | goto free_dp; | 1113 | goto free_dp; |
| 1114 | ctx->dq = dma_zalloc_coherent(dev, half_key_sz, &ctx->dma_dq, | 1114 | ctx->dq = dma_alloc_coherent(dev, half_key_sz, &ctx->dma_dq, |
| 1115 | GFP_KERNEL); | 1115 | GFP_KERNEL); |
| 1116 | if (!ctx->dq) | 1116 | if (!ctx->dq) |
| 1117 | goto free_dp; | 1117 | goto free_dp; |
| 1118 | memcpy(ctx->dq + (half_key_sz - len), ptr, len); | 1118 | memcpy(ctx->dq + (half_key_sz - len), ptr, len); |
| @@ -1123,8 +1123,8 @@ static void qat_rsa_setkey_crt(struct qat_rsa_ctx *ctx, struct rsa_key *rsa_key) · 4 unmodified lines | |||
| 1123 | qat_rsa_drop_leading_zeros(&ptr, &len); | 1123 | qat_rsa_drop_leading_zeros(&ptr, &len); |
| 1124 | if (!len) | 1124 | if (!len) |
| 1125 | goto free_dq; | 1125 | goto free_dq; |
| 1126 | ctx->qinv = dma_zalloc_coherent(dev, half_key_sz, &ctx->dma_qinv, | 1126 | ctx->qinv = dma_alloc_coherent(dev, half_key_sz, &ctx->dma_qinv, |
| 1127 | GFP_KERNEL); | 1127 | GFP_KERNEL); |
| 1128 | if (!ctx->qinv) | 1128 | if (!ctx->qinv) |
| 1129 | goto free_dq; | 1129 | goto free_dq; |
| 1130 | memcpy(ctx->qinv + (half_key_sz - len), ptr, len); | 1130 | memcpy(ctx->qinv + (half_key_sz - len), ptr, len); |
| @@ -1361,23 +1361,18 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, · 1360 unmodified lines | |||
| 1361 | struct talitos_private *priv = dev_get_drvdata(dev); | 1361 | struct talitos_private *priv = dev_get_drvdata(dev); |
| 1362 | bool is_sec1 = has_ftr_sec1(priv); | 1362 | bool is_sec1 = has_ftr_sec1(priv); |
| 1363 | int max_len = is_sec1 ? TALITOS1_MAX_DATA_LEN : TALITOS2_MAX_DATA_LEN; | 1363 | int max_len = is_sec1 ? TALITOS1_MAX_DATA_LEN : TALITOS2_MAX_DATA_LEN; |
| 1364 | void *err; | ||
| 1365 | 1364 | ||
| 1366 | if (cryptlen + authsize > max_len) { | 1365 | if (cryptlen + authsize > max_len) { |
| 1367 | dev_err(dev, "length exceeds h/w max limit\n"); | 1366 | dev_err(dev, "length exceeds h/w max limit\n"); |
| 1368 | return ERR_PTR(-EINVAL); | 1367 | return ERR_PTR(-EINVAL); |
| 1369 | } | 1368 | } |
| 1370 | 1369 | ||
| 1371 | if (ivsize) | ||
| 1372 | iv_dma = dma_map_single(dev, iv, ivsize, DMA_TO_DEVICE); | ||
| 1373 | |||
| 1374 | if (!dst || dst == src) { | 1370 | if (!dst || dst == src) { |
| 1375 | src_len = assoclen + cryptlen + authsize; | 1371 | src_len = assoclen + cryptlen + authsize; |
| 1376 | src_nents = sg_nents_for_len(src, src_len); | 1372 | src_nents = sg_nents_for_len(src, src_len); |
| 1377 | if (src_nents < 0) { | 1373 | if (src_nents < 0) { |
| 1378 | dev_err(dev, "Invalid number of src SG.\n"); | 1374 | dev_err(dev, "Invalid number of src SG.\n"); |
| 1379 | err = ERR_PTR(-EINVAL); | 1375 | return ERR_PTR(-EINVAL); |
| 1380 | goto error_sg; | ||
| 1381 | } | 1376 | } |
| 1382 | src_nents = (src_nents == 1) ? 0 : src_nents; | 1377 | src_nents = (src_nents == 1) ? 0 : src_nents; |
| 1383 | dst_nents = dst ? src_nents : 0; | 1378 | dst_nents = dst ? src_nents : 0; |
| @@ -1387,16 +1382,14 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, · 3 unmodified lines | |||
| 1387 | src_nents = sg_nents_for_len(src, src_len); | 1382 | src_nents = sg_nents_for_len(src, src_len); |
| 1388 | if (src_nents < 0) { | 1383 | if (src_nents < 0) { |
| 1389 | dev_err(dev, "Invalid number of src SG.\n"); | 1384 | dev_err(dev, "Invalid number of src SG.\n"); |
| 1390 | err = ERR_PTR(-EINVAL); | 1385 | return ERR_PTR(-EINVAL); |
| 1391 | goto error_sg; | ||
| 1392 | } | 1386 | } |
| 1393 | src_nents = (src_nents == 1) ? 0 : src_nents; | 1387 | src_nents = (src_nents == 1) ? 0 : src_nents; |
| 1394 | dst_len = assoclen + cryptlen + (encrypt ? authsize : 0); | 1388 | dst_len = assoclen + cryptlen + (encrypt ? authsize : 0); |
| 1395 | dst_nents = sg_nents_for_len(dst, dst_len); | 1389 | dst_nents = sg_nents_for_len(dst, dst_len); |
| 1396 | if (dst_nents < 0) { | 1390 | if (dst_nents < 0) { |
| 1397 | dev_err(dev, "Invalid number of dst SG.\n"); | 1391 | dev_err(dev, "Invalid number of dst SG.\n"); |
| 1398 | err = ERR_PTR(-EINVAL); | 1392 | return ERR_PTR(-EINVAL); |
| 1399 | goto error_sg; | ||
| 1400 | } | 1393 | } |
| 1401 | dst_nents = (dst_nents == 1) ? 0 : dst_nents; | 1394 | dst_nents = (dst_nents == 1) ? 0 : dst_nents; |
| 1402 | } | 1395 | } |
| @@ -1423,11 +1416,14 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, · 20 unmodified lines | |||
| 1423 | /* if its a ahash, add space for a second desc next to the first one */ | 1416 | /* if its a ahash, add space for a second desc next to the first one */ |
| 1424 | if (is_sec1 && !dst) | 1417 | if (is_sec1 && !dst) |
| 1425 | alloc_len += sizeof(struct talitos_desc); | 1418 | alloc_len += sizeof(struct talitos_desc); |
| 1419 | alloc_len += ivsize; | ||
| 1426 | 1420 | ||
| 1427 | edesc = kmalloc(alloc_len, GFP_DMA | flags); | 1421 | edesc = kmalloc(alloc_len, GFP_DMA | flags); |
| 1428 | if (!edesc) { | 1422 | if (!edesc) |
| 1429 | err = ERR_PTR(-ENOMEM); | 1423 | return ERR_PTR(-ENOMEM); |
| 1430 | goto error_sg; | 1424 | if (ivsize) { |
| 1425 | iv = memcpy(((u8 *)edesc) + alloc_len - ivsize, iv, ivsize); | ||
| 1426 | iv_dma = dma_map_single(dev, iv, ivsize, DMA_TO_DEVICE); | ||
| 1431 | } | 1427 | } |
| 1432 | memset(&edesc->desc, 0, sizeof(edesc->desc)); | 1428 | memset(&edesc->desc, 0, sizeof(edesc->desc)); |
| 1433 | 1429 | ||
| @@ -1445,10 +1441,6 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, · 11 unmodified lines | |||
| 1445 | DMA_BIDIRECTIONAL); | 1441 | DMA_BIDIRECTIONAL); |
| 1446 | } | 1442 | } |
| 1447 | return edesc; | 1443 | return edesc; |
| 1448 | error_sg: | ||
| 1449 | if (iv_dma) | ||
| 1450 | dma_unmap_single(dev, iv_dma, ivsize, DMA_TO_DEVICE); | ||
| 1451 | return err; | ||
| 1452 | } | 1444 | } |
| 1453 | 1445 | ||
| 1454 | static struct talitos_edesc *aead_edesc_alloc(struct aead_request *areq, u8 *iv, | 1446 | static struct talitos_edesc *aead_edesc_alloc(struct aead_request *areq, u8 *iv, |
| @@ -203,6 +203,7 @@ struct at_xdmac_chan { · 202 unmodified lines | |||
| 203 | u32 save_cim; | 203 | u32 save_cim; |
| 204 | u32 save_cnda; | 204 | u32 save_cnda; |
| 205 | u32 save_cndc; | 205 | u32 save_cndc; |
| 206 | u32 irq_status; | ||
| 206 | unsigned long status; | 207 | unsigned long status; |
| 207 | struct tasklet_struct tasklet; | 208 | struct tasklet_struct tasklet; |
| 208 | struct dma_slave_config sconfig; | 209 | struct dma_slave_config sconfig; |
| @@ -1580,8 +1581,8 @@ static void at_xdmac_tasklet(unsigned long data) · 1371 unmodified lines | |||
| 1580 | struct at_xdmac_desc *desc; | 1581 | struct at_xdmac_desc *desc; |
| 1581 | u32 error_mask; | 1582 | u32 error_mask; |
| 1582 | 1583 | ||
| 1583 | dev_dbg(chan2dev(&atchan->chan), "%s: status=0x%08lx\n", | 1584 | dev_dbg(chan2dev(&atchan->chan), "%s: status=0x%08x\n", |
| 1584 | __func__, atchan->status); | 1585 | __func__, atchan->irq_status); |
| 1585 | 1586 | ||
| 1586 | error_mask = AT_XDMAC_CIS_RBEIS | 1587 | error_mask = AT_XDMAC_CIS_RBEIS |
| 1587 | | AT_XDMAC_CIS_WBEIS | 1588 | | AT_XDMAC_CIS_WBEIS |
| @@ -1589,15 +1590,15 @@ static void at_xdmac_tasklet(unsigned long data) · 1 unmodified line | |||
| 1589 | 1590 | ||
| 1590 | if (at_xdmac_chan_is_cyclic(atchan)) { | 1591 | if (at_xdmac_chan_is_cyclic(atchan)) { |
| 1591 | at_xdmac_handle_cyclic(atchan); | 1592 | at_xdmac_handle_cyclic(atchan); |
| 1592 | } else if ((atchan->status & AT_XDMAC_CIS_LIS) | 1593 | } else if ((atchan->irq_status & AT_XDMAC_CIS_LIS) |
| 1593 | || (atchan->status & error_mask)) { | 1594 | || (atchan->irq_status & error_mask)) { |
| 1594 | struct dma_async_tx_descriptor *txd; | 1595 | struct dma_async_tx_descriptor *txd; |
| 1595 | 1596 | ||
| 1596 | if (atchan->status & AT_XDMAC_CIS_RBEIS) | 1597 | if (atchan->irq_status & AT_XDMAC_CIS_RBEIS) |
| 1597 | dev_err(chan2dev(&atchan->chan), "read bus error!!!"); | 1598 | dev_err(chan2dev(&atchan->chan), "read bus error!!!"); |
| 1598 | if (atchan->status & AT_XDMAC_CIS_WBEIS) | 1599 | if (atchan->irq_status & AT_XDMAC_CIS_WBEIS) |
| 1599 | dev_err(chan2dev(&atchan->chan), "write bus error!!!"); | 1600 | dev_err(chan2dev(&atchan->chan), "write bus error!!!"); |
| 1600 | if (atchan->status & AT_XDMAC_CIS_ROIS) | 1601 | if (atchan->irq_status & AT_XDMAC_CIS_ROIS) |
| 1601 | dev_err(chan2dev(&atchan->chan), "request overflow error!!!"); | 1602 | dev_err(chan2dev(&atchan->chan), "request overflow error!!!"); |
| 1602 | 1603 | ||
| 1603 | spin_lock(&atchan->lock); | 1604 | spin_lock(&atchan->lock); |
| @@ -1652,7 +1653,7 @@ static irqreturn_t at_xdmac_interrupt(int irq, void *dev_id) · 48 unmodified lines | |||
| 1652 | atchan = &atxdmac->chan[i]; | 1653 | atchan = &atxdmac->chan[i]; |
| 1653 | chan_imr = at_xdmac_chan_read(atchan, AT_XDMAC_CIM); | 1654 | chan_imr = at_xdmac_chan_read(atchan, AT_XDMAC_CIM); |
| 1654 | chan_status = at_xdmac_chan_read(atchan, AT_XDMAC_CIS); | 1655 | chan_status = at_xdmac_chan_read(atchan, AT_XDMAC_CIS); |
| 1655 | atchan->status = chan_status & chan_imr; | 1656 | atchan->irq_status = chan_status & chan_imr; |
| 1656 | dev_vdbg(atxdmac->dma.dev, | 1657 | dev_vdbg(atxdmac->dma.dev, |
| 1657 | "%s: chan%d: imr=0x%x, status=0x%x\n", | 1658 | "%s: chan%d: imr=0x%x, status=0x%x\n", |
| 1658 | __func__, i, chan_imr, chan_status); | 1659 | __func__, i, chan_imr, chan_status); |
| @@ -1666,7 +1667,7 @@ static irqreturn_t at_xdmac_interrupt(int irq, void *dev_id) · 7 unmodified lines | |||
| 1666 | at_xdmac_chan_read(atchan, AT_XDMAC_CDA), | 1667 | at_xdmac_chan_read(atchan, AT_XDMAC_CDA), |
| 1667 | at_xdmac_chan_read(atchan, AT_XDMAC_CUBC)); | 1668 | at_xdmac_chan_read(atchan, AT_XDMAC_CUBC)); |
| 1668 | 1669 | ||
| 1669 | if (atchan->status & (AT_XDMAC_CIS_RBEIS | AT_XDMAC_CIS_WBEIS)) | 1670 | if (atchan->irq_status & (AT_XDMAC_CIS_RBEIS | AT_XDMAC_CIS_WBEIS)) |
| 1670 | at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask); | 1671 | at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask); |
| 1671 | 1672 | ||
| 1672 | tasklet_schedule(&atchan->tasklet); | 1673 | tasklet_schedule(&atchan->tasklet); |
| @@ -406,38 +406,32 @@ static void bcm2835_dma_fill_cb_chain_with_sg( · 405 unmodified lines | |||
| 406 | } | 406 | } |
| 407 | } | 407 | } |
| 408 | 408 | ||
| 409 | static int bcm2835_dma_abort(void __iomem *chan_base) | 409 | static int bcm2835_dma_abort(struct bcm2835_chan *c) |
| 410 | { | 410 | { |
| 411 | unsigned long cs; | 411 | void __iomem *chan_base = c->chan_base; |
| 412 | long int timeout = 10000; | 412 | long int timeout = 10000; |
| 413 | 413 | ||
| 414 | cs = readl(chan_base + BCM2835_DMA_CS); | 414 | /* |
| 415 | if (!(cs & BCM2835_DMA_ACTIVE)) | 415 | * A zero control block address means the channel is idle. |
| 416 | * (The ACTIVE flag in the CS register is not a reliable indicator.) | ||
| 417 | */ | ||
| 418 | if (!readl(chan_base + BCM2835_DMA_ADDR)) | ||
| 416 | return 0; | 419 | return 0; |
| 417 | 420 | ||
| 418 | /* Write 0 to the active bit - Pause the DMA */ | 421 | /* Write 0 to the active bit - Pause the DMA */ |
| 419 | writel(0, chan_base + BCM2835_DMA_CS); | 422 | writel(0, chan_base + BCM2835_DMA_CS); |
| 420 | 423 | ||
| 421 | /* Wait for any current AXI transfer to complete */ | 424 | /* Wait for any current AXI transfer to complete */ |
| 422 | while ((cs & BCM2835_DMA_ISPAUSED) && --timeout) { | 425 | while ((readl(chan_base + BCM2835_DMA_CS) & |
| 426 | BCM2835_DMA_WAITING_FOR_WRITES) && --timeout) | ||
| 423 | cpu_relax(); | 427 | cpu_relax(); |
| 424 | cs = readl(chan_base + BCM2835_DMA_CS); | ||
| 425 | } | ||
| 426 | 428 | ||
| 427 | /* We'll un-pause when we set of our next DMA */ | 429 | /* Peripheral might be stuck and fail to signal AXI write responses */ |
| 428 | if (!timeout) | 430 | if (!timeout) |
| 429 | return -ETIMEDOUT; | 431 | dev_err(c->vc.chan.device->dev, |
| 430 | 432 | "failed to complete outstanding writes\n"); | |
| 431 | if (!(cs & BCM2835_DMA_ACTIVE)) | ||
| 432 | return 0; | ||
| 433 | |||
| 434 | /* Terminate the control block chain */ | ||
| 435 | writel(0, chan_base + BCM2835_DMA_NEXTCB); | ||
| 436 | |||
| 437 | /* Abort the whole DMA */ | ||
| 438 | writel(BCM2835_DMA_ABORT | BCM2835_DMA_ACTIVE, | ||
| 439 | chan_base + BCM2835_DMA_CS); | ||
| 440 | 433 | ||
| 434 | writel(BCM2835_DMA_RESET, chan_base + BCM2835_DMA_CS); | ||
| 441 | return 0; | 435 | return 0; |
| 442 | } | 436 | } |
| 443 | 437 | ||
| @@ -476,8 +470,15 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data) · 32 unmodified lines | |||
| 476 | 470 | ||
| 477 | spin_lock_irqsave(&c->vc.lock, flags); | 471 | spin_lock_irqsave(&c->vc.lock, flags); |
| 478 | 472 | ||
| 479 | /* Acknowledge interrupt */ | 473 | /* |
| 480 | writel(BCM2835_DMA_INT, c->chan_base + BCM2835_DMA_CS); | 474 | * Clear the INT flag to receive further interrupts. Keep the channel |
| 475 | * active in case the descriptor is cyclic or in case the client has | ||
| 476 | * already terminated the descriptor and issued a new one. (May happen | ||
| 477 | * if this IRQ handler is threaded.) If the channel is finished, it | ||
| 478 | * will remain idle despite the ACTIVE flag being set. | ||
| 479 | */ | ||
| 480 | writel(BCM2835_DMA_INT | BCM2835_DMA_ACTIVE, | ||
| 481 | c->chan_base + BCM2835_DMA_CS); | ||
| 481 | 482 | ||
| 482 | d = c->desc; | 483 | d = c->desc; |
| 483 | 484 | ||
| @@ -485,11 +486,7 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data) · 1 unmodified line | |||
| 485 | if (d->cyclic) { | 486 | if (d->cyclic) { |
| 486 | /* call the cyclic callback */ | 487 | /* call the cyclic callback */ |
| 487 | vchan_cyclic_callback(&d->vd); | 488 | vchan_cyclic_callback(&d->vd); |
| 488 | 489 | } else if (!readl(c->chan_base + BCM2835_DMA_ADDR)) { | |
| 489 | /* Keep the DMA engine running */ | ||
| 490 | writel(BCM2835_DMA_ACTIVE, | ||
| 491 | c->chan_base + BCM2835_DMA_CS); | ||
| 492 | } else { | ||
| 493 | vchan_cookie_complete(&c->desc->vd); | 490 | vchan_cookie_complete(&c->desc->vd); |
| 494 | bcm2835_dma_start_desc(c); | 491 | bcm2835_dma_start_desc(c); |
| 495 | } | 492 | } |
| @@ -779,7 +776,6 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan) · 283 unmodified lines | |||
| 779 | struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); | 776 | struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); |
| 780 | struct bcm2835_dmadev *d = to_bcm2835_dma_dev(c->vc.chan.device); | 777 | struct bcm2835_dmadev *d = to_bcm2835_dma_dev(c->vc.chan.device); |
| 781 | unsigned long flags; | 778 | unsigned long flags; |
| 782 | int timeout = 10000; | ||
| 783 | LIST_HEAD(head); | 779 | LIST_HEAD(head); |
| 784 | 780 | ||
| 785 | spin_lock_irqsave(&c->vc.lock, flags); | 781 | spin_lock_irqsave(&c->vc.lock, flags); |
| @@ -789,27 +785,11 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan) · 3 unmodified lines | |||
| 789 | list_del_init(&c->node); | 785 | list_del_init(&c->node); |
| 790 | spin_unlock(&d->lock); | 786 | spin_unlock(&d->lock); |
| 791 | 787 | ||
| 792 | /* | 788 | /* stop DMA activity */ |
| 793 | * Stop DMA activity: we assume the callback will not be called | ||
| 794 | * after bcm_dma_abort() returns (even if it does, it will see | ||
| 795 | * c->desc is NULL and exit.) | ||
| 796 | */ | ||
| 797 | if (c->desc) { | 789 | if (c->desc) { |
| 798 | vchan_terminate_vdesc(&c->desc->vd); | 790 | vchan_terminate_vdesc(&c->desc->vd); |
| 799 | c->desc = NULL; | 791 | c->desc = NULL; |
| 800 | bcm2835_dma_abort(c->chan_base); | 792 | bcm2835_dma_abort(c); |
| 801 | |||
| 802 | /* Wait for stopping */ | ||
| 803 | while (--timeout) { | ||
| 804 | if (!(readl(c->chan_base + BCM2835_DMA_CS) & | ||
| 805 | BCM2835_DMA_ACTIVE)) | ||
| 806 | break; | ||
| 807 | |||
| 808 | cpu_relax(); | ||
| 809 | } | ||
| 810 | |||
| 811 | if (!timeout) | ||
| 812 | dev_err(d->ddev.dev, "DMA transfer could not be terminated\n"); | ||
| 813 | } | 793 | } |
| 814 | 794 | ||
| 815 | vchan_get_all_descriptors(&c->vc, &head); | 795 | vchan_get_all_descriptors(&c->vc, &head); |
| @@ -711,11 +711,9 @@ static int dmatest_func(void *data) · 710 unmodified lines | |||
| 711 | srcs[i] = um->addr[i] + src_off; | 711 | srcs[i] = um->addr[i] + src_off; |
| 712 | ret = dma_mapping_error(dev->dev, um->addr[i]); | 712 | ret = dma_mapping_error(dev->dev, um->addr[i]); |
| 713 | if (ret) { | 713 | if (ret) { |
| 714 | dmaengine_unmap_put(um); | ||
| 715 | result("src mapping error", total_tests, | 714 | result("src mapping error", total_tests, |
| 716 | src_off, dst_off, len, ret); | 715 | src_off, dst_off, len, ret); |
| 717 | failed_tests++; | 716 | goto error_unmap_continue; |
| 718 | continue; | ||
| 719 | } | 717 | } |
| 720 | um->to_cnt++; | 718 | um->to_cnt++; |
| 721 | } | 719 | } |
| @@ -730,11 +728,9 @@ static int dmatest_func(void *data) · 8 unmodified lines | |||
| 730 | DMA_BIDIRECTIONAL); | 728 | DMA_BIDIRECTIONAL); |
| 731 | ret = dma_mapping_error(dev->dev, dsts[i]); | 729 | ret = dma_mapping_error(dev->dev, dsts[i]); |
| 732 | if (ret) { | 730 | if (ret) { |
| 733 | dmaengine_unmap_put(um); | ||
| 734 | result("dst mapping error", total_tests, | 731 | result("dst mapping error", total_tests, |
| 735 | src_off, dst_off, len, ret); | 732 | src_off, dst_off, len, ret); |
| 736 | failed_tests++; | 733 | goto error_unmap_continue; |
| 737 | continue; | ||
| 738 | } | 734 | } |
| 739 | um->bidi_cnt++; | 735 | um->bidi_cnt++; |
| 740 | } | 736 | } |
| @@ -762,12 +758,10 @@ static int dmatest_func(void *data) · 21 unmodified lines | |||
| 762 | } | 758 | } |
| 763 | 759 | ||
| 764 | if (!tx) { | 760 | if (!tx) { |
| 765 | dmaengine_unmap_put(um); | ||
| 766 | result("prep error", total_tests, src_off, | 761 | result("prep error", total_tests, src_off, |
| 767 | dst_off, len, ret); | 762 | dst_off, len, ret); |
| 768 | msleep(100); | 763 | msleep(100); |
| 769 | failed_tests++; | 764 | goto error_unmap_continue; |
| 770 | continue; | ||
| 771 | } | 765 | } |
| 772 | 766 | ||
| 773 | done->done = false; | 767 | done->done = false; |
| @@ -776,12 +770,10 @@ static int dmatest_func(void *data) · 2 unmodified lines | |||
| 776 | cookie = tx->tx_submit(tx); | 770 | cookie = tx->tx_submit(tx); |
| 777 | 771 | ||
| 778 | if (dma_submit_error(cookie)) { | 772 | if (dma_submit_error(cookie)) { |
| 779 | dmaengine_unmap_put(um); | ||
| 780 | result("submit error", total_tests, src_off, | 773 | result("submit error", total_tests, src_off, |
| 781 | dst_off, len, ret); | 774 | dst_off, len, ret); |
| 782 | msleep(100); | 775 | msleep(100); |
| 783 | failed_tests++; | 776 | goto error_unmap_continue; |
| 784 | continue; | ||
| 785 | } | 777 | } |
| 786 | dma_async_issue_pending(chan); | 778 | dma_async_issue_pending(chan); |
| 787 | 779 | ||
| @@ -790,22 +782,20 @@ static int dmatest_func(void *data) · 2 unmodified lines | |||
| 790 | 782 | ||
| 791 | status = dma_async_is_tx_complete(chan, cookie, NULL, NULL); | 783 | status = dma_async_is_tx_complete(chan, cookie, NULL, NULL); |
| 792 | 784 | ||
| 793 | dmaengine_unmap_put(um); | ||
| 794 | |||
| 795 | if (!done->done) { | 785 | if (!done->done) { |
| 796 | result("test timed out", total_tests, src_off, dst_off, | 786 | result("test timed out", total_tests, src_off, dst_off, |
| 797 | len, 0); | 787 | len, 0); |
| 798 | failed_tests++; | 788 | goto error_unmap_continue; |
| 799 | continue; | ||
| 800 | } else if (status != DMA_COMPLETE) { | 789 | } else if (status != DMA_COMPLETE) { |
| 801 | result(status == DMA_ERROR ? | 790 | result(status == DMA_ERROR ? |
| 802 | "completion error status" : | 791 | "completion error status" : |
| 803 | "completion busy status", total_tests, src_off, | 792 | "completion busy status", total_tests, src_off, |
| 804 | dst_off, len, ret); | 793 | dst_off, len, ret); |
| 805 | failed_tests++; | 794 | goto error_unmap_continue; |
| 806 | continue; | ||
| 807 | } | 795 | } |
| 808 | 796 | ||
| 797 | dmaengine_unmap_put(um); | ||
| 798 | |||
| 809 | if (params->noverify) { | 799 | if (params->noverify) { |
| 810 | verbose_result("test passed", total_tests, src_off, | 800 | verbose_result("test passed", total_tests, src_off, |
| 811 | dst_off, len, 0); | 801 | dst_off, len, 0); |
| @@ -846,6 +836,12 @@ static int dmatest_func(void *data) · 34 unmodified lines | |||
| 846 | verbose_result("test passed", total_tests, src_off, | 836 | verbose_result("test passed", total_tests, src_off, |
| 847 | dst_off, len, 0); | 837 | dst_off, len, 0); |
| 848 | } | 838 | } |
| 839 | |||
| 840 | continue; | ||
| 841 | |||
| 842 | error_unmap_continue: | ||
| 843 | dmaengine_unmap_put(um); | ||
| 844 | failed_tests++; | ||
| 849 | } | 845 | } |
| 850 | ktime = ktime_sub(ktime_get(), ktime); | 846 | ktime = ktime_sub(ktime_get(), ktime); |
| 851 | ktime = ktime_sub(ktime, comparetime); | 847 | ktime = ktime_sub(ktime, comparetime); |
| @@ -618,7 +618,7 @@ static void imxdma_tasklet(unsigned long data) · 617 unmodified lines | |||
| 618 | { | 618 | { |
| 619 | struct imxdma_channel *imxdmac = (void *)data; | 619 | struct imxdma_channel *imxdmac = (void *)data; |
| 620 | struct imxdma_engine *imxdma = imxdmac->imxdma; | 620 | struct imxdma_engine *imxdma = imxdmac->imxdma; |
| 621 | struct imxdma_desc *desc; | 621 | struct imxdma_desc *desc, *next_desc; |
| 622 | unsigned long flags; | 622 | unsigned long flags; |
| 623 | 623 | ||
| 624 | spin_lock_irqsave(&imxdma->lock, flags); | 624 | spin_lock_irqsave(&imxdma->lock, flags); |
| @@ -648,10 +648,10 @@ static void imxdma_tasklet(unsigned long data) · 23 unmodified lines | |||
| 648 | list_move_tail(imxdmac->ld_active.next, &imxdmac->ld_free); | 648 | list_move_tail(imxdmac->ld_active.next, &imxdmac->ld_free); |
| 649 | 649 | ||
| 650 | if (!list_empty(&imxdmac->ld_queue)) { | 650 | if (!list_empty(&imxdmac->ld_queue)) { |
| 651 | desc = list_first_entry(&imxdmac->ld_queue, struct imxdma_desc, | 651 | next_desc = list_first_entry(&imxdmac->ld_queue, |
| 652 | node); | 652 | struct imxdma_desc, node); |
| 653 | list_move_tail(imxdmac->ld_queue.next, &imxdmac->ld_active); | 653 | list_move_tail(imxdmac->ld_queue.next, &imxdmac->ld_active); |
| 654 | if (imxdma_xfer_desc(desc) < 0) | 654 | if (imxdma_xfer_desc(next_desc) < 0) |
| 655 | dev_warn(imxdma->dev, "%s: channel: %d couldn't xfer desc\n", | 655 | dev_warn(imxdma->dev, "%s: channel: %d couldn't xfer desc\n", |
| 656 | __func__, imxdmac->channel); | 656 | __func__, imxdmac->channel); |
| 657 | } | 657 | } |
| @@ -1182,8 +1182,8 @@ static int sdma_request_channel0(struct sdma_engine *sdma) · 1181 unmodified lines | |||
| 1182 | { | 1182 | { |
| 1183 | int ret = -EBUSY; | 1183 | int ret = -EBUSY; |
| 1184 | 1184 | ||
| 1185 | sdma->bd0 = dma_zalloc_coherent(NULL, PAGE_SIZE, &sdma->bd0_phys, | 1185 | sdma->bd0 = dma_alloc_coherent(NULL, PAGE_SIZE, &sdma->bd0_phys, |
| 1186 | GFP_NOWAIT); | 1186 | GFP_NOWAIT); |
| 1187 | if (!sdma->bd0) { | 1187 | if (!sdma->bd0) { |
| 1188 | ret = -ENOMEM; | 1188 | ret = -ENOMEM; |
| 1189 | goto out; | 1189 | goto out; |
| @@ -1205,8 +1205,8 @@ static int sdma_alloc_bd(struct sdma_desc *desc) · 15 unmodified lines | |||
| 1205 | u32 bd_size = desc->num_bd * sizeof(struct sdma_buffer_descriptor); | 1205 | u32 bd_size = desc->num_bd * sizeof(struct sdma_buffer_descriptor); |
| 1206 | int ret = 0; | 1206 | int ret = 0; |
| 1207 | 1207 | ||
| 1208 | desc->bd = dma_zalloc_coherent(NULL, bd_size, &desc->bd_phys, | 1208 | desc->bd = dma_alloc_coherent(NULL, bd_size, &desc->bd_phys, |
| 1209 | GFP_NOWAIT); | 1209 | GFP_NOWAIT); |
| 1210 | if (!desc->bd) { | 1210 | if (!desc->bd) { |
| 1211 | ret = -ENOMEM; | 1211 | ret = -ENOMEM; |
| 1212 | goto out; | 1212 | goto out; |
| @@ -325,8 +325,8 @@ static int mtk_hsdma_alloc_pchan(struct mtk_hsdma_device *hsdma, · 324 unmodified lines | |||
| 325 | * and [MTK_DMA_SIZE ... 2 * MTK_DMA_SIZE - 1] is for RX ring. | 325 | * and [MTK_DMA_SIZE ... 2 * MTK_DMA_SIZE - 1] is for RX ring. |
| 326 | */ | 326 | */ |
| 327 | pc->sz_ring = 2 * MTK_DMA_SIZE * sizeof(*ring->txd); | 327 | pc->sz_ring = 2 * MTK_DMA_SIZE * sizeof(*ring->txd); |
| 328 | ring->txd = dma_zalloc_coherent(hsdma2dev(hsdma), pc->sz_ring, | 328 | ring->txd = dma_alloc_coherent(hsdma2dev(hsdma), pc->sz_ring, |
| 329 | &ring->tphys, GFP_NOWAIT); | 329 | &ring->tphys, GFP_NOWAIT); |
| 330 | if (!ring->txd) | 330 | if (!ring->txd) |
| 331 | return -ENOMEM; | 331 | return -ENOMEM; |
| 332 | 332 | ||
| @@ -416,9 +416,9 @@ static int mxs_dma_alloc_chan_resources(struct dma_chan *chan) · 415 unmodified lines | |||
| 416 | struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; | 416 | struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; |
| 417 | int ret; | 417 | int ret; |
| 418 | 418 | ||
| 419 | mxs_chan->ccw = dma_zalloc_coherent(mxs_dma->dma_device.dev, | 419 | mxs_chan->ccw = dma_alloc_coherent(mxs_dma->dma_device.dev, |
| 420 | CCW_BLOCK_SIZE, | 420 | CCW_BLOCK_SIZE, |
| 421 | &mxs_chan->ccw_phys, GFP_KERNEL); | 421 | &mxs_chan->ccw_phys, GFP_KERNEL); |
| 422 | if (!mxs_chan->ccw) { | 422 | if (!mxs_chan->ccw) { |
| 423 | ret = -ENOMEM; | 423 | ret = -ENOMEM; |
| 424 | goto err_alloc; | 424 | goto err_alloc; |
| @@ -1208,8 +1208,8 @@ static int xgene_dma_create_ring_one(struct xgene_dma_chan *chan, · 1207 unmodified lines | |||
| 1208 | ring->size = ret; | 1208 | ring->size = ret; |
| 1209 | 1209 | ||
| 1210 | /* Allocate memory for DMA ring descriptor */ | 1210 | /* Allocate memory for DMA ring descriptor */ |
| 1211 | ring->desc_vaddr = dma_zalloc_coherent(chan->dev, ring->size, | 1211 | ring->desc_vaddr = dma_alloc_coherent(chan->dev, ring->size, |
| 1212 | &ring->desc_paddr, GFP_KERNEL); | 1212 | &ring->desc_paddr, GFP_KERNEL); |
| 1213 | if (!ring->desc_vaddr) { | 1213 | if (!ring->desc_vaddr) { |
| 1214 | chan_err(chan, "Failed to allocate ring desc\n"); | 1214 | chan_err(chan, "Failed to allocate ring desc\n"); |
| 1215 | return -ENOMEM; | 1215 | return -ENOMEM; |
| @@ -879,10 +879,9 @@ static int xilinx_dma_alloc_chan_resources(struct dma_chan *dchan) · 878 unmodified lines | |||
| 879 | */ | 879 | */ |
| 880 | if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) { | 880 | if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) { |
| 881 | /* Allocate the buffer descriptors. */ | 881 | /* Allocate the buffer descriptors. */ |
| 882 | chan->seg_v = dma_zalloc_coherent(chan->dev, | 882 | chan->seg_v = dma_alloc_coherent(chan->dev, |
| 883 | sizeof(*chan->seg_v) * | 883 | sizeof(*chan->seg_v) * XILINX_DMA_NUM_DESCS, |
| 884 | XILINX_DMA_NUM_DESCS, | 884 | &chan->seg_p, GFP_KERNEL); |
| 885 | &chan->seg_p, GFP_KERNEL); | ||
| 886 | if (!chan->seg_v) { | 885 | if (!chan->seg_v) { |
| 887 | dev_err(chan->dev, | 886 | dev_err(chan->dev, |
| 888 | "unable to allocate channel %d descriptors\n", | 887 | "unable to allocate channel %d descriptors\n", |
| @@ -895,9 +894,10 @@ static int xilinx_dma_alloc_chan_resources(struct dma_chan *dchan) · 6 unmodified lines | |||
| 895 | * so allocating a desc segment during channel allocation for | 894 | * so allocating a desc segment during channel allocation for |
| 896 | * programming tail descriptor. | 895 | * programming tail descriptor. |
| 897 | */ | 896 | */ |
| 898 | chan->cyclic_seg_v = dma_zalloc_coherent(chan->dev, | 897 | chan->cyclic_seg_v = dma_alloc_coherent(chan->dev, |
| 899 | sizeof(*chan->cyclic_seg_v), | 898 | sizeof(*chan->cyclic_seg_v), |
| 900 | &chan->cyclic_seg_p, GFP_KERNEL); | 899 | &chan->cyclic_seg_p, |
| 900 | GFP_KERNEL); | ||
| 901 | if (!chan->cyclic_seg_v) { | 901 | if (!chan->cyclic_seg_v) { |
| 902 | dev_err(chan->dev, | 902 | dev_err(chan->dev, |
| 903 | "unable to allocate desc segment for cyclic DMA\n"); | 903 | "unable to allocate desc segment for cyclic DMA\n"); |
| @@ -490,9 +490,9 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan) · 489 unmodified lines | |||
| 490 | list_add_tail(&desc->node, &chan->free_list); | 490 | list_add_tail(&desc->node, &chan->free_list); |
| 491 | } | 491 | } |
| 492 | 492 | ||
| 493 | chan->desc_pool_v = dma_zalloc_coherent(chan->dev, | 493 | chan->desc_pool_v = dma_alloc_coherent(chan->dev, |
| 494 | (2 * chan->desc_size * ZYNQMP_DMA_NUM_DESCS), | 494 | (2 * chan->desc_size * ZYNQMP_DMA_NUM_DESCS), |
| 495 | &chan->desc_pool_p, GFP_KERNEL); | 495 | &chan->desc_pool_p, GFP_KERNEL); |
| 496 | if (!chan->desc_pool_v) | 496 | if (!chan->desc_pool_v) |
| 497 | return -ENOMEM; | 497 | return -ENOMEM; |
| 498 | 498 | ||
| @@ -295,8 +295,8 @@ struct altr_sdram_mc_data { · 294 unmodified lines | |||
| 295 | #define S10_SYSMGR_ECC_INTSTAT_DERR_OFST 0xA0 | 295 | #define S10_SYSMGR_ECC_INTSTAT_DERR_OFST 0xA0 |
| 296 | 296 | ||
| 297 | /* Sticky registers for Uncorrected Errors */ | 297 | /* Sticky registers for Uncorrected Errors */ |
| 298 | #define S10_SYSMGR_UE_VAL_OFST 0x120 | 298 | #define S10_SYSMGR_UE_VAL_OFST 0x220 |
| 299 | #define S10_SYSMGR_UE_ADDR_OFST 0x124 | 299 | #define S10_SYSMGR_UE_ADDR_OFST 0x224 |
| 300 | 300 | ||
| 301 | #define S10_DDR0_IRQ_MASK BIT(16) | 301 | #define S10_DDR0_IRQ_MASK BIT(16) |
| 302 | 302 | ||
| @@ -1144,10 +1144,6 @@ static int sbp2_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) · 1143 unmodified lines | |||
| 1144 | if (device->is_local) | 1144 | if (device->is_local) |
| 1145 | return -ENODEV; | 1145 | return -ENODEV; |
| 1146 | 1146 | ||
| 1147 | if (dma_get_max_seg_size(device->card->device) > SBP2_MAX_SEG_SIZE) | ||
| 1148 | WARN_ON(dma_set_max_seg_size(device->card->device, | ||
| 1149 | SBP2_MAX_SEG_SIZE)); | ||
| 1150 | |||
| 1151 | shost = scsi_host_alloc(&scsi_driver_template, sizeof(*tgt)); | 1147 | shost = scsi_host_alloc(&scsi_driver_template, sizeof(*tgt)); |
| 1152 | if (shost == NULL) | 1148 | if (shost == NULL) |
| 1153 | return -ENOMEM; | 1149 | return -ENOMEM; |
| @@ -1610,6 +1606,7 @@ static struct scsi_host_template scsi_driver_template = { · 456 unmodified lines | |||
| 1610 | .eh_abort_handler = sbp2_scsi_abort, | 1606 | .eh_abort_handler = sbp2_scsi_abort, |
| 1611 | .this_id = -1, | 1607 | .this_id = -1, |
| 1612 | .sg_tablesize = SG_ALL, | 1608 | .sg_tablesize = SG_ALL, |
| 1609 | .max_segment_size = SBP2_MAX_SEG_SIZE, | ||
| 1613 | .can_queue = 1, | 1610 | .can_queue = 1, |
| 1614 | .sdev_attrs = sbp2_scsi_sysfs_attrs, | 1611 | .sdev_attrs = sbp2_scsi_sysfs_attrs, |
| 1615 | }; | 1612 | }; |
| @@ -119,6 +119,11 @@ void scmi_driver_unregister(struct scmi_driver *driver) · 118 unmodified lines | |||
| 119 | } | 119 | } |
| 120 | EXPORT_SYMBOL_GPL(scmi_driver_unregister); | 120 | EXPORT_SYMBOL_GPL(scmi_driver_unregister); |
| 121 | 121 | ||
| 122 | static void scmi_device_release(struct device *dev) | ||
| 123 | { | ||
| 124 | kfree(to_scmi_dev(dev)); | ||
| 125 | } | ||
| 126 | |||
| 122 | struct scmi_device * | 127 | struct scmi_device * |
| 123 | scmi_device_create(struct device_node *np, struct device *parent, int protocol) | 128 | scmi_device_create(struct device_node *np, struct device *parent, int protocol) |
| 124 | { | 129 | { |
| @@ -138,6 +143,7 @@ scmi_device_create(struct device_node *np, struct device *parent, int protocol) · 13 unmodified lines | |||
| 138 | scmi_dev->dev.parent = parent; | 143 | scmi_dev->dev.parent = parent; |
| 139 | scmi_dev->dev.of_node = np; | 144 | scmi_dev->dev.of_node = np; |
| 140 | scmi_dev->dev.bus = &scmi_bus_type; | 145 | scmi_dev->dev.bus = &scmi_bus_type; |
| 146 | scmi_dev->dev.release = scmi_device_release; | ||
| 141 | dev_set_name(&scmi_dev->dev, "scmi_dev.%d", id); | 147 | dev_set_name(&scmi_dev->dev, "scmi_dev.%d", id); |
| 142 | 148 | ||
| 143 | retval = device_register(&scmi_dev->dev); | 149 | retval = device_register(&scmi_dev->dev); |
| @@ -156,9 +162,8 @@ free_mem: · 12 unmodified lines | |||
| 156 | void scmi_device_destroy(struct scmi_device *scmi_dev) | 162 | void scmi_device_destroy(struct scmi_device *scmi_dev) |
| 157 | { | 163 | { |
| 158 | scmi_handle_put(scmi_dev->handle); | 164 | scmi_handle_put(scmi_dev->handle); |
| 159 | device_unregister(&scmi_dev->dev); | ||
| 160 | ida_simple_remove(&scmi_bus_id, scmi_dev->id); | 165 | ida_simple_remove(&scmi_bus_id, scmi_dev->id); |
| 161 | kfree(scmi_dev); | 166 | device_unregister(&scmi_dev->dev); |
| 162 | } | 167 | } |
| 163 | 168 | ||
| 164 | void scmi_set_handle(struct scmi_device *scmi_dev) | 169 | void scmi_set_handle(struct scmi_device *scmi_dev) |
| @@ -37,8 +37,9 @@ extern u64 efi_system_table; · 36 unmodified lines | |||
| 37 | static struct ptdump_info efi_ptdump_info = { | 37 | static struct ptdump_info efi_ptdump_info = { |
| 38 | .mm = &efi_mm, | 38 | .mm = &efi_mm, |
| 39 | .markers = (struct addr_marker[]){ | 39 | .markers = (struct addr_marker[]){ |
| 40 | { 0, "UEFI runtime start" }, | 40 | { 0, "UEFI runtime start" }, |
| 41 | { DEFAULT_MAP_WINDOW_64, "UEFI runtime end" } | 41 | { DEFAULT_MAP_WINDOW_64, "UEFI runtime end" }, |
| 42 | { -1, NULL } | ||
| 42 | }, | 43 | }, |
| 43 | .base_addr = 0, | 44 | .base_addr = 0, |
| 44 | }; | 45 | }; |
| @@ -508,14 +508,11 @@ static int __init s10_init(void) · 507 unmodified lines | |||
| 508 | return -ENODEV; | 508 | return -ENODEV; |
| 509 | 509 | ||
| 510 | np = of_find_matching_node(fw_np, s10_of_match); | 510 | np = of_find_matching_node(fw_np, s10_of_match); |
| 511 | if (!np) { | 511 | if (!np) |
| 512 | of_node_put(fw_np); | ||
| 513 | return -ENODEV; | 512 | return -ENODEV; |
| 514 | } | ||
| 515 | 513 | ||
| 516 | of_node_put(np); | 514 | of_node_put(np); |
| 517 | ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL); | 515 | ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL); |
| 518 | of_node_put(fw_np); | ||
| 519 | if (ret) | 516 | if (ret) |
| 520 | return ret; | 517 | return ret; |
| 521 | 518 | ||
| @@ -66,8 +66,10 @@ static int altr_a10sr_gpio_direction_input(struct gpio_chip *gc, · 65 unmodified lines | |||
| 66 | static int altr_a10sr_gpio_direction_output(struct gpio_chip *gc, | 66 | static int altr_a10sr_gpio_direction_output(struct gpio_chip *gc, |
| 67 | unsigned int nr, int value) | 67 | unsigned int nr, int value) |
| 68 | { | 68 | { |
| 69 | if (nr <= (ALTR_A10SR_OUT_VALID_RANGE_HI - ALTR_A10SR_LED_VALID_SHIFT)) | 69 | if (nr <= (ALTR_A10SR_OUT_VALID_RANGE_HI - ALTR_A10SR_LED_VALID_SHIFT)) { |
| 70 | altr_a10sr_gpio_set(gc, nr, value); | ||
| 70 | return 0; | 71 | return 0; |
| 72 | } | ||
| 71 | return -EINVAL; | 73 | return -EINVAL; |
| 72 | } | 74 | } |
| 73 | 75 | ||
| @@ -180,7 +180,18 @@ static void sprd_eic_free(struct gpio_chip *chip, unsigned int offset) · 179 unmodified lines | |||
| 180 | 180 | ||
| 181 | static int sprd_eic_get(struct gpio_chip *chip, unsigned int offset) | 181 | static int sprd_eic_get(struct gpio_chip *chip, unsigned int offset) |
| 182 | { | 182 | { |
| 183 | return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA); | 183 | struct sprd_eic *sprd_eic = gpiochip_get_data(chip); |
| 184 | |||
| 185 | switch (sprd_eic->type) { | ||
| 186 | case SPRD_EIC_DEBOUNCE: | ||
| 187 | return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA); | ||
| 188 | case SPRD_EIC_ASYNC: | ||
| 189 | return sprd_eic_read(chip, offset, SPRD_EIC_ASYNC_DATA); | ||
| 190 | case SPRD_EIC_SYNC: | ||
| 191 | return sprd_eic_read(chip, offset, SPRD_EIC_SYNC_DATA); | ||
| 192 | default: | ||
| 193 | return -ENOTSUPP; | ||
| 194 | } | ||
| 184 | } | 195 | } |
| 185 | 196 | ||
| 186 | static int sprd_eic_direction_input(struct gpio_chip *chip, unsigned int offset) | 197 | static int sprd_eic_direction_input(struct gpio_chip *chip, unsigned int offset) |
| @@ -368,6 +379,7 @@ static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type) · 181 unmodified lines | |||
| 368 | irq_set_handler_locked(data, handle_edge_irq); | 379 | irq_set_handler_locked(data, handle_edge_irq); |
| 369 | break; | 380 | break; |
| 370 | case IRQ_TYPE_EDGE_BOTH: | 381 | case IRQ_TYPE_EDGE_BOTH: |
| 382 | sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 0); | ||
| 371 | sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 1); | 383 | sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 1); |
| 372 | irq_set_handler_locked(data, handle_edge_irq); | 384 | irq_set_handler_locked(data, handle_edge_irq); |
| 373 | break; | 385 | break; |
| @@ -289,7 +289,7 @@ static bool pca953x_volatile_register(struct device *dev, unsigned int reg) · 288 unmodified lines | |||
| 289 | return pca953x_check_register(chip, reg, bank); | 289 | return pca953x_check_register(chip, reg, bank); |
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | const struct regmap_config pca953x_i2c_regmap = { | 292 | static const struct regmap_config pca953x_i2c_regmap = { |
| 293 | .reg_bits = 8, | 293 | .reg_bits = 8, |
| 294 | .val_bits = 8, | 294 | .val_bits = 8, |
| 295 | 295 | ||
| @@ -84,6 +84,7 @@ MODULE_DEVICE_TABLE(of, pcf857x_of_table); · 83 unmodified lines | |||
| 84 | */ | 84 | */ |
| 85 | struct pcf857x { | 85 | struct pcf857x { |
| 86 | struct gpio_chip chip; | 86 | struct gpio_chip chip; |
| 87 | struct irq_chip irqchip; | ||
| 87 | struct i2c_client *client; | 88 | struct i2c_client *client; |
| 88 | struct mutex lock; /* protect 'out' */ | 89 | struct mutex lock; /* protect 'out' */ |
| 89 | unsigned out; /* software latch */ | 90 | unsigned out; /* software latch */ |
| @@ -252,18 +253,6 @@ static void pcf857x_irq_bus_sync_unlock(struct irq_data *data) · 162 unmodified lines | |||
| 252 | mutex_unlock(&gpio->lock); | 253 | mutex_unlock(&gpio->lock); |
| 253 | } | 254 | } |
| 254 | 255 | ||
| 255 | static struct irq_chip pcf857x_irq_chip = { | ||
| 256 | .name = "pcf857x", | ||
| 257 | .irq_enable = pcf857x_irq_enable, | ||
| 258 | .irq_disable = pcf857x_irq_disable, | ||
| 259 | .irq_ack = noop, | ||
| 260 | .irq_mask = noop, | ||
| 261 | .irq_unmask = noop, | ||
| 262 | .irq_set_wake = pcf857x_irq_set_wake, | ||
| 263 | .irq_bus_lock = pcf857x_irq_bus_lock, | ||
| 264 | .irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock, | ||
| 265 | }; | ||
| 266 | |||
| 267 | /*-------------------------------------------------------------------------*/ | 256 | /*-------------------------------------------------------------------------*/ |
| 268 | 257 | ||
| 269 | static int pcf857x_probe(struct i2c_client *client, | 258 | static int pcf857x_probe(struct i2c_client *client, |
| @@ -376,8 +365,17 @@ static int pcf857x_probe(struct i2c_client *client, · 106 unmodified lines | |||
| 376 | 365 | ||
| 377 | /* Enable irqchip if we have an interrupt */ | 366 | /* Enable irqchip if we have an interrupt */ |
| 378 | if (client->irq) { | 367 | if (client->irq) { |
| 368 | gpio->irqchip.name = "pcf857x", | ||
| 369 | gpio->irqchip.irq_enable = pcf857x_irq_enable, | ||
| 370 | gpio->irqchip.irq_disable = pcf857x_irq_disable, | ||
| 371 | gpio->irqchip.irq_ack = noop, | ||
| 372 | gpio->irqchip.irq_mask = noop, | ||
| 373 | gpio->irqchip.irq_unmask = noop, | ||
| 374 | gpio->irqchip.irq_set_wake = pcf857x_irq_set_wake, | ||
| 375 | gpio->irqchip.irq_bus_lock = pcf857x_irq_bus_lock, | ||
| 376 | gpio->irqchip.irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock, | ||
| 379 | status = gpiochip_irqchip_add_nested(&gpio->chip, | 377 | status = gpiochip_irqchip_add_nested(&gpio->chip, |
| 380 | &pcf857x_irq_chip, | 378 | &gpio->irqchip, |
| 381 | 0, handle_level_irq, | 379 | 0, handle_level_irq, |
| 382 | IRQ_TYPE_NONE); | 380 | IRQ_TYPE_NONE); |
| 383 | if (status) { | 381 | if (status) { |
| @@ -392,7 +390,7 @@ static int pcf857x_probe(struct i2c_client *client, · 8 unmodified lines | |||
| 392 | if (status) | 390 | if (status) |
| 393 | goto fail; | 391 | goto fail; |
| 394 | 392 | ||
| 395 | gpiochip_set_nested_irqchip(&gpio->chip, &pcf857x_irq_chip, | 393 | gpiochip_set_nested_irqchip(&gpio->chip, &gpio->irqchip, |
| 396 | client->irq); | 394 | client->irq); |
| 397 | gpio->irq_parent = client->irq; | 395 | gpio->irq_parent = client->irq; |
| 398 | } | 396 | } |
| @@ -253,6 +253,7 @@ static int vf610_gpio_probe(struct platform_device *pdev) · 252 unmodified lines | |||
| 253 | struct vf610_gpio_port *port; | 253 | struct vf610_gpio_port *port; |
| 254 | struct resource *iores; | 254 | struct resource *iores; |
| 255 | struct gpio_chip *gc; | 255 | struct gpio_chip *gc; |
| 256 | int i; | ||
| 256 | int ret; | 257 | int ret; |
| 257 | 258 | ||
| 258 | port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); | 259 | port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); |
| @@ -319,6 +320,10 @@ static int vf610_gpio_probe(struct platform_device *pdev) · 60 unmodified lines | |||
| 319 | if (ret < 0) | 320 | if (ret < 0) |
| 320 | return ret; | 321 | return ret; |
| 321 | 322 | ||
| 323 | /* Mask all GPIO interrupts */ | ||
| 324 | for (i = 0; i < gc->ngpio; i++) | ||
| 325 | vf610_gpio_writel(0, port->base + PORT_PCR(i)); | ||
| 326 | |||
| 322 | /* Clear the interrupt status register for all GPIO's */ | 327 | /* Clear the interrupt status register for all GPIO's */ |
| 323 | vf610_gpio_writel(~0, port->base + PORT_ISFR); | 328 | vf610_gpio_writel(~0, port->base + PORT_ISFR); |
| 324 | 329 | ||
| @@ -357,8 +357,6 @@ void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) · 356 unmodified lines | |||
| 357 | mutex_unlock(&acpi_gpio_deferred_req_irqs_lock); | 357 | mutex_unlock(&acpi_gpio_deferred_req_irqs_lock); |
| 358 | 358 | ||
| 359 | list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { | 359 | list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { |
| 360 | struct gpio_desc *desc; | ||
| 361 | |||
| 362 | if (event->irq_requested) { | 360 | if (event->irq_requested) { |
| 363 | if (event->irq_is_wake) | 361 | if (event->irq_is_wake) |
| 364 | disable_irq_wake(event->irq); | 362 | disable_irq_wake(event->irq); |
| @@ -366,11 +364,8 @@ void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) · 1 unmodified line | |||
| 366 | free_irq(event->irq, event); | 364 | free_irq(event->irq, event); |
| 367 | } | 365 | } |
| 368 | 366 | ||
| 369 | desc = event->desc; | ||
| 370 | if (WARN_ON(IS_ERR(desc))) | ||
| 371 | continue; | ||
| 372 | gpiochip_unlock_as_irq(chip, event->pin); | 367 | gpiochip_unlock_as_irq(chip, event->pin); |
| 373 | gpiochip_free_own_desc(desc); | 368 | gpiochip_free_own_desc(event->desc); |
| 374 | list_del(&event->node); | 369 | list_del(&event->node); |
| 375 | kfree(event); | 370 | kfree(event); |
| 376 | } | 371 | } |
| @@ -828,7 +828,14 @@ static irqreturn_t lineevent_irq_thread(int irq, void *p) · 827 unmodified lines | |||
| 828 | /* Do not leak kernel stack to userspace */ | 828 | /* Do not leak kernel stack to userspace */ |
| 829 | memset(&ge, 0, sizeof(ge)); | 829 | memset(&ge, 0, sizeof(ge)); |
| 830 | 830 | ||
| 831 | ge.timestamp = le->timestamp; | 831 | /* |
| 832 | * We may be running from a nested threaded interrupt in which case | ||
| 833 | * we didn't get the timestamp from lineevent_irq_handler(). | ||
| 834 | */ | ||
| 835 | if (!le->timestamp) | ||
| 836 | ge.timestamp = ktime_get_real_ns(); | ||
| 837 | else | ||
| 838 | ge.timestamp = le->timestamp; | ||
| 832 | 839 | ||
| 833 | if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE | 840 | if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE |
| 834 | && le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) { | 841 | && le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) { |
| @@ -576,6 +576,7 @@ static const struct amdgpu_px_quirk amdgpu_px_quirk_list[] = { · 575 unmodified lines | |||
| 576 | { 0x1002, 0x6900, 0x1028, 0x0812, AMDGPU_PX_QUIRK_FORCE_ATPX }, | 576 | { 0x1002, 0x6900, 0x1028, 0x0812, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
| 577 | { 0x1002, 0x6900, 0x1028, 0x0813, AMDGPU_PX_QUIRK_FORCE_ATPX }, | 577 | { 0x1002, 0x6900, 0x1028, 0x0813, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
| 578 | { 0x1002, 0x6900, 0x1025, 0x125A, AMDGPU_PX_QUIRK_FORCE_ATPX }, | 578 | { 0x1002, 0x6900, 0x1025, 0x125A, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
| 579 | { 0x1002, 0x6900, 0x17AA, 0x3806, AMDGPU_PX_QUIRK_FORCE_ATPX }, | ||
| 579 | { 0, 0, 0, 0, 0 }, | 580 | { 0, 0, 0, 0, 0 }, |
| 580 | }; | 581 | }; |
| 581 | 582 | ||
| @@ -1701,8 +1701,10 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev) · 1700 unmodified lines | |||
| 1701 | amdgpu_xgmi_add_device(adev); | 1701 | amdgpu_xgmi_add_device(adev); |
| 1702 | amdgpu_amdkfd_device_init(adev); | 1702 | amdgpu_amdkfd_device_init(adev); |
| 1703 | 1703 | ||
| 1704 | if (amdgpu_sriov_vf(adev)) | 1704 | if (amdgpu_sriov_vf(adev)) { |
| 1705 | amdgpu_virt_init_data_exchange(adev); | ||
| 1705 | amdgpu_virt_release_full_gpu(adev, true); | 1706 | amdgpu_virt_release_full_gpu(adev, true); |
| 1707 | } | ||
| 1706 | 1708 | ||
| 1707 | return 0; | 1709 | return 0; |
| 1708 | } | 1710 | } |
| @@ -2632,9 +2634,6 @@ fence_driver_init: · 923 unmodified lines | |||
| 2632 | goto failed; | 2634 | goto failed; |
| 2633 | } | 2635 | } |
| 2634 | 2636 | ||
| 2635 | if (amdgpu_sriov_vf(adev)) | ||
| 2636 | amdgpu_virt_init_data_exchange(adev); | ||
| 2637 | |||
| 2638 | amdgpu_fbdev_init(adev); | 2637 | amdgpu_fbdev_init(adev); |
| 2639 | 2638 | ||
| 2640 | r = amdgpu_pm_sysfs_init(adev); | 2639 | r = amdgpu_pm_sysfs_init(adev); |
| @@ -2798,7 +2797,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) · 157 unmodified lines | |||
| 2798 | struct drm_framebuffer *fb = crtc->primary->fb; | 2797 | struct drm_framebuffer *fb = crtc->primary->fb; |
| 2799 | struct amdgpu_bo *robj; | 2798 | struct amdgpu_bo *robj; |
| 2800 | 2799 | ||
| 2801 | if (amdgpu_crtc->cursor_bo) { | 2800 | if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) { |
| 2802 | struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo); | 2801 | struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo); |
| 2803 | r = amdgpu_bo_reserve(aobj, true); | 2802 | r = amdgpu_bo_reserve(aobj, true); |
| 2804 | if (r == 0) { | 2803 | if (r == 0) { |
| @@ -2906,7 +2905,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon) · 101 unmodified lines | |||
| 2906 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 2905 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
| 2907 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 2906 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
| 2908 | 2907 | ||
| 2909 | if (amdgpu_crtc->cursor_bo) { | 2908 | if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) { |
| 2910 | struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo); | 2909 | struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo); |
| 2911 | r = amdgpu_bo_reserve(aobj, true); | 2910 | r = amdgpu_bo_reserve(aobj, true); |
| 2912 | if (r == 0) { | 2911 | if (r == 0) { |
| @@ -3226,6 +3225,7 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev, · 313 unmodified lines | |||
| 3226 | r = amdgpu_ib_ring_tests(adev); | 3225 | r = amdgpu_ib_ring_tests(adev); |
| 3227 | 3226 | ||
| 3228 | error: | 3227 | error: |
| 3228 | amdgpu_virt_init_data_exchange(adev); | ||
| 3229 | amdgpu_virt_release_full_gpu(adev, true); | 3229 | amdgpu_virt_release_full_gpu(adev, true); |
| 3230 | if (!r && adev->virt.gim_feature & AMDGIM_FEATURE_GIM_FLR_VRAMLOST) { | 3230 | if (!r && adev->virt.gim_feature & AMDGIM_FEATURE_GIM_FLR_VRAMLOST) { |
| 3231 | atomic_inc(&adev->vram_lost_counter); | 3231 | atomic_inc(&adev->vram_lost_counter); |
| @@ -188,10 +188,12 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, · 187 unmodified lines | |||
| 188 | goto cleanup; | 188 | goto cleanup; |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | r = amdgpu_bo_pin(new_abo, amdgpu_display_supported_domains(adev)); | 191 | if (!adev->enable_virtual_display) { |
| 192 | if (unlikely(r != 0)) { | 192 | r = amdgpu_bo_pin(new_abo, amdgpu_display_supported_domains(adev)); |
| 193 | DRM_ERROR("failed to pin new abo buffer before flip\n"); | 193 | if (unlikely(r != 0)) { |
| 194 | goto unreserve; | 194 | DRM_ERROR("failed to pin new abo buffer before flip\n"); |
| 195 | goto unreserve; | ||
| 196 | } | ||
| 195 | } | 197 | } |
| 196 | 198 | ||
| 197 | r = amdgpu_ttm_alloc_gart(&new_abo->tbo); | 199 | r = amdgpu_ttm_alloc_gart(&new_abo->tbo); |
| @@ -211,7 +213,8 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, · 13 unmodified lines | |||
| 211 | amdgpu_bo_get_tiling_flags(new_abo, &tiling_flags); | 213 | amdgpu_bo_get_tiling_flags(new_abo, &tiling_flags); |
| 212 | amdgpu_bo_unreserve(new_abo); | 214 | amdgpu_bo_unreserve(new_abo); |
| 213 | 215 | ||
| 214 | work->base = amdgpu_bo_gpu_offset(new_abo); | 216 | if (!adev->enable_virtual_display) |
| 217 | work->base = amdgpu_bo_gpu_offset(new_abo); | ||
| 215 | work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) + | 218 | work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) + |
| 216 | amdgpu_get_vblank_counter_kms(dev, work->crtc_id); | 219 | amdgpu_get_vblank_counter_kms(dev, work->crtc_id); |
| 217 | 220 | ||
| @@ -242,9 +245,10 @@ pflip_cleanup: · 24 unmodified lines | |||
| 242 | goto cleanup; | 245 | goto cleanup; |
| 243 | } | 246 | } |
| 244 | unpin: | 247 | unpin: |
| 245 | if (unlikely(amdgpu_bo_unpin(new_abo) != 0)) { | 248 | if (!adev->enable_virtual_display) |
| 246 | DRM_ERROR("failed to unpin new abo in error path\n"); | 249 | if (unlikely(amdgpu_bo_unpin(new_abo) != 0)) |
| 247 | } | 250 | DRM_ERROR("failed to unpin new abo in error path\n"); |
| 251 | |||
| 248 | unreserve: | 252 | unreserve: |
| 249 | amdgpu_bo_unreserve(new_abo); | 253 | amdgpu_bo_unreserve(new_abo); |
| 250 | 254 | ||
| @@ -1686,7 +1686,8 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj, · 1685 unmodified lines | |||
| 1686 | effective_mode &= ~S_IWUSR; | 1686 | effective_mode &= ~S_IWUSR; |
| 1687 | 1687 | ||
| 1688 | if ((adev->flags & AMD_IS_APU) && | 1688 | if ((adev->flags & AMD_IS_APU) && |
| 1689 | (attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr || | 1689 | (attr == &sensor_dev_attr_power1_average.dev_attr.attr || |
| 1690 | attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr || | ||
| 1690 | attr == &sensor_dev_attr_power1_cap_min.dev_attr.attr|| | 1691 | attr == &sensor_dev_attr_power1_cap_min.dev_attr.attr|| |
| 1691 | attr == &sensor_dev_attr_power1_cap.dev_attr.attr)) | 1692 | attr == &sensor_dev_attr_power1_cap.dev_attr.attr)) |
| 1692 | return 0; | 1693 | return 0; |
| @@ -2008,6 +2009,7 @@ void amdgpu_pm_print_power_states(struct amdgpu_device *adev) · 315 unmodified lines | |||
| 2008 | 2009 | ||
| 2009 | int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) | 2010 | int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) |
| 2010 | { | 2011 | { |
| 2012 | struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; | ||
| 2011 | int ret; | 2013 | int ret; |
| 2012 | 2014 | ||
| 2013 | if (adev->pm.sysfs_initialized) | 2015 | if (adev->pm.sysfs_initialized) |
| @@ -2091,12 +2093,14 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) · 77 unmodified lines | |||
| 2091 | "pp_power_profile_mode\n"); | 2093 | "pp_power_profile_mode\n"); |
| 2092 | return ret; | 2094 | return ret; |
| 2093 | } | 2095 | } |
| 2094 | ret = device_create_file(adev->dev, | 2096 | if (hwmgr->od_enabled) { |
| 2095 | &dev_attr_pp_od_clk_voltage); | 2097 | ret = device_create_file(adev->dev, |
| 2096 | if (ret) { | 2098 | &dev_attr_pp_od_clk_voltage); |
| 2097 | DRM_ERROR("failed to create device file " | 2099 | if (ret) { |
| 2098 | "pp_od_clk_voltage\n"); | 2100 | DRM_ERROR("failed to create device file " |
| 2099 | return ret; | 2101 | "pp_od_clk_voltage\n"); |
| 2102 | return ret; | ||
| 2103 | } | ||
| 2100 | } | 2104 | } |
| 2101 | ret = device_create_file(adev->dev, | 2105 | ret = device_create_file(adev->dev, |
| 2102 | &dev_attr_gpu_busy_percent); | 2106 | &dev_attr_gpu_busy_percent); |
| @@ -2118,6 +2122,8 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) · 15 unmodified lines | |||
| 2118 | 2122 | ||
| 2119 | void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev) | 2123 | void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev) |
| 2120 | { | 2124 | { |
| 2125 | struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; | ||
| 2126 | |||
| 2121 | if (adev->pm.dpm_enabled == 0) | 2127 | if (adev->pm.dpm_enabled == 0) |
| 2122 | return; | 2128 | return; |
| 2123 | 2129 | ||
| @@ -2138,8 +2144,9 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev) · 14 unmodified lines | |||
| 2138 | device_remove_file(adev->dev, &dev_attr_pp_mclk_od); | 2144 | device_remove_file(adev->dev, &dev_attr_pp_mclk_od); |
| 2139 | device_remove_file(adev->dev, | 2145 | device_remove_file(adev->dev, |
| 2140 | &dev_attr_pp_power_profile_mode); | 2146 | &dev_attr_pp_power_profile_mode); |
| 2141 | device_remove_file(adev->dev, | 2147 | if (hwmgr->od_enabled) |
| 2142 | &dev_attr_pp_od_clk_voltage); | 2148 | device_remove_file(adev->dev, |
| 2149 | &dev_attr_pp_od_clk_voltage); | ||
| 2143 | device_remove_file(adev->dev, &dev_attr_gpu_busy_percent); | 2150 | device_remove_file(adev->dev, &dev_attr_gpu_busy_percent); |
| 2144 | } | 2151 | } |
| 2145 | 2152 | ||
| @@ -38,6 +38,7 @@ · 37 unmodified lines | |||
| 38 | #include "amdgpu_gem.h" | 38 | #include "amdgpu_gem.h" |
| 39 | #include <drm/amdgpu_drm.h> | 39 | #include <drm/amdgpu_drm.h> |
| 40 | #include <linux/dma-buf.h> | 40 | #include <linux/dma-buf.h> |
| 41 | #include <linux/dma-fence-array.h> | ||
| 41 | 42 | ||
| 42 | /** | 43 | /** |
| 43 | * amdgpu_gem_prime_get_sg_table - &drm_driver.gem_prime_get_sg_table | 44 | * amdgpu_gem_prime_get_sg_table - &drm_driver.gem_prime_get_sg_table |
| @@ -187,6 +188,48 @@ error: · 143 unmodified lines | |||
| 187 | return ERR_PTR(ret); | 188 | return ERR_PTR(ret); |
| 188 | } | 189 | } |
| 189 | 190 | ||
| 191 | static int | ||
| 192 | __reservation_object_make_exclusive(struct reservation_object *obj) | ||
| 193 | { | ||
| 194 | struct dma_fence **fences; | ||
| 195 | unsigned int count; | ||
| 196 | int r; | ||
| 197 | |||
| 198 | if (!reservation_object_get_list(obj)) /* no shared fences to convert */ | ||
| 199 | return 0; | ||
| 200 | |||
| 201 | r = reservation_object_get_fences_rcu(obj, NULL, &count, &fences); | ||
| 202 | if (r) | ||
| 203 | return r; | ||
| 204 | |||
| 205 | if (count == 0) { | ||
| 206 | /* Now that was unexpected. */ | ||
| 207 | } else if (count == 1) { | ||
| 208 | reservation_object_add_excl_fence(obj, fences[0]); | ||
| 209 | dma_fence_put(fences[0]); | ||
| 210 | kfree(fences); | ||
| 211 | } else { | ||
| 212 | struct dma_fence_array *array; | ||
| 213 | |||
| 214 | array = dma_fence_array_create(count, fences, | ||
| 215 | dma_fence_context_alloc(1), 0, | ||
| 216 | false); | ||
| 217 | if (!array) | ||
| 218 | goto err_fences_put; | ||
| 219 | |||
| 220 | reservation_object_add_excl_fence(obj, &array->base); | ||
| 221 | dma_fence_put(&array->base); | ||
| 222 | } | ||
| 223 | |||
| 224 | return 0; | ||
| 225 | |||
| 226 | err_fences_put: | ||
| 227 | while (count--) | ||
| 228 | dma_fence_put(fences[count]); | ||
| 229 | kfree(fences); | ||
| 230 | return -ENOMEM; | ||
| 231 | } | ||
| 232 | |||
| 190 | /** | 233 | /** |
| 191 | * amdgpu_gem_map_attach - &dma_buf_ops.attach implementation | 234 | * amdgpu_gem_map_attach - &dma_buf_ops.attach implementation |
| 192 | * @dma_buf: Shared DMA buffer | 235 | * @dma_buf: Shared DMA buffer |
| @@ -218,16 +261,16 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_buf, · 25 unmodified lines | |||
| 218 | 261 | ||
| 219 | if (attach->dev->driver != adev->dev->driver) { | 262 | if (attach->dev->driver != adev->dev->driver) { |
| 220 | /* | 263 | /* |
| 221 | * Wait for all shared fences to complete before we switch to future | 264 | * We only create shared fences for internal use, but importers |
| 222 | * use of exclusive fence on this prime shared bo. | 265 | * of the dmabuf rely on exclusive fences for implicitly |
| 266 | * tracking write hazards. As any of the current fences may | ||
| 267 | * correspond to a write, we need to convert all existing | ||
| 268 | * fences on the reservation object into a single exclusive | ||
| 269 | * fence. | ||
| 223 | */ | 270 | */ |
| 224 | r = reservation_object_wait_timeout_rcu(bo->tbo.resv, | 271 | r = __reservation_object_make_exclusive(bo->tbo.resv); |
| 225 | true, false, | 272 | if (r) |
| 226 | MAX_SCHEDULE_TIMEOUT); | ||
| 227 | if (unlikely(r < 0)) { | ||
| 228 | DRM_DEBUG_PRIME("Fence wait failed: %li\n", r); | ||
| 229 | goto error_unreserve; | 273 | goto error_unreserve; |
| 230 | } | ||
| 231 | } | 274 | } |
| 232 | 275 | ||
| 233 | /* pin buffer into GTT */ | 276 | /* pin buffer into GTT */ |
| @@ -847,9 +847,6 @@ static void amdgpu_vm_bo_param(struct amdgpu_device *adev, struct amdgpu_vm *vm, · 846 unmodified lines | |||
| 847 | bp->size = amdgpu_vm_bo_size(adev, level); | 847 | bp->size = amdgpu_vm_bo_size(adev, level); |
| 848 | bp->byte_align = AMDGPU_GPU_PAGE_SIZE; | 848 | bp->byte_align = AMDGPU_GPU_PAGE_SIZE; |
| 849 | bp->domain = AMDGPU_GEM_DOMAIN_VRAM; | 849 | bp->domain = AMDGPU_GEM_DOMAIN_VRAM; |
| 850 | if (bp->size <= PAGE_SIZE && adev->asic_type >= CHIP_VEGA10 && | ||
| 851 | adev->flags & AMD_IS_APU) | ||
| 852 | bp->domain |= AMDGPU_GEM_DOMAIN_GTT; | ||
| 853 | bp->domain = amdgpu_bo_get_preferred_pin_domain(adev, bp->domain); | 850 | bp->domain = amdgpu_bo_get_preferred_pin_domain(adev, bp->domain); |
| 854 | bp->flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | | 851 | bp->flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | |
| 855 | AMDGPU_GEM_CREATE_CPU_GTT_USWC; | 852 | AMDGPU_GEM_CREATE_CPU_GTT_USWC; |
| @@ -3366,14 +3363,15 @@ void amdgpu_vm_get_task_info(struct amdgpu_device *adev, unsigned int pasid, · 2510 unmodified lines | |||
| 3366 | struct amdgpu_task_info *task_info) | 3363 | struct amdgpu_task_info *task_info) |
| 3367 | { | 3364 | { |
| 3368 | struct amdgpu_vm *vm; | 3365 | struct amdgpu_vm *vm; |
| 3366 | unsigned long flags; | ||
| 3369 | 3367 | ||
| 3370 | spin_lock(&adev->vm_manager.pasid_lock); | 3368 | spin_lock_irqsave(&adev->vm_manager.pasid_lock, flags); |
| 3371 | 3369 | ||
| 3372 | vm = idr_find(&adev->vm_manager.pasid_idr, pasid); | 3370 | vm = idr_find(&adev->vm_manager.pasid_idr, pasid); |
| 3373 | if (vm) | 3371 | if (vm) |
| 3374 | *task_info = vm->task_info; | 3372 | *task_info = vm->task_info; |
| 3375 | 3373 | ||
| 3376 | spin_unlock(&adev->vm_manager.pasid_lock); | 3374 | spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, flags); |
| 3377 | } | 3375 | } |
| 3378 | 3376 | ||
| 3379 | /** | 3377 | /** |
| @@ -167,19 +167,6 @@ static void dce_virtual_crtc_disable(struct drm_crtc *crtc) · 166 unmodified lines | |||
| 167 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 167 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
| 168 | 168 | ||
| 169 | dce_virtual_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); | 169 | dce_virtual_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); |
| 170 | if (crtc->primary->fb) { | ||
| 171 | int r; | ||
| 172 | struct amdgpu_bo *abo; | ||
| 173 | |||
| 174 | abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); | ||
| 175 | r = amdgpu_bo_reserve(abo, true); | ||
| 176 | if (unlikely(r)) | ||
| 177 | DRM_ERROR("failed to reserve abo before unpin\n"); | ||
| 178 | else { | ||
| 179 | amdgpu_bo_unpin(abo); | ||
| 180 | amdgpu_bo_unreserve(abo); | ||
| 181 | } | ||
| 182 | } | ||
| 183 | 170 | ||
| 184 | amdgpu_crtc->pll_id = ATOM_PPLL_INVALID; | 171 | amdgpu_crtc->pll_id = ATOM_PPLL_INVALID; |
| 185 | amdgpu_crtc->encoder = NULL; | 172 | amdgpu_crtc->encoder = NULL; |
| @@ -692,7 +679,9 @@ static int dce_virtual_pageflip(struct amdgpu_device *adev, · 506 unmodified lines | |||
| 692 | spin_unlock_irqrestore(&adev->ddev->event_lock, flags); | 679 | spin_unlock_irqrestore(&adev->ddev->event_lock, flags); |
| 693 | 680 | ||
| 694 | drm_crtc_vblank_put(&amdgpu_crtc->base); | 681 | drm_crtc_vblank_put(&amdgpu_crtc->base); |
| 695 | schedule_work(&works->unpin_work); | 682 | amdgpu_bo_unref(&works->old_abo); |
| 683 | kfree(works->shared); | ||
| 684 | kfree(works); | ||
| 696 | 685 | ||
| 697 | return 0; | 686 | return 0; |
| 698 | } | 687 | } |
| @@ -4233,7 +4233,6 @@ static int gfx_v8_0_cp_gfx_resume(struct amdgpu_device *adev) · 4232 unmodified lines | |||
| 4233 | u32 tmp; | 4233 | u32 tmp; |
| 4234 | u32 rb_bufsz; | 4234 | u32 rb_bufsz; |
| 4235 | u64 rb_addr, rptr_addr, wptr_gpu_addr; | 4235 | u64 rb_addr, rptr_addr, wptr_gpu_addr; |
| 4236 | int r; | ||
| 4237 | 4236 | ||
| 4238 | /* Set the write pointer delay */ | 4237 | /* Set the write pointer delay */ |
| 4239 | WREG32(mmCP_RB_WPTR_DELAY, 0); | 4238 | WREG32(mmCP_RB_WPTR_DELAY, 0); |
| @@ -4278,9 +4277,8 @@ static int gfx_v8_0_cp_gfx_resume(struct amdgpu_device *adev) · 38 unmodified lines | |||
| 4278 | amdgpu_ring_clear_ring(ring); | 4277 | amdgpu_ring_clear_ring(ring); |
| 4279 | gfx_v8_0_cp_gfx_start(adev); | 4278 | gfx_v8_0_cp_gfx_start(adev); |
| 4280 | ring->sched.ready = true; | 4279 | ring->sched.ready = true; |
| 4281 | r = amdgpu_ring_test_helper(ring); | ||
| 4282 | 4280 | ||
| 4283 | return r; | 4281 | return 0; |
| 4284 | } | 4282 | } |
| 4285 | 4283 | ||
| 4286 | static void gfx_v8_0_cp_compute_enable(struct amdgpu_device *adev, bool enable) | 4284 | static void gfx_v8_0_cp_compute_enable(struct amdgpu_device *adev, bool enable) |
| @@ -4369,10 +4367,9 @@ static int gfx_v8_0_kiq_kcq_enable(struct amdgpu_device *adev) · 82 unmodified lines | |||
| 4369 | amdgpu_ring_write(kiq_ring, upper_32_bits(wptr_addr)); | 4367 | amdgpu_ring_write(kiq_ring, upper_32_bits(wptr_addr)); |
| 4370 | } | 4368 | } |
| 4371 | 4369 | ||
| 4372 | r = amdgpu_ring_test_helper(kiq_ring); | 4370 | amdgpu_ring_commit(kiq_ring); |
| 4373 | if (r) | 4371 | |
| 4374 | DRM_ERROR("KCQ enable failed\n"); | 4372 | return 0; |
| 4375 | return r; | ||
| 4376 | } | 4373 | } |
| 4377 | 4374 | ||
| 4378 | static int gfx_v8_0_deactivate_hqd(struct amdgpu_device *adev, u32 req) | 4375 | static int gfx_v8_0_deactivate_hqd(struct amdgpu_device *adev, u32 req) |
| @@ -4709,16 +4706,32 @@ static int gfx_v8_0_kcq_resume(struct amdgpu_device *adev) · 330 unmodified lines | |||
| 4709 | if (r) | 4706 | if (r) |
| 4710 | goto done; | 4707 | goto done; |
| 4711 | 4708 | ||
| 4712 | /* Test KCQs - reversing the order of rings seems to fix ring test failure | 4709 | done: |
| 4713 | * after GPU reset | 4710 | return r; |
| 4714 | */ | 4711 | } |
| 4715 | for (i = adev->gfx.num_compute_rings - 1; i >= 0; i--) { | 4712 | |
| 4713 | static int gfx_v8_0_cp_test_all_rings(struct amdgpu_device *adev) | ||
| 4714 | { | ||
| 4715 | int r, i; | ||
| 4716 | struct amdgpu_ring *ring; | ||
| 4717 | |||
| 4718 | /* collect all the ring_tests here, gfx, kiq, compute */ | ||
| 4719 | ring = &adev->gfx.gfx_ring[0]; | ||
| 4720 | r = amdgpu_ring_test_helper(ring); | ||
| 4721 | if (r) | ||
| 4722 | return r; | ||
| 4723 | |||
| 4724 | ring = &adev->gfx.kiq.ring; | ||
| 4725 | r = amdgpu_ring_test_helper(ring); | ||
| 4726 | if (r) | ||
| 4727 | return r; | ||
| 4728 | |||
| 4729 | for (i = 0; i < adev->gfx.num_compute_rings; i++) { | ||
| 4716 | ring = &adev->gfx.compute_ring[i]; | 4730 | ring = &adev->gfx.compute_ring[i]; |
| 4717 | r = amdgpu_ring_test_helper(ring); | 4731 | amdgpu_ring_test_helper(ring); |
| 4718 | } | 4732 | } |
| 4719 | 4733 | ||
| 4720 | done: | 4734 | return 0; |
| 4721 | return r; | ||
| 4722 | } | 4735 | } |
| 4723 | 4736 | ||
| 4724 | static int gfx_v8_0_cp_resume(struct amdgpu_device *adev) | 4737 | static int gfx_v8_0_cp_resume(struct amdgpu_device *adev) |
| @@ -4739,6 +4752,11 @@ static int gfx_v8_0_cp_resume(struct amdgpu_device *adev) · 14 unmodified lines | |||
| 4739 | r = gfx_v8_0_kcq_resume(adev); | 4752 | r = gfx_v8_0_kcq_resume(adev); |
| 4740 | if (r) | 4753 | if (r) |
| 4741 | return r; | 4754 | return r; |
| 4755 | |||
| 4756 | r = gfx_v8_0_cp_test_all_rings(adev); | ||
| 4757 | if (r) | ||
| 4758 | return r; | ||
| 4759 | |||
| 4742 | gfx_v8_0_enable_gui_idle_interrupt(adev, true); | 4760 | gfx_v8_0_enable_gui_idle_interrupt(adev, true); |
| 4743 | 4761 | ||
| 4744 | return 0; | 4762 | return 0; |
| @@ -5086,6 +5104,8 @@ static int gfx_v8_0_post_soft_reset(void *handle) · 341 unmodified lines | |||
| 5086 | REG_GET_FIELD(grbm_soft_reset, GRBM_SOFT_RESET, SOFT_RESET_GFX)) | 5104 | REG_GET_FIELD(grbm_soft_reset, GRBM_SOFT_RESET, SOFT_RESET_GFX)) |
| 5087 | gfx_v8_0_cp_gfx_resume(adev); | 5105 | gfx_v8_0_cp_gfx_resume(adev); |
| 5088 | 5106 | ||
| 5107 | gfx_v8_0_cp_test_all_rings(adev); | ||
| 5108 | |||
| 5089 | adev->gfx.rlc.funcs->start(adev); | 5109 | adev->gfx.rlc.funcs->start(adev); |
| 5090 | 5110 | ||
| 5091 | return 0; | 5111 | return 0; |
| @@ -113,7 +113,10 @@ static const struct soc15_reg_golden golden_settings_gc_9_0[] = · 112 unmodified lines | |||
| 113 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_CHAN_STEER_HI, 0xffffffff, 0x4a2c0e68), | 113 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_CHAN_STEER_HI, 0xffffffff, 0x4a2c0e68), |
| 114 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_CHAN_STEER_LO, 0xffffffff, 0xb5d3f197), | 114 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_CHAN_STEER_LO, 0xffffffff, 0xb5d3f197), |
| 115 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmVGT_CACHE_INVALIDATION, 0x3fff3af3, 0x19200000), | 115 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmVGT_CACHE_INVALIDATION, 0x3fff3af3, 0x19200000), |
| 116 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmVGT_GS_MAX_WAVE_ID, 0x00000fff, 0x000003ff) | 116 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmVGT_GS_MAX_WAVE_ID, 0x00000fff, 0x000003ff), |
| 117 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_MEC1_F32_INT_DIS, 0x00000000, 0x00000800), | ||
| 118 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_MEC2_F32_INT_DIS, 0x00000000, 0x00000800), | ||
| 119 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_DEBUG, 0x00000000, 0x00008000) | ||
| 117 | }; | 120 | }; |
| 118 | 121 | ||
| 119 | static const struct soc15_reg_golden golden_settings_gc_9_0_vg10[] = | 122 | static const struct soc15_reg_golden golden_settings_gc_9_0_vg10[] = |
| @@ -135,10 +138,7 @@ static const struct soc15_reg_golden golden_settings_gc_9_0_vg10[] = · 15 unmodified lines | |||
| 135 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmRMI_UTCL1_CNTL2, 0x00030000, 0x00020000), | 138 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmRMI_UTCL1_CNTL2, 0x00030000, 0x00020000), |
| 136 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmSPI_CONFIG_CNTL_1, 0x0000000f, 0x01000107), | 139 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmSPI_CONFIG_CNTL_1, 0x0000000f, 0x01000107), |
| 137 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmTD_CNTL, 0x00001800, 0x00000800), | 140 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmTD_CNTL, 0x00001800, 0x00000800), |
| 138 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmWD_UTCL1_CNTL, 0x08000000, 0x08000080), | 141 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmWD_UTCL1_CNTL, 0x08000000, 0x08000080) |
| 139 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_MEC1_F32_INT_DIS, 0x00000000, 0x00000800), | ||
| 140 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_MEC2_F32_INT_DIS, 0x00000000, 0x00000800), | ||
| 141 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_DEBUG, 0x00000000, 0x00008000) | ||
| 142 | }; | 142 | }; |
| 143 | 143 | ||
| 144 | static const struct soc15_reg_golden golden_settings_gc_9_0_vg20[] = | 144 | static const struct soc15_reg_golden golden_settings_gc_9_0_vg20[] = |
| @@ -3587,6 +3587,8 @@ static void gfx_v9_0_update_medium_grain_clock_gating(struct amdgpu_device *adev · 3442 unmodified lines | |||
| 3587 | { | 3587 | { |
| 3588 | uint32_t data, def; | 3588 | uint32_t data, def; |
| 3589 | 3589 | ||
| 3590 | amdgpu_gfx_rlc_enter_safe_mode(adev); | ||
| 3591 | |||
| 3590 | /* It is disabled by HW by default */ | 3592 | /* It is disabled by HW by default */ |
| 3591 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_MGCG)) { | 3593 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_MGCG)) { |
| 3592 | /* 1 - RLC_CGTT_MGCG_OVERRIDE */ | 3594 | /* 1 - RLC_CGTT_MGCG_OVERRIDE */ |
| @@ -3651,6 +3653,8 @@ static void gfx_v9_0_update_medium_grain_clock_gating(struct amdgpu_device *adev · 58 unmodified lines | |||
| 3651 | WREG32_SOC15(GC, 0, mmCP_MEM_SLP_CNTL, data); | 3653 | WREG32_SOC15(GC, 0, mmCP_MEM_SLP_CNTL, data); |
| 3652 | } | 3654 | } |
| 3653 | } | 3655 | } |
| 3656 | |||
| 3657 | amdgpu_gfx_rlc_exit_safe_mode(adev); | ||
| 3654 | } | 3658 | } |
| 3655 | 3659 | ||
| 3656 | static void gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev, | 3660 | static void gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev, |
| @@ -174,7 +174,7 @@ static int xgpu_ai_send_access_requests(struct amdgpu_device *adev, · 173 unmodified lines | |||
| 174 | return r; | 174 | return r; |
| 175 | } | 175 | } |
| 176 | /* Retrieve checksum from mailbox2 */ | 176 | /* Retrieve checksum from mailbox2 */ |
| 177 | if (req == IDH_REQ_GPU_INIT_ACCESS) { | 177 | if (req == IDH_REQ_GPU_INIT_ACCESS || req == IDH_REQ_GPU_RESET_ACCESS) { |
| 178 | adev->virt.fw_reserve.checksum_key = | 178 | adev->virt.fw_reserve.checksum_key = |
| 179 | RREG32_NO_KIQ(SOC15_REG_OFFSET(NBIO, 0, | 179 | RREG32_NO_KIQ(SOC15_REG_OFFSET(NBIO, 0, |
| 180 | mmBIF_BX_PF0_MAILBOX_MSGBUF_RCV_DW2)); | 180 | mmBIF_BX_PF0_MAILBOX_MSGBUF_RCV_DW2)); |
| @@ -93,7 +93,20 @@ static void nbio_v7_4_enable_doorbell_aperture(struct amdgpu_device *adev, · 92 unmodified lines | |||
| 93 | static void nbio_v7_4_enable_doorbell_selfring_aperture(struct amdgpu_device *adev, | 93 | static void nbio_v7_4_enable_doorbell_selfring_aperture(struct amdgpu_device *adev, |
| 94 | bool enable) | 94 | bool enable) |
| 95 | { | 95 | { |
| 96 | u32 tmp = 0; | ||
| 96 | 97 | ||
| 98 | if (enable) { | ||
| 99 | tmp = REG_SET_FIELD(tmp, DOORBELL_SELFRING_GPA_APER_CNTL, DOORBELL_SELFRING_GPA_APER_EN, 1) | | ||
| 100 | REG_SET_FIELD(tmp, DOORBELL_SELFRING_GPA_APER_CNTL, DOORBELL_SELFRING_GPA_APER_MODE, 1) | | ||
| 101 | REG_SET_FIELD(tmp, DOORBELL_SELFRING_GPA_APER_CNTL, DOORBELL_SELFRING_GPA_APER_SIZE, 0); | ||
| 102 | |||
| 103 | WREG32_SOC15(NBIO, 0, mmDOORBELL_SELFRING_GPA_APER_BASE_LOW, | ||
| 104 | lower_32_bits(adev->doorbell.base)); | ||
| 105 | WREG32_SOC15(NBIO, 0, mmDOORBELL_SELFRING_GPA_APER_BASE_HIGH, | ||
| 106 | upper_32_bits(adev->doorbell.base)); | ||
| 107 | } | ||
| 108 | |||
| 109 | WREG32_SOC15(NBIO, 0, mmDOORBELL_SELFRING_GPA_APER_CNTL, tmp); | ||
| 97 | } | 110 | } |
| 98 | 111 | ||
| 99 | static void nbio_v7_4_ih_doorbell_range(struct amdgpu_device *adev, | 112 | static void nbio_v7_4_ih_doorbell_range(struct amdgpu_device *adev, |
| @@ -78,7 +78,6 @@ static const struct soc15_reg_golden golden_settings_sdma_4[] = { · 77 unmodified lines | |||
| 78 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC1_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000), | 78 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC1_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000), |
| 79 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_PAGE, 0x000003ff, 0x000003c0), | 79 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_PAGE, 0x000003ff, 0x000003c0), |
| 80 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_WATERMK, 0xfc000000, 0x00000000), | 80 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_WATERMK, 0xfc000000, 0x00000000), |
| 81 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831f07), | ||
| 82 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CLK_CTRL, 0xffffffff, 0x3f000100), | 81 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CLK_CTRL, 0xffffffff, 0x3f000100), |
| 83 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GFX_IB_CNTL, 0x800f0100, 0x00000100), | 82 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GFX_IB_CNTL, 0x800f0100, 0x00000100), |
| 84 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GFX_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000), | 83 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GFX_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000), |
| @@ -96,6 +95,7 @@ static const struct soc15_reg_golden golden_settings_sdma_4[] = { · 11 unmodified lines | |||
| 96 | static const struct soc15_reg_golden golden_settings_sdma_vg10[] = { | 95 | static const struct soc15_reg_golden golden_settings_sdma_vg10[] = { |
| 97 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0018773f, 0x00104002), | 96 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0018773f, 0x00104002), |
| 98 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002), | 97 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002), |
| 98 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831d07), | ||
| 99 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0018773f, 0x00104002), | 99 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0018773f, 0x00104002), |
| 100 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002) | 100 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002) |
| 101 | }; | 101 | }; |
| @@ -103,6 +103,7 @@ static const struct soc15_reg_golden golden_settings_sdma_vg10[] = { · 1 unmodified line | |||
| 103 | static const struct soc15_reg_golden golden_settings_sdma_vg12[] = { | 103 | static const struct soc15_reg_golden golden_settings_sdma_vg12[] = { |
| 104 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0018773f, 0x00104001), | 104 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0018773f, 0x00104001), |
| 105 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104001), | 105 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104001), |
| 106 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831d07), | ||
| 106 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0018773f, 0x00104001), | 107 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0018773f, 0x00104001), |
| 107 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104001) | 108 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104001) |
| 108 | }; | 109 | }; |
| @@ -729,11 +729,13 @@ static int soc15_common_early_init(void *handle) · 728 unmodified lines | |||
| 729 | case CHIP_RAVEN: | 729 | case CHIP_RAVEN: |
| 730 | adev->asic_funcs = &soc15_asic_funcs; | 730 | adev->asic_funcs = &soc15_asic_funcs; |
| 731 | if (adev->rev_id >= 0x8) | 731 | if (adev->rev_id >= 0x8) |
| 732 | adev->external_rev_id = adev->rev_id + 0x81; | 732 | adev->external_rev_id = adev->rev_id + 0x79; |
| 733 | else if (adev->pdev->device == 0x15d8) | 733 | else if (adev->pdev->device == 0x15d8) |
| 734 | adev->external_rev_id = adev->rev_id + 0x41; | 734 | adev->external_rev_id = adev->rev_id + 0x41; |
| 735 | else if (adev->rev_id == 1) | ||
| 736 | adev->external_rev_id = adev->rev_id + 0x20; | ||
| 735 | else | 737 | else |
| 736 | adev->external_rev_id = 0x1; | 738 | adev->external_rev_id = adev->rev_id + 0x01; |
| 737 | 739 | ||
| 738 | if (adev->rev_id >= 0x8) { | 740 | if (adev->rev_id >= 0x8) { |
| 739 | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | | 741 | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | |
| @@ -4,8 +4,8 @@ · 3 unmodified lines | |||
| 4 | 4 | ||
| 5 | config HSA_AMD | 5 | config HSA_AMD |
| 6 | bool "HSA kernel driver for AMD GPU devices" | 6 | bool "HSA kernel driver for AMD GPU devices" |
| 7 | depends on DRM_AMDGPU && X86_64 | 7 | depends on DRM_AMDGPU && (X86_64 || ARM64) |
| 8 | imply AMD_IOMMU_V2 | 8 | imply AMD_IOMMU_V2 if X86_64 |
| 9 | select MMU_NOTIFIER | 9 | select MMU_NOTIFIER |
| 10 | help | 10 | help |
| 11 | Enable this if you want to use HSA features on AMD GPU devices. | 11 | Enable this if you want to use HSA features on AMD GPU devices. |
| @@ -863,6 +863,7 @@ static int kfd_fill_mem_info_for_cpu(int numa_node_id, int *avail_size, · 862 unmodified lines | |||
| 863 | return 0; | 863 | return 0; |
| 864 | } | 864 | } |
| 865 | 865 | ||
| 866 | #ifdef CONFIG_X86_64 | ||
| 866 | static int kfd_fill_iolink_info_for_cpu(int numa_node_id, int *avail_size, | 867 | static int kfd_fill_iolink_info_for_cpu(int numa_node_id, int *avail_size, |
| 867 | uint32_t *num_entries, | 868 | uint32_t *num_entries, |
| 868 | struct crat_subtype_iolink *sub_type_hdr) | 869 | struct crat_subtype_iolink *sub_type_hdr) |
| @@ -905,6 +906,7 @@ static int kfd_fill_iolink_info_for_cpu(int numa_node_id, int *avail_size, · 36 unmodified lines | |||
| 905 | 906 | ||
| 906 | return 0; | 907 | return 0; |
| 907 | } | 908 | } |
| 909 | #endif | ||
| 908 | 910 | ||
| 909 | /* kfd_create_vcrat_image_cpu - Create Virtual CRAT for CPU | 911 | /* kfd_create_vcrat_image_cpu - Create Virtual CRAT for CPU |
| 910 | * | 912 | * |
| @@ -920,7 +922,9 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size) · 9 unmodified lines | |||
| 920 | struct crat_subtype_generic *sub_type_hdr; | 922 | struct crat_subtype_generic *sub_type_hdr; |
| 921 | int avail_size = *size; | 923 | int avail_size = *size; |
| 922 | int numa_node_id; | 924 | int numa_node_id; |
| 925 | #ifdef CONFIG_X86_64 | ||
| 923 | uint32_t entries = 0; | 926 | uint32_t entries = 0; |
| 927 | #endif | ||
| 924 | int ret = 0; | 928 | int ret = 0; |
| 925 | 929 | ||
| 926 | if (!pcrat_image || avail_size < VCRAT_SIZE_FOR_CPU) | 930 | if (!pcrat_image || avail_size < VCRAT_SIZE_FOR_CPU) |
| @@ -982,6 +986,7 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size) · 55 unmodified lines | |||
| 982 | sub_type_hdr->length); | 986 | sub_type_hdr->length); |
| 983 | 987 | ||
| 984 | /* Fill in Subtype: IO Link */ | 988 | /* Fill in Subtype: IO Link */ |
| 989 | #ifdef CONFIG_X86_64 | ||
| 985 | ret = kfd_fill_iolink_info_for_cpu(numa_node_id, &avail_size, | 990 | ret = kfd_fill_iolink_info_for_cpu(numa_node_id, &avail_size, |
| 986 | &entries, | 991 | &entries, |
| 987 | (struct crat_subtype_iolink *)sub_type_hdr); | 992 | (struct crat_subtype_iolink *)sub_type_hdr); |
| @@ -992,6 +997,9 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size) · 4 unmodified lines | |||
| 992 | 997 | ||
| 993 | sub_type_hdr = (typeof(sub_type_hdr))((char *)sub_type_hdr + | 998 | sub_type_hdr = (typeof(sub_type_hdr))((char *)sub_type_hdr + |
| 994 | sub_type_hdr->length * entries); | 999 | sub_type_hdr->length * entries); |
| 1000 | #else | ||
| 1001 | pr_info("IO link not available for non x86 platforms\n"); | ||
| 1002 | #endif | ||
| 995 | 1003 | ||
| 996 | crat_table->num_domains++; | 1004 | crat_table->num_domains++; |
| 997 | } | 1005 | } |
| @@ -1093,8 +1093,6 @@ static uint32_t kfd_generate_gpu_id(struct kfd_dev *gpu) · 1092 unmodified lines | |||
| 1093 | * the GPU device is not already present in the topology device | 1093 | * the GPU device is not already present in the topology device |
| 1094 | * list then return NULL. This means a new topology device has to | 1094 | * list then return NULL. This means a new topology device has to |
| 1095 | * be created for this GPU. | 1095 | * be created for this GPU. |
| 1096 | * TODO: Rather than assiging @gpu to first topology device withtout | ||
| 1097 | * gpu attached, it will better to have more stringent check. | ||
| 1098 | */ | 1096 | */ |
| 1099 | static struct kfd_topology_device *kfd_assign_gpu(struct kfd_dev *gpu) | 1097 | static struct kfd_topology_device *kfd_assign_gpu(struct kfd_dev *gpu) |
| 1100 | { | 1098 | { |
| @@ -1102,12 +1100,20 @@ static struct kfd_topology_device *kfd_assign_gpu(struct kfd_dev *gpu) · 1 unmodified line | |||
| 1102 | struct kfd_topology_device *out_dev = NULL; | 1100 | struct kfd_topology_device *out_dev = NULL; |
| 1103 | 1101 | ||
| 1104 | down_write(&topology_lock); | 1102 | down_write(&topology_lock); |
| 1105 | list_for_each_entry(dev, &topology_device_list, list) | 1103 | list_for_each_entry(dev, &topology_device_list, list) { |
| 1104 | /* Discrete GPUs need their own topology device list | ||
| 1105 | * entries. Don't assign them to CPU/APU nodes. | ||
| 1106 | */ | ||
| 1107 | if (!gpu->device_info->needs_iommu_device && | ||
| 1108 | dev->node_props.cpu_cores_count) | ||
| 1109 | continue; | ||
| 1110 | |||
| 1106 | if (!dev->gpu && (dev->node_props.simd_count > 0)) { | 1111 | if (!dev->gpu && (dev->node_props.simd_count > 0)) { |
| 1107 | dev->gpu = gpu; | 1112 | dev->gpu = gpu; |
| 1108 | out_dev = dev; | 1113 | out_dev = dev; |
| 1109 | break; | 1114 | break; |
| 1110 | } | 1115 | } |
| 1116 | } | ||
| 1111 | up_write(&topology_lock); | 1117 | up_write(&topology_lock); |
| 1112 | return out_dev; | 1118 | return out_dev; |
| 1113 | } | 1119 | } |
| @@ -1392,7 +1398,6 @@ int kfd_topology_enum_kfd_devices(uint8_t idx, struct kfd_dev **kdev) · 278 unmodified lines | |||
| 1392 | 1398 | ||
| 1393 | static int kfd_cpumask_to_apic_id(const struct cpumask *cpumask) | 1399 | static int kfd_cpumask_to_apic_id(const struct cpumask *cpumask) |
| 1394 | { | 1400 | { |
| 1395 | const struct cpuinfo_x86 *cpuinfo; | ||
| 1396 | int first_cpu_of_numa_node; | 1401 | int first_cpu_of_numa_node; |
| 1397 | 1402 | ||
| 1398 | if (!cpumask || cpumask == cpu_none_mask) | 1403 | if (!cpumask || cpumask == cpu_none_mask) |
| @@ -1400,9 +1405,11 @@ static int kfd_cpumask_to_apic_id(const struct cpumask *cpumask) · 1 unmodified line | |||
| 1400 | first_cpu_of_numa_node = cpumask_first(cpumask); | 1405 | first_cpu_of_numa_node = cpumask_first(cpumask); |
| 1401 | if (first_cpu_of_numa_node >= nr_cpu_ids) | 1406 | if (first_cpu_of_numa_node >= nr_cpu_ids) |
| 1402 | return -1; | 1407 | return -1; |
| 1403 | cpuinfo = &cpu_data(first_cpu_of_numa_node); | 1408 | #ifdef CONFIG_X86_64 |
| 1404 | 1409 | return cpu_data(first_cpu_of_numa_node).apicid; | |
| 1405 | return cpuinfo->apicid; | 1410 | #else |
| 1411 | return first_cpu_of_numa_node; | ||
| 1412 | #endif | ||
| 1406 | } | 1413 | } |
| 1407 | 1414 | ||
| 1408 | /* kfd_numa_node_to_apic_id - Returns the APIC ID of the first logical processor | 1415 | /* kfd_numa_node_to_apic_id - Returns the APIC ID of the first logical processor |
| @@ -699,22 +699,36 @@ static void s3_handle_mst(struct drm_device *dev, bool suspend) · 698 unmodified lines | |||
| 699 | { | 699 | { |
| 700 | struct amdgpu_dm_connector *aconnector; | 700 | struct amdgpu_dm_connector *aconnector; |
| 701 | struct drm_connector *connector; | 701 | struct drm_connector *connector; |
| 702 | struct drm_dp_mst_topology_mgr *mgr; | ||
| 703 | int ret; | ||
| 704 | bool need_hotplug = false; | ||
| 702 | 705 | ||
| 703 | drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); | 706 | drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); |
| 704 | 707 | ||
| 705 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 708 | list_for_each_entry(connector, &dev->mode_config.connector_list, |
| 706 | aconnector = to_amdgpu_dm_connector(connector); | 709 | head) { |
| 707 | if (aconnector->dc_link->type == dc_connection_mst_branch && | 710 | aconnector = to_amdgpu_dm_connector(connector); |
| 708 | !aconnector->mst_port) { | 711 | if (aconnector->dc_link->type != dc_connection_mst_branch || |
| 712 | aconnector->mst_port) | ||
| 713 | continue; | ||
| 709 | 714 | ||
| 710 | if (suspend) | 715 | mgr = &aconnector->mst_mgr; |
| 711 | drm_dp_mst_topology_mgr_suspend(&aconnector->mst_mgr); | 716 | |
| 712 | else | 717 | if (suspend) { |
| 713 | drm_dp_mst_topology_mgr_resume(&aconnector->mst_mgr); | 718 | drm_dp_mst_topology_mgr_suspend(mgr); |
| 714 | } | 719 | } else { |
| 720 | ret = drm_dp_mst_topology_mgr_resume(mgr); | ||
| 721 | if (ret < 0) { | ||
| 722 | drm_dp_mst_topology_mgr_set_mst(mgr, false); | ||
| 723 | need_hotplug = true; | ||
| 724 | } | ||
| 725 | } | ||
| 715 | } | 726 | } |
| 716 | 727 | ||
| 717 | drm_modeset_unlock(&dev->mode_config.connection_mutex); | 728 | drm_modeset_unlock(&dev->mode_config.connection_mutex); |
| 729 | |||
| 730 | if (need_hotplug) | ||
| 731 | drm_kms_helper_hotplug_event(dev); | ||
| 718 | } | 732 | } |
| 719 | 733 | ||
| 720 | /** | 734 | /** |
| @@ -898,7 +912,6 @@ static int dm_resume(void *handle) · 177 unmodified lines | |||
| 898 | struct drm_plane_state *new_plane_state; | 912 | struct drm_plane_state *new_plane_state; |
| 899 | struct dm_plane_state *dm_new_plane_state; | 913 | struct dm_plane_state *dm_new_plane_state; |
| 900 | enum dc_connection_type new_connection_type = dc_connection_none; | 914 | enum dc_connection_type new_connection_type = dc_connection_none; |
| 901 | int ret; | ||
| 902 | int i; | 915 | int i; |
| 903 | 916 | ||
| 904 | /* power on hardware */ | 917 | /* power on hardware */ |
| @@ -971,13 +984,13 @@ static int dm_resume(void *handle) · 66 unmodified lines | |||
| 971 | } | 984 | } |
| 972 | } | 985 | } |
| 973 | 986 | ||
| 974 | ret = drm_atomic_helper_resume(ddev, dm->cached_state); | 987 | drm_atomic_helper_resume(ddev, dm->cached_state); |
| 975 | 988 | ||
| 976 | dm->cached_state = NULL; | 989 | dm->cached_state = NULL; |
| 977 | 990 | ||
| 978 | amdgpu_dm_irq_resume_late(adev); | 991 | amdgpu_dm_irq_resume_late(adev); |
| 979 | 992 | ||
| 980 | return ret; | 993 | return 0; |
| 981 | } | 994 | } |
| 982 | 995 | ||
| 983 | /** | 996 | /** |
| @@ -1759,7 +1772,7 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd) · 775 unmodified lines | |||
| 1759 | + caps.min_input_signal * 0x101; | 1772 | + caps.min_input_signal * 0x101; |
| 1760 | 1773 | ||
| 1761 | if (dc_link_set_backlight_level(dm->backlight_link, | 1774 | if (dc_link_set_backlight_level(dm->backlight_link, |
| 1762 | brightness, 0, 0)) | 1775 | brightness, 0)) |
| 1763 | return 0; | 1776 | return 0; |
| 1764 | else | 1777 | else |
| 1765 | return 1; | 1778 | return 1; |
| @@ -4069,7 +4082,8 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, · 2303 unmodified lines | |||
| 4069 | } | 4082 | } |
| 4070 | 4083 | ||
| 4071 | if (connector_type == DRM_MODE_CONNECTOR_HDMIA || | 4084 | if (connector_type == DRM_MODE_CONNECTOR_HDMIA || |
| 4072 | connector_type == DRM_MODE_CONNECTOR_DisplayPort) { | 4085 | connector_type == DRM_MODE_CONNECTOR_DisplayPort || |
| 4086 | connector_type == DRM_MODE_CONNECTOR_eDP) { | ||
| 4073 | drm_connector_attach_vrr_capable_property( | 4087 | drm_connector_attach_vrr_capable_property( |
| 4074 | &aconnector->base); | 4088 | &aconnector->base); |
| 4075 | } | 4089 | } |
| @@ -5920,7 +5934,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, · 1844 unmodified lines | |||
| 5920 | for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { | 5934 | for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { |
| 5921 | if (!drm_atomic_crtc_needs_modeset(new_crtc_state) && | 5935 | if (!drm_atomic_crtc_needs_modeset(new_crtc_state) && |
| 5922 | !new_crtc_state->color_mgmt_changed && | 5936 | !new_crtc_state->color_mgmt_changed && |
| 5923 | !new_crtc_state->vrr_enabled) | 5937 | old_crtc_state->vrr_enabled == new_crtc_state->vrr_enabled) |
| 5924 | continue; | 5938 | continue; |
| 5925 | 5939 | ||
| 5926 | if (!new_crtc_state->enable) | 5940 | if (!new_crtc_state->enable) |
| @@ -2190,8 +2190,7 @@ int dc_link_get_backlight_level(const struct dc_link *link) · 2189 unmodified lines | |||
| 2190 | 2190 | ||
| 2191 | bool dc_link_set_backlight_level(const struct dc_link *link, | 2191 | bool dc_link_set_backlight_level(const struct dc_link *link, |
| 2192 | uint32_t backlight_pwm_u16_16, | 2192 | uint32_t backlight_pwm_u16_16, |
| 2193 | uint32_t frame_ramp, | 2193 | uint32_t frame_ramp) |
| 2194 | const struct dc_stream_state *stream) | ||
| 2195 | { | 2194 | { |
| 2196 | struct dc *core_dc = link->ctx->dc; | 2195 | struct dc *core_dc = link->ctx->dc; |
| 2197 | struct abm *abm = core_dc->res_pool->abm; | 2196 | struct abm *abm = core_dc->res_pool->abm; |
| @@ -2206,10 +2205,6 @@ bool dc_link_set_backlight_level(const struct dc_link *link, · 8 unmodified lines | |||
| 2206 | (abm->funcs->set_backlight_level_pwm == NULL)) | 2205 | (abm->funcs->set_backlight_level_pwm == NULL)) |
| 2207 | return false; | 2206 | return false; |
| 2208 | 2207 | ||
| 2209 | if (stream) | ||
| 2210 | ((struct dc_stream_state *)stream)->bl_pwm_level = | ||
| 2211 | backlight_pwm_u16_16; | ||
| 2212 | |||
| 2213 | use_smooth_brightness = dmcu->funcs->is_dmcu_initialized(dmcu); | 2208 | use_smooth_brightness = dmcu->funcs->is_dmcu_initialized(dmcu); |
| 2214 | 2209 | ||
| 2215 | DC_LOG_BACKLIGHT("New Backlight level: %d (0x%X)\n", | 2210 | DC_LOG_BACKLIGHT("New Backlight level: %d (0x%X)\n", |
| @@ -2637,11 +2632,6 @@ void core_link_enable_stream( · 421 unmodified lines | |||
| 2637 | 2632 | ||
| 2638 | if (dc_is_dp_signal(pipe_ctx->stream->signal)) | 2633 | if (dc_is_dp_signal(pipe_ctx->stream->signal)) |
| 2639 | enable_stream_features(pipe_ctx); | 2634 | enable_stream_features(pipe_ctx); |
| 2640 | |||
| 2641 | dc_link_set_backlight_level(pipe_ctx->stream->sink->link, | ||
| 2642 | pipe_ctx->stream->bl_pwm_level, | ||
| 2643 | 0, | ||
| 2644 | pipe_ctx->stream); | ||
| 2645 | } | 2635 | } |
| 2646 | 2636 | ||
| 2647 | } | 2637 | } |
| @@ -146,8 +146,7 @@ static inline struct dc_link *dc_get_link_at_index(struct dc *dc, uint32_t link_ · 145 unmodified lines | |||
| 146 | */ | 146 | */ |
| 147 | bool dc_link_set_backlight_level(const struct dc_link *dc_link, | 147 | bool dc_link_set_backlight_level(const struct dc_link *dc_link, |
| 148 | uint32_t backlight_pwm_u16_16, | 148 | uint32_t backlight_pwm_u16_16, |
| 149 | uint32_t frame_ramp, | 149 | uint32_t frame_ramp); |
| 150 | const struct dc_stream_state *stream); | ||
| 151 | 150 | ||
| 152 | int dc_link_get_backlight_level(const struct dc_link *dc_link); | 151 | int dc_link_get_backlight_level(const struct dc_link *dc_link); |
| 153 | 152 | ||
| @@ -91,7 +91,6 @@ struct dc_stream_state { · 90 unmodified lines | |||
| 91 | 91 | ||
| 92 | /* DMCU info */ | 92 | /* DMCU info */ |
| 93 | unsigned int abm_level; | 93 | unsigned int abm_level; |
| 94 | unsigned int bl_pwm_level; | ||
| 95 | 94 | ||
| 96 | /* from core_stream struct */ | 95 | /* from core_stream struct */ |
| 97 | struct dc_context *ctx; | 96 | struct dc_context *ctx; |
| @@ -591,7 +591,15 @@ static void dce11_pplib_apply_display_requirements( · 590 unmodified lines | |||
| 591 | dc, | 591 | dc, |
| 592 | context->bw.dce.sclk_khz); | 592 | context->bw.dce.sclk_khz); |
| 593 | 593 | ||
| 594 | pp_display_cfg->min_dcfclock_khz = pp_display_cfg->min_engine_clock_khz; | 594 | /* |
| 595 | * As workaround for >4x4K lightup set dcfclock to min_engine_clock value. | ||
| 596 | * This is not required for less than 5 displays, | ||
| 597 | * thus don't request decfclk in dc to avoid impact | ||
| 598 | * on power saving. | ||
| 599 | * | ||
| 600 | */ | ||
| 601 | pp_display_cfg->min_dcfclock_khz = (context->stream_count > 4)? | ||
| 602 | pp_display_cfg->min_engine_clock_khz : 0; | ||
| 595 | 603 | ||
| 596 | pp_display_cfg->min_engine_clock_deep_sleep_khz | 604 | pp_display_cfg->min_engine_clock_deep_sleep_khz |
| 597 | = context->bw.dce.sclk_deep_sleep_khz; | 605 | = context->bw.dce.sclk_deep_sleep_khz; |
| @@ -1000,7 +1000,7 @@ void dce110_enable_audio_stream(struct pipe_ctx *pipe_ctx) · 999 unmodified lines | |||
| 1000 | 1000 | ||
| 1001 | pipe_ctx->stream_res.audio->funcs->az_enable(pipe_ctx->stream_res.audio); | 1001 | pipe_ctx->stream_res.audio->funcs->az_enable(pipe_ctx->stream_res.audio); |
| 1002 | 1002 | ||
| 1003 | if (num_audio == 1 && pp_smu != NULL && pp_smu->set_pme_wa_enable != NULL) | 1003 | if (num_audio >= 1 && pp_smu != NULL && pp_smu->set_pme_wa_enable != NULL) |
| 1004 | /*this is the first audio. apply the PME w/a in order to wake AZ from D3*/ | 1004 | /*this is the first audio. apply the PME w/a in order to wake AZ from D3*/ |
| 1005 | pp_smu->set_pme_wa_enable(&pp_smu->pp_smu); | 1005 | pp_smu->set_pme_wa_enable(&pp_smu->pp_smu); |
| 1006 | /* un-mute audio */ | 1006 | /* un-mute audio */ |
| @@ -1017,6 +1017,8 @@ void dce110_disable_audio_stream(struct pipe_ctx *pipe_ctx, int option) · 10 unmodified lines | |||
| 1017 | pipe_ctx->stream_res.stream_enc->funcs->audio_mute_control( | 1017 | pipe_ctx->stream_res.stream_enc->funcs->audio_mute_control( |
| 1018 | pipe_ctx->stream_res.stream_enc, true); | 1018 | pipe_ctx->stream_res.stream_enc, true); |
| 1019 | if (pipe_ctx->stream_res.audio) { | 1019 | if (pipe_ctx->stream_res.audio) { |
| 1020 | struct pp_smu_funcs_rv *pp_smu = dc->res_pool->pp_smu; | ||
| 1021 | |||
| 1020 | if (option != KEEP_ACQUIRED_RESOURCE || | 1022 | if (option != KEEP_ACQUIRED_RESOURCE || |
| 1021 | !dc->debug.az_endpoint_mute_only) { | 1023 | !dc->debug.az_endpoint_mute_only) { |
| 1022 | /*only disalbe az_endpoint if power down or free*/ | 1024 | /*only disalbe az_endpoint if power down or free*/ |
| @@ -1036,6 +1038,9 @@ void dce110_disable_audio_stream(struct pipe_ctx *pipe_ctx, int option) · 13 unmodified lines | |||
| 1036 | update_audio_usage(&dc->current_state->res_ctx, dc->res_pool, pipe_ctx->stream_res.audio, false); | 1038 | update_audio_usage(&dc->current_state->res_ctx, dc->res_pool, pipe_ctx->stream_res.audio, false); |
| 1037 | pipe_ctx->stream_res.audio = NULL; | 1039 | pipe_ctx->stream_res.audio = NULL; |
| 1038 | } | 1040 | } |
| 1041 | if (pp_smu != NULL && pp_smu->set_pme_wa_enable != NULL) | ||
| 1042 | /*this is the first audio. apply the PME w/a in order to wake AZ from D3*/ | ||
| 1043 | pp_smu->set_pme_wa_enable(&pp_smu->pp_smu); | ||
| 1039 | 1044 | ||
| 1040 | /* TODO: notify audio driver for if audio modes list changed | 1045 | /* TODO: notify audio driver for if audio modes list changed |
| 1041 | * add audio mode list change flag */ | 1046 | * add audio mode list change flag */ |
| @@ -463,7 +463,7 @@ void dpp1_set_cursor_position( · 462 unmodified lines | |||
| 463 | if (src_y_offset >= (int)param->viewport.height) | 463 | if (src_y_offset >= (int)param->viewport.height) |
| 464 | cur_en = 0; /* not visible beyond bottom edge*/ | 464 | cur_en = 0; /* not visible beyond bottom edge*/ |
| 465 | 465 | ||
| 466 | if (src_y_offset < 0) | 466 | if (src_y_offset + (int)height <= 0) |
| 467 | cur_en = 0; /* not visible beyond top edge*/ | 467 | cur_en = 0; /* not visible beyond top edge*/ |
| 468 | 468 | ||
| 469 | REG_UPDATE(CURSOR0_CONTROL, | 469 | REG_UPDATE(CURSOR0_CONTROL, |
| @@ -1140,7 +1140,7 @@ void hubp1_cursor_set_position( · 1139 unmodified lines | |||
| 1140 | if (src_y_offset >= (int)param->viewport.height) | 1140 | if (src_y_offset >= (int)param->viewport.height) |
| 1141 | cur_en = 0; /* not visible beyond bottom edge*/ | 1141 | cur_en = 0; /* not visible beyond bottom edge*/ |
| 1142 | 1142 | ||
| 1143 | if (src_y_offset < 0) //+ (int)hubp->curs_attr.height | 1143 | if (src_y_offset + (int)hubp->curs_attr.height <= 0) |
| 1144 | cur_en = 0; /* not visible beyond top edge*/ | 1144 | cur_en = 0; /* not visible beyond top edge*/ |
| 1145 | 1145 | ||
| 1146 | if (cur_en && REG_READ(CURSOR_SURFACE_ADDRESS) == 0) | 1146 | if (cur_en && REG_READ(CURSOR_SURFACE_ADDRESS) == 0) |
| @@ -2355,29 +2355,22 @@ static void dcn10_apply_ctx_for_surface( · 2354 unmodified lines | |||
| 2355 | top_pipe_to_program->plane_state->update_flags.bits.full_update) | 2355 | top_pipe_to_program->plane_state->update_flags.bits.full_update) |
| 2356 | for (i = 0; i < dc->res_pool->pipe_count; i++) { | 2356 | for (i = 0; i < dc->res_pool->pipe_count; i++) { |
| 2357 | struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; | 2357 | struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; |
| 2358 | 2358 | tg = pipe_ctx->stream_res.tg; | |
| 2359 | /* Skip inactive pipes and ones already updated */ | 2359 | /* Skip inactive pipes and ones already updated */ |
| 2360 | if (!pipe_ctx->stream || pipe_ctx->stream == stream | 2360 | if (!pipe_ctx->stream || pipe_ctx->stream == stream |
| 2361 | || !pipe_ctx->plane_state) | 2361 | || !pipe_ctx->plane_state |
| 2362 | || !tg->funcs->is_tg_enabled(tg)) | ||
| 2362 | continue; | 2363 | continue; |
| 2363 | 2364 | ||
| 2364 | pipe_ctx->stream_res.tg->funcs->lock(pipe_ctx->stream_res.tg); | 2365 | tg->funcs->lock(tg); |
| 2365 | 2366 | ||
| 2366 | pipe_ctx->plane_res.hubp->funcs->hubp_setup_interdependent( | 2367 | pipe_ctx->plane_res.hubp->funcs->hubp_setup_interdependent( |
| 2367 | pipe_ctx->plane_res.hubp, | 2368 | pipe_ctx->plane_res.hubp, |
| 2368 | &pipe_ctx->dlg_regs, | 2369 | &pipe_ctx->dlg_regs, |
| 2369 | &pipe_ctx->ttu_regs); | 2370 | &pipe_ctx->ttu_regs); |
| 2370 | } | ||
| 2371 | |||
| 2372 | for (i = 0; i < dc->res_pool->pipe_count; i++) { | ||
| 2373 | struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; | ||
| 2374 | 2371 | ||
| 2375 | if (!pipe_ctx->stream || pipe_ctx->stream == stream | 2372 | tg->funcs->unlock(tg); |
| 2376 | || !pipe_ctx->plane_state) | 2373 | } |
| 2377 | continue; | ||
| 2378 | |||
| 2379 | dcn10_pipe_control_lock(dc, pipe_ctx, false); | ||
| 2380 | } | ||
| 2381 | 2374 | ||
| 2382 | if (num_planes == 0) | 2375 | if (num_planes == 0) |
| 2383 | false_optc_underflow_wa(dc, stream, tg); | 2376 | false_optc_underflow_wa(dc, stream, tg); |
| @@ -57,6 +57,7 @@ static const unsigned char abm_config[abm_defines_max_config][abm_defines_max_le · 56 unmodified lines | |||
| 57 | #define NUM_POWER_FN_SEGS 8 | 57 | #define NUM_POWER_FN_SEGS 8 |
| 58 | #define NUM_BL_CURVE_SEGS 16 | 58 | #define NUM_BL_CURVE_SEGS 16 |
| 59 | 59 | ||
| 60 | #pragma pack(push, 1) | ||
| 60 | /* NOTE: iRAM is 256B in size */ | 61 | /* NOTE: iRAM is 256B in size */ |
| 61 | struct iram_table_v_2 { | 62 | struct iram_table_v_2 { |
| 62 | /* flags */ | 63 | /* flags */ |
| @@ -100,6 +101,7 @@ struct iram_table_v_2 { · 37 unmodified lines | |||
| 100 | uint8_t dummy8; /* 0xfe */ | 101 | uint8_t dummy8; /* 0xfe */ |
| 101 | uint8_t dummy9; /* 0xff */ | 102 | uint8_t dummy9; /* 0xff */ |
| 102 | }; | 103 | }; |
| 104 | #pragma pack(pop) | ||
| 103 | 105 | ||
| 104 | static uint16_t backlight_8_to_16(unsigned int backlight_8bit) | 106 | static uint16_t backlight_8_to_16(unsigned int backlight_8bit) |
| 105 | { | 107 | { |
| @@ -127,12 +127,13 @@ enum amd_pp_task { · 126 unmodified lines | |||
| 127 | }; | 127 | }; |
| 128 | 128 | ||
| 129 | enum PP_SMC_POWER_PROFILE { | 129 | enum PP_SMC_POWER_PROFILE { |
| 130 | PP_SMC_POWER_PROFILE_FULLSCREEN3D = 0x0, | 130 | PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT = 0x0, |
| 131 | PP_SMC_POWER_PROFILE_POWERSAVING = 0x1, | 131 | PP_SMC_POWER_PROFILE_FULLSCREEN3D = 0x1, |
| 132 | PP_SMC_POWER_PROFILE_VIDEO = 0x2, | 132 | PP_SMC_POWER_PROFILE_POWERSAVING = 0x2, |
| 133 | PP_SMC_POWER_PROFILE_VR = 0x3, | 133 | PP_SMC_POWER_PROFILE_VIDEO = 0x3, |
| 134 | PP_SMC_POWER_PROFILE_COMPUTE = 0x4, | 134 | PP_SMC_POWER_PROFILE_VR = 0x4, |
| 135 | PP_SMC_POWER_PROFILE_CUSTOM = 0x5, | 135 | PP_SMC_POWER_PROFILE_COMPUTE = 0x5, |
| 136 | PP_SMC_POWER_PROFILE_CUSTOM = 0x6, | ||
| 136 | }; | 137 | }; |
| 137 | 138 | ||
| 138 | enum { | 139 | enum { |
| @@ -64,17 +64,19 @@ static int ci_set_asic_special_caps(struct pp_hwmgr *hwmgr); · 63 unmodified lines | |||
| 64 | 64 | ||
| 65 | static void hwmgr_init_workload_prority(struct pp_hwmgr *hwmgr) | 65 | static void hwmgr_init_workload_prority(struct pp_hwmgr *hwmgr) |
| 66 | { | 66 | { |
| 67 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D] = 2; | 67 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT] = 0; |
| 68 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_POWERSAVING] = 0; | 68 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D] = 1; |
| 69 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO] = 1; | 69 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_POWERSAVING] = 2; |
| 70 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VR] = 3; | 70 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO] = 3; |
| 71 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_COMPUTE] = 4; | 71 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VR] = 4; |
| 72 | 72 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_COMPUTE] = 5; | |
| 73 | hwmgr->workload_setting[0] = PP_SMC_POWER_PROFILE_POWERSAVING; | 73 | |
| 74 | hwmgr->workload_setting[1] = PP_SMC_POWER_PROFILE_VIDEO; | 74 | hwmgr->workload_setting[0] = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT; |
| 75 | hwmgr->workload_setting[2] = PP_SMC_POWER_PROFILE_FULLSCREEN3D; | 75 | hwmgr->workload_setting[1] = PP_SMC_POWER_PROFILE_FULLSCREEN3D; |
| 76 | hwmgr->workload_setting[3] = PP_SMC_POWER_PROFILE_VR; | 76 | hwmgr->workload_setting[2] = PP_SMC_POWER_PROFILE_POWERSAVING; |
| 77 | hwmgr->workload_setting[4] = PP_SMC_POWER_PROFILE_COMPUTE; | 77 | hwmgr->workload_setting[3] = PP_SMC_POWER_PROFILE_VIDEO; |
| 78 | hwmgr->workload_setting[4] = PP_SMC_POWER_PROFILE_VR; | ||
| 79 | hwmgr->workload_setting[5] = PP_SMC_POWER_PROFILE_COMPUTE; | ||
| 78 | } | 80 | } |
| 79 | 81 | ||
| 80 | int hwmgr_early_init(struct pp_hwmgr *hwmgr) | 82 | int hwmgr_early_init(struct pp_hwmgr *hwmgr) |
| @@ -1033,6 +1033,7 @@ static int smu10_get_clock_by_type_with_latency(struct pp_hwmgr *hwmgr, · 1032 unmodified lines | |||
| 1033 | break; | 1033 | break; |
| 1034 | case amd_pp_dpp_clock: | 1034 | case amd_pp_dpp_clock: |
| 1035 | pclk_vol_table = pinfo->vdd_dep_on_dppclk; | 1035 | pclk_vol_table = pinfo->vdd_dep_on_dppclk; |
| 1036 | break; | ||
| 1036 | default: | 1037 | default: |
| 1037 | return -EINVAL; | 1038 | return -EINVAL; |
| 1038 | } | 1039 | } |
| @@ -77,8 +77,9 @@ · 76 unmodified lines | |||
| 77 | #define PCIE_BUS_CLK 10000 | 77 | #define PCIE_BUS_CLK 10000 |
| 78 | #define TCLK (PCIE_BUS_CLK / 10) | 78 | #define TCLK (PCIE_BUS_CLK / 10) |
| 79 | 79 | ||
| 80 | static const struct profile_mode_setting smu7_profiling[6] = | 80 | static const struct profile_mode_setting smu7_profiling[7] = |
| 81 | {{1, 0, 100, 30, 1, 0, 100, 10}, | 81 | {{0, 0, 0, 0, 0, 0, 0, 0}, |
| 82 | {1, 0, 100, 30, 1, 0, 100, 10}, | ||
| 82 | {1, 10, 0, 30, 0, 0, 0, 0}, | 83 | {1, 10, 0, 30, 0, 0, 0, 0}, |
| 83 | {0, 0, 0, 0, 1, 10, 16, 31}, | 84 | {0, 0, 0, 0, 1, 10, 16, 31}, |
| 84 | {1, 0, 11, 50, 1, 0, 100, 10}, | 85 | {1, 0, 11, 50, 1, 0, 100, 10}, |
| @@ -4889,7 +4890,8 @@ static int smu7_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf) · 4804 unmodified lines | |||
| 4889 | uint32_t i, size = 0; | 4890 | uint32_t i, size = 0; |
| 4890 | uint32_t len; | 4891 | uint32_t len; |
| 4891 | 4892 | ||
| 4892 | static const char *profile_name[6] = {"3D_FULL_SCREEN", | 4893 | static const char *profile_name[7] = {"BOOTUP_DEFAULT", |
| 4894 | "3D_FULL_SCREEN", | ||
| 4893 | "POWER_SAVING", | 4895 | "POWER_SAVING", |
| 4894 | "VIDEO", | 4896 | "VIDEO", |
| 4895 | "VR", | 4897 | "VR", |
| @@ -804,9 +804,9 @@ static int vega10_hwmgr_backend_init(struct pp_hwmgr *hwmgr) · 803 unmodified lines | |||
| 804 | 804 | ||
| 805 | hwmgr->backend = data; | 805 | hwmgr->backend = data; |
| 806 | 806 | ||
| 807 | hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO]; | 807 | hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT]; |
| 808 | hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO; | 808 | hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT; |
| 809 | hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO; | 809 | hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT; |
| 810 | 810 | ||
| 811 | vega10_set_default_registry_data(hwmgr); | 811 | vega10_set_default_registry_data(hwmgr); |
| 812 | data->disable_dpm_mask = 0xff; | 812 | data->disable_dpm_mask = 0xff; |
| @@ -4668,13 +4668,15 @@ static int vega10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf) · 3855 unmodified lines | |||
| 4668 | { | 4668 | { |
| 4669 | struct vega10_hwmgr *data = hwmgr->backend; | 4669 | struct vega10_hwmgr *data = hwmgr->backend; |
| 4670 | uint32_t i, size = 0; | 4670 | uint32_t i, size = 0; |
| 4671 | static const uint8_t profile_mode_setting[5][4] = {{70, 60, 1, 3,}, | 4671 | static const uint8_t profile_mode_setting[6][4] = {{70, 60, 0, 0,}, |
| 4672 | {70, 60, 1, 3,}, | ||
| 4672 | {90, 60, 0, 0,}, | 4673 | {90, 60, 0, 0,}, |
| 4673 | {70, 60, 0, 0,}, | 4674 | {70, 60, 0, 0,}, |
| 4674 | {70, 90, 0, 0,}, | 4675 | {70, 90, 0, 0,}, |
| 4675 | {30, 60, 0, 6,}, | 4676 | {30, 60, 0, 6,}, |
| 4676 | }; | 4677 | }; |
| 4677 | static const char *profile_name[6] = {"3D_FULL_SCREEN", | 4678 | static const char *profile_name[7] = {"BOOTUP_DEFAULT", |
| 4679 | "3D_FULL_SCREEN", | ||
| 4678 | "POWER_SAVING", | 4680 | "POWER_SAVING", |
| 4679 | "VIDEO", | 4681 | "VIDEO", |
| 4680 | "VR", | 4682 | "VR", |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | |||
| 32 | #include "vega10_pptable.h" | 32 | #include "vega10_pptable.h" |
| 33 | 33 | ||
| 34 | #define NUM_DSPCLK_LEVELS 8 | 34 | #define NUM_DSPCLK_LEVELS 8 |
| 35 | #define VEGA10_ENGINECLOCK_HARDMAX 198000 | ||
| 35 | 36 | ||
| 36 | static void set_hw_cap(struct pp_hwmgr *hwmgr, bool enable, | 37 | static void set_hw_cap(struct pp_hwmgr *hwmgr, bool enable, |
| 37 | enum phm_platform_caps cap) | 38 | enum phm_platform_caps cap) |
| @@ -258,7 +259,26 @@ static int init_over_drive_limits( · 220 unmodified lines | |||
| 258 | struct pp_hwmgr *hwmgr, | 259 | struct pp_hwmgr *hwmgr, |
| 259 | const ATOM_Vega10_POWERPLAYTABLE *powerplay_table) | 260 | const ATOM_Vega10_POWERPLAYTABLE *powerplay_table) |
| 260 | { | 261 | { |
| 261 | hwmgr->platform_descriptor.overdriveLimit.engineClock = | 262 | const ATOM_Vega10_GFXCLK_Dependency_Table *gfxclk_dep_table = |
| 263 | (const ATOM_Vega10_GFXCLK_Dependency_Table *) | ||
| 264 | (((unsigned long) powerplay_table) + | ||
| 265 | le16_to_cpu(powerplay_table->usGfxclkDependencyTableOffset)); | ||
| 266 | bool is_acg_enabled = false; | ||
| 267 | ATOM_Vega10_GFXCLK_Dependency_Record_V2 *patom_record_v2; | ||
| 268 | |||
| 269 | if (gfxclk_dep_table->ucRevId == 1) { | ||
| 270 | patom_record_v2 = | ||
| 271 | (ATOM_Vega10_GFXCLK_Dependency_Record_V2 *)gfxclk_dep_table->entries; | ||
| 272 | is_acg_enabled = | ||
| 273 | (bool)patom_record_v2[gfxclk_dep_table->ucNumEntries-1].ucACGEnable; | ||
| 274 | } | ||
| 275 | |||
| 276 | if (powerplay_table->ulMaxODEngineClock > VEGA10_ENGINECLOCK_HARDMAX && | ||
| 277 | !is_acg_enabled) | ||
| 278 | hwmgr->platform_descriptor.overdriveLimit.engineClock = | ||
| 279 | VEGA10_ENGINECLOCK_HARDMAX; | ||
| 280 | else | ||
| 281 | hwmgr->platform_descriptor.overdriveLimit.engineClock = | ||
| 262 | le32_to_cpu(powerplay_table->ulMaxODEngineClock); | 282 | le32_to_cpu(powerplay_table->ulMaxODEngineClock); |
| 263 | hwmgr->platform_descriptor.overdriveLimit.memoryClock = | 283 | hwmgr->platform_descriptor.overdriveLimit.memoryClock = |
| 264 | le32_to_cpu(powerplay_table->ulMaxODMemoryClock); | 284 | le32_to_cpu(powerplay_table->ulMaxODMemoryClock); |
| @@ -753,6 +753,22 @@ static int vega12_init_smc_table(struct pp_hwmgr *hwmgr) · 752 unmodified lines | |||
| 753 | return 0; | 753 | return 0; |
| 754 | } | 754 | } |
| 755 | 755 | ||
| 756 | static int vega12_run_acg_btc(struct pp_hwmgr *hwmgr) | ||
| 757 | { | ||
| 758 | uint32_t result; | ||
| 759 | |||
| 760 | PP_ASSERT_WITH_CODE( | ||
| 761 | smum_send_msg_to_smc(hwmgr, PPSMC_MSG_RunAcgBtc) == 0, | ||
| 762 | "[Run_ACG_BTC] Attempt to run ACG BTC failed!", | ||
| 763 | return -EINVAL); | ||
| 764 | |||
| 765 | result = smum_get_argument(hwmgr); | ||
| 766 | PP_ASSERT_WITH_CODE(result == 1, | ||
| 767 | "Failed to run ACG BTC!", return -EINVAL); | ||
| 768 | |||
| 769 | return 0; | ||
| 770 | } | ||
| 771 | |||
| 756 | static int vega12_set_allowed_featuresmask(struct pp_hwmgr *hwmgr) | 772 | static int vega12_set_allowed_featuresmask(struct pp_hwmgr *hwmgr) |
| 757 | { | 773 | { |
| 758 | struct vega12_hwmgr *data = | 774 | struct vega12_hwmgr *data = |
| @@ -931,6 +947,11 @@ static int vega12_enable_dpm_tasks(struct pp_hwmgr *hwmgr) · 172 unmodified lines | |||
| 931 | "Failed to initialize SMC table!", | 947 | "Failed to initialize SMC table!", |
| 932 | result = tmp_result); | 948 | result = tmp_result); |
| 933 | 949 | ||
| 950 | tmp_result = vega12_run_acg_btc(hwmgr); | ||
| 951 | PP_ASSERT_WITH_CODE(!tmp_result, | ||
| 952 | "Failed to run ACG BTC!", | ||
| 953 | result = tmp_result); | ||
| 954 | |||
| 934 | result = vega12_enable_all_smu_features(hwmgr); | 955 | result = vega12_enable_all_smu_features(hwmgr); |
| 935 | PP_ASSERT_WITH_CODE(!result, | 956 | PP_ASSERT_WITH_CODE(!result, |
| 936 | "Failed to enable all smu features!", | 957 | "Failed to enable all smu features!", |
| @@ -390,9 +390,9 @@ static int vega20_hwmgr_backend_init(struct pp_hwmgr *hwmgr) · 389 unmodified lines | |||
| 390 | 390 | ||
| 391 | hwmgr->backend = data; | 391 | hwmgr->backend = data; |
| 392 | 392 | ||
| 393 | hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO]; | 393 | hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT]; |
| 394 | hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO; | 394 | hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT; |
| 395 | hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO; | 395 | hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT; |
| 396 | 396 | ||
| 397 | vega20_set_default_registry_data(hwmgr); | 397 | vega20_set_default_registry_data(hwmgr); |
| 398 | 398 | ||
| @@ -980,6 +980,9 @@ static int vega20_od8_set_feature_capabilities( · 581 unmodified lines | |||
| 980 | pp_table->FanZeroRpmEnable) | 980 | pp_table->FanZeroRpmEnable) |
| 981 | od_settings->overdrive8_capabilities |= OD8_FAN_ZERO_RPM_CONTROL; | 981 | od_settings->overdrive8_capabilities |= OD8_FAN_ZERO_RPM_CONTROL; |
| 982 | 982 | ||
| 983 | if (!od_settings->overdrive8_capabilities) | ||
| 984 | hwmgr->od_enabled = false; | ||
| 985 | |||
| 983 | return 0; | 986 | return 0; |
| 984 | } | 987 | } |
| 985 | 988 | ||
| @@ -1689,13 +1692,6 @@ static int vega20_upload_dpm_min_level(struct pp_hwmgr *hwmgr, uint32_t feature_ · 703 unmodified lines | |||
| 1689 | (PPCLK_UCLK << 16) | (min_freq & 0xffff))), | 1692 | (PPCLK_UCLK << 16) | (min_freq & 0xffff))), |
| 1690 | "Failed to set soft min memclk !", | 1693 | "Failed to set soft min memclk !", |
| 1691 | return ret); | 1694 | return ret); |
| 1692 | |||
| 1693 | min_freq = data->dpm_table.mem_table.dpm_state.hard_min_level; | ||
| 1694 | PP_ASSERT_WITH_CODE(!(ret = smum_send_msg_to_smc_with_parameter( | ||
| 1695 | hwmgr, PPSMC_MSG_SetHardMinByFreq, | ||
| 1696 | (PPCLK_UCLK << 16) | (min_freq & 0xffff))), | ||
| 1697 | "Failed to set hard min memclk !", | ||
| 1698 | return ret); | ||
| 1699 | } | 1695 | } |
| 1700 | 1696 | ||
| 1701 | if (data->smu_features[GNLD_DPM_UVD].enabled && | 1697 | if (data->smu_features[GNLD_DPM_UVD].enabled && |
| @@ -2248,6 +2244,13 @@ static int vega20_force_clock_level(struct pp_hwmgr *hwmgr, · 546 unmodified lines | |||
| 2248 | soft_min_level = mask ? (ffs(mask) - 1) : 0; | 2244 | soft_min_level = mask ? (ffs(mask) - 1) : 0; |
| 2249 | soft_max_level = mask ? (fls(mask) - 1) : 0; | 2245 | soft_max_level = mask ? (fls(mask) - 1) : 0; |
| 2250 | 2246 | ||
| 2247 | if (soft_max_level >= data->dpm_table.gfx_table.count) { | ||
| 2248 | pr_err("Clock level specified %d is over max allowed %d\n", | ||
| 2249 | soft_max_level, | ||
| 2250 | data->dpm_table.gfx_table.count - 1); | ||
| 2251 | return -EINVAL; | ||
| 2252 | } | ||
| 2253 | |||
| 2251 | data->dpm_table.gfx_table.dpm_state.soft_min_level = | 2254 | data->dpm_table.gfx_table.dpm_state.soft_min_level = |
| 2252 | data->dpm_table.gfx_table.dpm_levels[soft_min_level].value; | 2255 | data->dpm_table.gfx_table.dpm_levels[soft_min_level].value; |
| 2253 | data->dpm_table.gfx_table.dpm_state.soft_max_level = | 2256 | data->dpm_table.gfx_table.dpm_state.soft_max_level = |
| @@ -2268,6 +2271,13 @@ static int vega20_force_clock_level(struct pp_hwmgr *hwmgr, · 14 unmodified lines | |||
| 2268 | soft_min_level = mask ? (ffs(mask) - 1) : 0; | 2271 | soft_min_level = mask ? (ffs(mask) - 1) : 0; |
| 2269 | soft_max_level = mask ? (fls(mask) - 1) : 0; | 2272 | soft_max_level = mask ? (fls(mask) - 1) : 0; |
| 2270 | 2273 | ||
| 2274 | if (soft_max_level >= data->dpm_table.mem_table.count) { | ||
| 2275 | pr_err("Clock level specified %d is over max allowed %d\n", | ||
| 2276 | soft_max_level, | ||
| 2277 | data->dpm_table.mem_table.count - 1); | ||
| 2278 | return -EINVAL; | ||
| 2279 | } | ||
| 2280 | |||
| 2271 | data->dpm_table.mem_table.dpm_state.soft_min_level = | 2281 | data->dpm_table.mem_table.dpm_state.soft_min_level = |
| 2272 | data->dpm_table.mem_table.dpm_levels[soft_min_level].value; | 2282 | data->dpm_table.mem_table.dpm_levels[soft_min_level].value; |
| 2273 | data->dpm_table.mem_table.dpm_state.soft_max_level = | 2283 | data->dpm_table.mem_table.dpm_state.soft_max_level = |
| @@ -3261,6 +3271,9 @@ static int conv_power_profile_to_pplib_workload(int power_profile) · 987 unmodified lines | |||
| 3261 | int pplib_workload = 0; | 3271 | int pplib_workload = 0; |
| 3262 | 3272 | ||
| 3263 | switch (power_profile) { | 3273 | switch (power_profile) { |
| 3274 | case PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT: | ||
| 3275 | pplib_workload = WORKLOAD_DEFAULT_BIT; | ||
| 3276 | break; | ||
| 3264 | case PP_SMC_POWER_PROFILE_FULLSCREEN3D: | 3277 | case PP_SMC_POWER_PROFILE_FULLSCREEN3D: |
| 3265 | pplib_workload = WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT; | 3278 | pplib_workload = WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT; |
| 3266 | break; | 3279 | break; |
| @@ -3290,6 +3303,7 @@ static int vega20_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf) · 23 unmodified lines | |||
| 3290 | uint32_t i, size = 0; | 3303 | uint32_t i, size = 0; |
| 3291 | uint16_t workload_type = 0; | 3304 | uint16_t workload_type = 0; |
| 3292 | static const char *profile_name[] = { | 3305 | static const char *profile_name[] = { |
| 3306 | "BOOTUP_DEFAULT", | ||
| 3293 | "3D_FULL_SCREEN", | 3307 | "3D_FULL_SCREEN", |
| 3294 | "POWER_SAVING", | 3308 | "POWER_SAVING", |
| 3295 | "VIDEO", | 3309 | "VIDEO", |
| @@ -705,7 +705,7 @@ enum PP_TABLE_VERSION { · 704 unmodified lines | |||
| 705 | /** | 705 | /** |
| 706 | * The main hardware manager structure. | 706 | * The main hardware manager structure. |
| 707 | */ | 707 | */ |
| 708 | #define Workload_Policy_Max 5 | 708 | #define Workload_Policy_Max 6 |
| 709 | 709 | ||
| 710 | struct pp_hwmgr { | 710 | struct pp_hwmgr { |
| 711 | void *adev; | 711 | void *adev; |
| @@ -98,6 +98,8 @@ · 97 unmodified lines | |||
| 98 | #define DP0_STARTVAL 0x064c | 98 | #define DP0_STARTVAL 0x064c |
| 99 | #define DP0_ACTIVEVAL 0x0650 | 99 | #define DP0_ACTIVEVAL 0x0650 |
| 100 | #define DP0_SYNCVAL 0x0654 | 100 | #define DP0_SYNCVAL 0x0654 |
| 101 | #define SYNCVAL_HS_POL_ACTIVE_LOW (1 << 15) | ||
| 102 | #define SYNCVAL_VS_POL_ACTIVE_LOW (1 << 31) | ||
| 101 | #define DP0_MISC 0x0658 | 103 | #define DP0_MISC 0x0658 |
| 102 | #define TU_SIZE_RECOMMENDED (63) /* LSCLK cycles per TU */ | 104 | #define TU_SIZE_RECOMMENDED (63) /* LSCLK cycles per TU */ |
| 103 | #define BPC_6 (0 << 5) | 105 | #define BPC_6 (0 << 5) |
| @@ -142,6 +144,8 @@ · 38 unmodified lines | |||
| 142 | #define DP0_LTLOOPCTRL 0x06d8 | 144 | #define DP0_LTLOOPCTRL 0x06d8 |
| 143 | #define DP0_SNKLTCTRL 0x06e4 | 145 | #define DP0_SNKLTCTRL 0x06e4 |
| 144 | 146 | ||
| 147 | #define DP1_SRCCTRL 0x07a0 | ||
| 148 | |||
| 145 | /* PHY */ | 149 | /* PHY */ |
| 146 | #define DP_PHY_CTRL 0x0800 | 150 | #define DP_PHY_CTRL 0x0800 |
| 147 | #define DP_PHY_RST BIT(28) /* DP PHY Global Soft Reset */ | 151 | #define DP_PHY_RST BIT(28) /* DP PHY Global Soft Reset */ |
| @@ -150,6 +154,7 @@ · 2 unmodified lines | |||
| 150 | #define PHY_M1_RST BIT(12) /* Reset PHY1 Main Channel */ | 154 | #define PHY_M1_RST BIT(12) /* Reset PHY1 Main Channel */ |
| 151 | #define PHY_RDY BIT(16) /* PHY Main Channels Ready */ | 155 | #define PHY_RDY BIT(16) /* PHY Main Channels Ready */ |
| 152 | #define PHY_M0_RST BIT(8) /* Reset PHY0 Main Channel */ | 156 | #define PHY_M0_RST BIT(8) /* Reset PHY0 Main Channel */ |
| 157 | #define PHY_2LANE BIT(2) /* PHY Enable 2 lanes */ | ||
| 153 | #define PHY_A0_EN BIT(1) /* PHY Aux Channel0 Enable */ | 158 | #define PHY_A0_EN BIT(1) /* PHY Aux Channel0 Enable */ |
| 154 | #define PHY_M0_EN BIT(0) /* PHY Main Channel0 Enable */ | 159 | #define PHY_M0_EN BIT(0) /* PHY Main Channel0 Enable */ |
| 155 | 160 | ||
| @@ -540,6 +545,7 @@ static int tc_aux_link_setup(struct tc_data *tc) · 384 unmodified lines | |||
| 540 | unsigned long rate; | 545 | unsigned long rate; |
| 541 | u32 value; | 546 | u32 value; |
| 542 | int ret; | 547 | int ret; |
| 548 | u32 dp_phy_ctrl; | ||
| 543 | 549 | ||
| 544 | rate = clk_get_rate(tc->refclk); | 550 | rate = clk_get_rate(tc->refclk); |
| 545 | switch (rate) { | 551 | switch (rate) { |
| @@ -564,7 +570,10 @@ static int tc_aux_link_setup(struct tc_data *tc) · 18 unmodified lines | |||
| 564 | value |= SYSCLK_SEL_LSCLK | LSCLK_DIV_2; | 570 | value |= SYSCLK_SEL_LSCLK | LSCLK_DIV_2; |
| 565 | tc_write(SYS_PLLPARAM, value); | 571 | tc_write(SYS_PLLPARAM, value); |
| 566 | 572 | ||
| 567 | tc_write(DP_PHY_CTRL, BGREN | PWR_SW_EN | BIT(2) | PHY_A0_EN); | 573 | dp_phy_ctrl = BGREN | PWR_SW_EN | PHY_A0_EN; |
| 574 | if (tc->link.base.num_lanes == 2) | ||
| 575 | dp_phy_ctrl |= PHY_2LANE; | ||
| 576 | tc_write(DP_PHY_CTRL, dp_phy_ctrl); | ||
| 568 | 577 | ||
| 569 | /* | 578 | /* |
| 570 | * Initially PLLs are in bypass. Force PLL parameter update, | 579 | * Initially PLLs are in bypass. Force PLL parameter update, |
| @@ -719,7 +728,9 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode) · 148 unmodified lines | |||
| 719 | 728 | ||
| 720 | tc_write(DP0_ACTIVEVAL, (mode->vdisplay << 16) | (mode->hdisplay)); | 729 | tc_write(DP0_ACTIVEVAL, (mode->vdisplay << 16) | (mode->hdisplay)); |
| 721 | 730 | ||
| 722 | tc_write(DP0_SYNCVAL, (vsync_len << 16) | (hsync_len << 0)); | 731 | tc_write(DP0_SYNCVAL, (vsync_len << 16) | (hsync_len << 0) | |
| 732 | ((mode->flags & DRM_MODE_FLAG_NHSYNC) ? SYNCVAL_HS_POL_ACTIVE_LOW : 0) | | ||
| 733 | ((mode->flags & DRM_MODE_FLAG_NVSYNC) ? SYNCVAL_VS_POL_ACTIVE_LOW : 0)); | ||
| 723 | 734 | ||
| 724 | tc_write(DPIPXLFMT, VS_POL_ACTIVE_LOW | HS_POL_ACTIVE_LOW | | 735 | tc_write(DPIPXLFMT, VS_POL_ACTIVE_LOW | HS_POL_ACTIVE_LOW | |
| 725 | DE_POL_ACTIVE_HIGH | SUB_CFG_TYPE_CONFIG1 | DPI_BPP_RGB888); | 736 | DE_POL_ACTIVE_HIGH | SUB_CFG_TYPE_CONFIG1 | DPI_BPP_RGB888); |
| @@ -829,12 +840,11 @@ static int tc_main_link_setup(struct tc_data *tc) · 103 unmodified lines | |||
| 829 | if (!tc->mode) | 840 | if (!tc->mode) |
| 830 | return -EINVAL; | 841 | return -EINVAL; |
| 831 | 842 | ||
| 832 | /* from excel file - DP0_SrcCtrl */ | 843 | tc_write(DP0_SRCCTRL, tc_srcctrl(tc)); |
| 833 | tc_write(DP0_SRCCTRL, DP0_SRCCTRL_SCRMBLDIS | DP0_SRCCTRL_EN810B | | 844 | /* SSCG and BW27 on DP1 must be set to the same as on DP0 */ |
| 834 | DP0_SRCCTRL_LANESKEW | DP0_SRCCTRL_LANES_2 | | 845 | tc_write(DP1_SRCCTRL, |
| 835 | DP0_SRCCTRL_BW27 | DP0_SRCCTRL_AUTOCORRECT); | 846 | (tc->link.spread ? DP0_SRCCTRL_SSCG : 0) | |
| 836 | /* from excel file - DP1_SrcCtrl */ | 847 | ((tc->link.base.rate != 162000) ? DP0_SRCCTRL_BW27 : 0)); |
| 837 | tc_write(0x07a0, 0x00003083); | ||
| 838 | 848 | ||
| 839 | rate = clk_get_rate(tc->refclk); | 849 | rate = clk_get_rate(tc->refclk); |
| 840 | switch (rate) { | 850 | switch (rate) { |
| @@ -855,8 +865,11 @@ static int tc_main_link_setup(struct tc_data *tc) · 14 unmodified lines | |||
| 855 | } | 865 | } |
| 856 | value |= SYSCLK_SEL_LSCLK | LSCLK_DIV_2; | 866 | value |= SYSCLK_SEL_LSCLK | LSCLK_DIV_2; |
| 857 | tc_write(SYS_PLLPARAM, value); | 867 | tc_write(SYS_PLLPARAM, value); |
| 868 | |||
| 858 | /* Setup Main Link */ | 869 | /* Setup Main Link */ |
| 859 | dp_phy_ctrl = BGREN | PWR_SW_EN | BIT(2) | PHY_A0_EN | PHY_M0_EN; | 870 | dp_phy_ctrl = BGREN | PWR_SW_EN | PHY_A0_EN | PHY_M0_EN; |
| 871 | if (tc->link.base.num_lanes == 2) | ||
| 872 | dp_phy_ctrl |= PHY_2LANE; | ||
| 860 | tc_write(DP_PHY_CTRL, dp_phy_ctrl); | 873 | tc_write(DP_PHY_CTRL, dp_phy_ctrl); |
| 861 | msleep(100); | 874 | msleep(100); |
| 862 | 875 | ||
| @@ -1105,10 +1118,20 @@ static bool tc_bridge_mode_fixup(struct drm_bridge *bridge, · 242 unmodified lines | |||
| 1105 | static enum drm_mode_status tc_connector_mode_valid(struct drm_connector *connector, | 1118 | static enum drm_mode_status tc_connector_mode_valid(struct drm_connector *connector, |
| 1106 | struct drm_display_mode *mode) | 1119 | struct drm_display_mode *mode) |
| 1107 | { | 1120 | { |
| 1121 | struct tc_data *tc = connector_to_tc(connector); | ||
| 1122 | u32 req, avail; | ||
| 1123 | u32 bits_per_pixel = 24; | ||
| 1124 | |||
| 1108 | /* DPI interface clock limitation: upto 154 MHz */ | 1125 | /* DPI interface clock limitation: upto 154 MHz */ |
| 1109 | if (mode->clock > 154000) | 1126 | if (mode->clock > 154000) |
| 1110 | return MODE_CLOCK_HIGH; | 1127 | return MODE_CLOCK_HIGH; |
| 1111 | 1128 | ||
| 1129 | req = mode->clock * bits_per_pixel / 8; | ||
| 1130 | avail = tc->link.base.num_lanes * tc->link.base.rate; | ||
| 1131 | |||
| 1132 | if (req > avail) | ||
| 1133 | return MODE_BAD; | ||
| 1134 | |||
| 1112 | return MODE_OK; | 1135 | return MODE_OK; |
| 1113 | } | 1136 | } |
| 1114 | 1137 | ||
| @@ -1186,7 +1209,8 @@ static int tc_bridge_attach(struct drm_bridge *bridge) · 71 unmodified lines | |||
| 1186 | /* Create eDP connector */ | 1209 | /* Create eDP connector */ |
| 1187 | drm_connector_helper_add(&tc->connector, &tc_connector_helper_funcs); | 1210 | drm_connector_helper_add(&tc->connector, &tc_connector_helper_funcs); |
| 1188 | ret = drm_connector_init(drm, &tc->connector, &tc_connector_funcs, | 1211 | ret = drm_connector_init(drm, &tc->connector, &tc_connector_funcs, |
| 1189 | DRM_MODE_CONNECTOR_eDP); | 1212 | tc->panel ? DRM_MODE_CONNECTOR_eDP : |
| 1213 | DRM_MODE_CONNECTOR_DisplayPort); | ||
| 1190 | if (ret) | 1214 | if (ret) |
| 1191 | return ret; | 1215 | return ret; |
| 1192 | 1216 | ||
| @@ -1195,6 +1219,10 @@ static int tc_bridge_attach(struct drm_bridge *bridge) · 2 unmodified lines | |||
| 1195 | 1219 | ||
| 1196 | drm_display_info_set_bus_formats(&tc->connector.display_info, | 1220 | drm_display_info_set_bus_formats(&tc->connector.display_info, |
| 1197 | &bus_format, 1); | 1221 | &bus_format, 1); |
| 1222 | tc->connector.display_info.bus_flags = | ||
| 1223 | DRM_BUS_FLAG_DE_HIGH | | ||
| 1224 | DRM_BUS_FLAG_PIXDATA_NEGEDGE | | ||
| 1225 | DRM_BUS_FLAG_SYNC_NEGEDGE; | ||
| 1198 | drm_connector_attach_encoder(&tc->connector, tc->bridge.encoder); | 1226 | drm_connector_attach_encoder(&tc->connector, tc->bridge.encoder); |
| 1199 | 1227 | ||
| 1200 | return 0; | 1228 | return 0; |
| @@ -1296,12 +1296,11 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, · 1295 unmodified lines | |||
| 1296 | (arg->flags & DRM_MODE_PAGE_FLIP_EVENT)) | 1296 | (arg->flags & DRM_MODE_PAGE_FLIP_EVENT)) |
| 1297 | return -EINVAL; | 1297 | return -EINVAL; |
| 1298 | 1298 | ||
| 1299 | drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE); | ||
| 1300 | |||
| 1301 | state = drm_atomic_state_alloc(dev); | 1299 | state = drm_atomic_state_alloc(dev); |
| 1302 | if (!state) | 1300 | if (!state) |
| 1303 | return -ENOMEM; | 1301 | return -ENOMEM; |
| 1304 | 1302 | ||
| 1303 | drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE); | ||
| 1305 | state->acquire_ctx = &ctx; | 1304 | state->acquire_ctx = &ctx; |
| 1306 | state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET); | 1305 | state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET); |
| 1307 | 1306 | ||
| @@ -1273,6 +1273,8 @@ static const struct dpcd_quirk dpcd_quirk_list[] = { · 1272 unmodified lines | |||
| 1273 | { OUI(0x00, 0x22, 0xb9), DEVICE_ID_ANY, true, BIT(DP_DPCD_QUIRK_CONSTANT_N) }, | 1273 | { OUI(0x00, 0x22, 0xb9), DEVICE_ID_ANY, true, BIT(DP_DPCD_QUIRK_CONSTANT_N) }, |
| 1274 | /* LG LP140WF6-SPM1 eDP panel */ | 1274 | /* LG LP140WF6-SPM1 eDP panel */ |
| 1275 | { OUI(0x00, 0x22, 0xb9), DEVICE_ID('s', 'i', 'v', 'a', 'r', 'T'), false, BIT(DP_DPCD_QUIRK_CONSTANT_N) }, | 1275 | { OUI(0x00, 0x22, 0xb9), DEVICE_ID('s', 'i', 'v', 'a', 'r', 'T'), false, BIT(DP_DPCD_QUIRK_CONSTANT_N) }, |
| 1276 | /* Apple panels need some additional handling to support PSR */ | ||
| 1277 | { OUI(0x00, 0x10, 0xfa), DEVICE_ID_ANY, false, BIT(DP_DPCD_QUIRK_NO_PSR) } | ||
| 1276 | }; | 1278 | }; |
| 1277 | 1279 | ||
| 1278 | #undef OUI | 1280 | #undef OUI |
| @@ -1621,6 +1621,64 @@ static bool drm_fb_pixel_format_equal(const struct fb_var_screeninfo *var_1, · 1620 unmodified lines | |||
| 1621 | var_1->transp.msb_right == var_2->transp.msb_right; | 1621 | var_1->transp.msb_right == var_2->transp.msb_right; |
| 1622 | } | 1622 | } |
| 1623 | 1623 | ||
| 1624 | static void drm_fb_helper_fill_pixel_fmt(struct fb_var_screeninfo *var, | ||
| 1625 | u8 depth) | ||
| 1626 | { | ||
| 1627 | switch (depth) { | ||
| 1628 | case 8: | ||
| 1629 | var->red.offset = 0; | ||
| 1630 | var->green.offset = 0; | ||
| 1631 | var->blue.offset = 0; | ||
| 1632 | var->red.length = 8; /* 8bit DAC */ | ||
| 1633 | var->green.length = 8; | ||
| 1634 | var->blue.length = 8; | ||
| 1635 | var->transp.offset = 0; | ||
| 1636 | var->transp.length = 0; | ||
| 1637 | break; | ||
| 1638 | case 15: | ||
| 1639 | var->red.offset = 10; | ||
| 1640 | var->green.offset = 5; | ||
| 1641 | var->blue.offset = 0; | ||
| 1642 | var->red.length = 5; | ||
| 1643 | var->green.length = 5; | ||
| 1644 | var->blue.length = 5; | ||
| 1645 | var->transp.offset = 15; | ||
| 1646 | var->transp.length = 1; | ||
| 1647 | break; | ||
| 1648 | case 16: | ||
| 1649 | var->red.offset = 11; | ||
| 1650 | var->green.offset = 5; | ||
| 1651 | var->blue.offset = 0; | ||
| 1652 | var->red.length = 5; | ||
| 1653 | var->green.length = 6; | ||
| 1654 | var->blue.length = 5; | ||
| 1655 | var->transp.offset = 0; | ||
| 1656 | break; | ||
| 1657 | case 24: | ||
| 1658 | var->red.offset = 16; | ||
| 1659 | var->green.offset = 8; | ||
| 1660 | var->blue.offset = 0; | ||
| 1661 | var->red.length = 8; | ||
| 1662 | var->green.length = 8; | ||
| 1663 | var->blue.length = 8; | ||
| 1664 | var->transp.offset = 0; | ||
| 1665 | var->transp.length = 0; | ||
| 1666 | break; | ||
| 1667 | case 32: | ||
| 1668 | var->red.offset = 16; | ||
| 1669 | var->green.offset = 8; | ||
| 1670 | var->blue.offset = 0; | ||
| 1671 | var->red.length = 8; | ||
| 1672 | var->green.length = 8; | ||
| 1673 | var->blue.length = 8; | ||
| 1674 | var->transp.offset = 24; | ||
| 1675 | var->transp.length = 8; | ||
| 1676 | break; | ||
| 1677 | default: | ||
| 1678 | break; | ||
| 1679 | } | ||
| 1680 | } | ||
| 1681 | |||
| 1624 | /** | 1682 | /** |
| 1625 | * drm_fb_helper_check_var - implementation for &fb_ops.fb_check_var | 1683 | * drm_fb_helper_check_var - implementation for &fb_ops.fb_check_var |
| 1626 | * @var: screeninfo to check | 1684 | * @var: screeninfo to check |
| @@ -1632,9 +1690,14 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, · 5 unmodified lines | |||
| 1632 | struct drm_fb_helper *fb_helper = info->par; | 1690 | struct drm_fb_helper *fb_helper = info->par; |
| 1633 | struct drm_framebuffer *fb = fb_helper->fb; | 1691 | struct drm_framebuffer *fb = fb_helper->fb; |
| 1634 | 1692 | ||
| 1635 | if (var->pixclock != 0 || in_dbg_master()) | 1693 | if (in_dbg_master()) |
| 1636 | return -EINVAL; | 1694 | return -EINVAL; |
| 1637 | 1695 | ||
| 1696 | if (var->pixclock != 0) { | ||
| 1697 | DRM_DEBUG("fbdev emulation doesn't support changing the pixel clock, value of pixclock is ignored\n"); | ||
| 1698 | var->pixclock = 0; | ||
| 1699 | } | ||
| 1700 | |||
| 1638 | if ((drm_format_info_block_width(fb->format, 0) > 1) || | 1701 | if ((drm_format_info_block_width(fb->format, 0) > 1) || |
| 1639 | (drm_format_info_block_height(fb->format, 0) > 1)) | 1702 | (drm_format_info_block_height(fb->format, 0) > 1)) |
| 1640 | return -EINVAL; | 1703 | return -EINVAL; |
| @@ -1654,6 +1717,20 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, · 13 unmodified lines | |||
| 1654 | return -EINVAL; | 1717 | return -EINVAL; |
| 1655 | } | 1718 | } |
| 1656 | 1719 | ||
| 1720 | /* | ||
| 1721 | * Workaround for SDL 1.2, which is known to be setting all pixel format | ||
| 1722 | * fields values to zero in some cases. We treat this situation as a | ||
| 1723 | * kind of "use some reasonable autodetected values". | ||
| 1724 | */ | ||
| 1725 | if (!var->red.offset && !var->green.offset && | ||
| 1726 | !var->blue.offset && !var->transp.offset && | ||
| 1727 | !var->red.length && !var->green.length && | ||
| 1728 | !var->blue.length && !var->transp.length && | ||
| 1729 | !var->red.msb_right && !var->green.msb_right && | ||
| 1730 | !var->blue.msb_right && !var->transp.msb_right) { | ||
| 1731 | drm_fb_helper_fill_pixel_fmt(var, fb->format->depth); | ||
| 1732 | } | ||
| 1733 | |||
| 1657 | /* | 1734 | /* |
| 1658 | * drm fbdev emulation doesn't support changing the pixel format at all, | 1735 | * drm fbdev emulation doesn't support changing the pixel format at all, |
| 1659 | * so reject all pixel format changing requests. | 1736 | * so reject all pixel format changing requests. |
| @@ -1967,59 +2044,7 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpe · 307 unmodified lines | |||
| 1967 | info->var.yoffset = 0; | 2044 | info->var.yoffset = 0; |
| 1968 | info->var.activate = FB_ACTIVATE_NOW; | 2045 | info->var.activate = FB_ACTIVATE_NOW; |
| 1969 | 2046 | ||
| 1970 | switch (fb->format->depth) { | 2047 | drm_fb_helper_fill_pixel_fmt(&info->var, fb->format->depth); |
| 1971 | case 8: | ||
| 1972 | info->var.red.offset = 0; | ||
| 1973 | info->var.green.offset = 0; | ||
| 1974 | info->var.blue.offset = 0; | ||
| 1975 | info->var.red.length = 8; /* 8bit DAC */ | ||
| 1976 | info->var.green.length = 8; | ||
| 1977 | info->var.blue.length = 8; | ||
| 1978 | info->var.transp.offset = 0; | ||
| 1979 | info->var.transp.length = 0; | ||
| 1980 | break; | ||
| 1981 | case 15: | ||
| 1982 | info->var.red.offset = 10; | ||
| 1983 | info->var.green.offset = 5; | ||
| 1984 | info->var.blue.offset = 0; | ||
| 1985 | info->var.red.length = 5; | ||
| 1986 | info->var.green.length = 5; | ||
| 1987 | info->var.blue.length = 5; | ||
| 1988 | info->var.transp.offset = 15; | ||
| 1989 | info->var.transp.length = 1; | ||
| 1990 | break; | ||
| 1991 | case 16: | ||
| 1992 | info->var.red.offset = 11; | ||
| 1993 | info->var.green.offset = 5; | ||
| 1994 | info->var.blue.offset = 0; | ||
| 1995 | info->var.red.length = 5; | ||
| 1996 | info->var.green.length = 6; | ||
| 1997 | info->var.blue.length = 5; | ||
| 1998 | info->var.transp.offset = 0; | ||
| 1999 | break; | ||
| 2000 | case 24: | ||
| 2001 | info->var.red.offset = 16; | ||
| 2002 | info->var.green.offset = 8; | ||
| 2003 | info->var.blue.offset = 0; | ||
| 2004 | info->var.red.length = 8; | ||
| 2005 | info->var.green.length = 8; | ||
| 2006 | info->var.blue.length = 8; | ||
| 2007 | info->var.transp.offset = 0; | ||
| 2008 | info->var.transp.length = 0; | ||
| 2009 | break; | ||
| 2010 | case 32: | ||
| 2011 | info->var.red.offset = 16; | ||
| 2012 | info->var.green.offset = 8; | ||
| 2013 | info->var.blue.offset = 0; | ||
| 2014 | info->var.red.length = 8; | ||
| 2015 | info->var.green.length = 8; | ||
| 2016 | info->var.blue.length = 8; | ||
| 2017 | info->var.transp.offset = 24; | ||
| 2018 | info->var.transp.length = 8; | ||
| 2019 | break; | ||
| 2020 | default: | ||
| 2021 | break; | ||
| 2022 | } | ||
| 2023 | 2048 | ||
| 2024 | info->var.xres = fb_width; | 2049 | info->var.xres = fb_width; |
| 2025 | info->var.yres = fb_height; | 2050 | info->var.yres = fb_height; |
| @@ -459,11 +459,11 @@ static int set_property_atomic(struct drm_mode_object *obj, · 458 unmodified lines | |||
| 459 | struct drm_modeset_acquire_ctx ctx; | 459 | struct drm_modeset_acquire_ctx ctx; |
| 460 | int ret; | 460 | int ret; |
| 461 | 461 | ||
| 462 | drm_modeset_acquire_init(&ctx, 0); | ||
| 463 | |||
| 464 | state = drm_atomic_state_alloc(dev); | 462 | state = drm_atomic_state_alloc(dev); |
| 465 | if (!state) | 463 | if (!state) |
| 466 | return -ENOMEM; | 464 | return -ENOMEM; |
| 465 | |||
| 466 | drm_modeset_acquire_init(&ctx, 0); | ||
| 467 | state->acquire_ctx = &ctx; | 467 | state->acquire_ctx = &ctx; |
| 468 | retry: | 468 | retry: |
| 469 | if (prop == state->dev->mode_config.dpms_property) { | 469 | if (prop == state->dev->mode_config.dpms_property) { |
| @@ -758,7 +758,7 @@ int drm_mode_hsync(const struct drm_display_mode *mode) · 757 unmodified lines | |||
| 758 | if (mode->hsync) | 758 | if (mode->hsync) |
| 759 | return mode->hsync; | 759 | return mode->hsync; |
| 760 | 760 | ||
| 761 | if (mode->htotal < 0) | 761 | if (mode->htotal <= 0) |
| 762 | return 0; | 762 | return 0; |
| 763 | 763 | ||
| 764 | calc_val = (mode->clock * 1000) / mode->htotal; /* hsync in Hz */ | 764 | calc_val = (mode->clock * 1000) / mode->htotal; /* hsync in Hz */ |
| @@ -61,8 +61,9 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali · 60 unmodified lines | |||
| 61 | return NULL; | 61 | return NULL; |
| 62 | 62 | ||
| 63 | dmah->size = size; | 63 | dmah->size = size; |
| 64 | dmah->vaddr = dma_zalloc_coherent(&dev->pdev->dev, size, &dmah->busaddr, | 64 | dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size, |
| 65 | GFP_KERNEL | __GFP_COMP); | 65 | &dmah->busaddr, |
| 66 | GFP_KERNEL | __GFP_COMP); | ||
| 66 | 67 | ||
| 67 | if (dmah->vaddr == NULL) { | 68 | if (dmah->vaddr == NULL) { |
| 68 | kfree(dmah); | 69 | kfree(dmah); |
| @@ -2799,6 +2799,7 @@ static int init_broadwell_mmio_info(struct intel_gvt *gvt) · 2798 unmodified lines | |||
| 2799 | MMIO_DFH(_MMIO(0xe2a0), D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); | 2799 | MMIO_DFH(_MMIO(0xe2a0), D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); |
| 2800 | MMIO_DFH(_MMIO(0xe2b0), D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); | 2800 | MMIO_DFH(_MMIO(0xe2b0), D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); |
| 2801 | MMIO_DFH(_MMIO(0xe2c0), D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); | 2801 | MMIO_DFH(_MMIO(0xe2c0), D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); |
| 2802 | MMIO_DFH(_MMIO(0x21f0), D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); | ||
| 2802 | return 0; | 2803 | return 0; |
| 2803 | } | 2804 | } |
| 2804 | 2805 | ||
| @@ -41,7 +41,7 @@ struct intel_gvt_mpt { · 40 unmodified lines | |||
| 41 | int (*host_init)(struct device *dev, void *gvt, const void *ops); | 41 | int (*host_init)(struct device *dev, void *gvt, const void *ops); |
| 42 | void (*host_exit)(struct device *dev, void *gvt); | 42 | void (*host_exit)(struct device *dev, void *gvt); |
| 43 | int (*attach_vgpu)(void *vgpu, unsigned long *handle); | 43 | int (*attach_vgpu)(void *vgpu, unsigned long *handle); |
| 44 | void (*detach_vgpu)(unsigned long handle); | 44 | void (*detach_vgpu)(void *vgpu); |
| 45 | int (*inject_msi)(unsigned long handle, u32 addr, u16 data); | 45 | int (*inject_msi)(unsigned long handle, u32 addr, u16 data); |
| 46 | unsigned long (*from_virt_to_mfn)(void *p); | 46 | unsigned long (*from_virt_to_mfn)(void *p); |
| 47 | int (*enable_page_track)(unsigned long handle, u64 gfn); | 47 | int (*enable_page_track)(unsigned long handle, u64 gfn); |
| @@ -996,7 +996,7 @@ static int intel_vgpu_mmap(struct mdev_device *mdev, struct vm_area_struct *vma) · 995 unmodified lines | |||
| 996 | { | 996 | { |
| 997 | unsigned int index; | 997 | unsigned int index; |
| 998 | u64 virtaddr; | 998 | u64 virtaddr; |
| 999 | unsigned long req_size, pgoff = 0; | 999 | unsigned long req_size, pgoff, req_start; |
| 1000 | pgprot_t pg_prot; | 1000 | pgprot_t pg_prot; |
| 1001 | struct intel_vgpu *vgpu = mdev_get_drvdata(mdev); | 1001 | struct intel_vgpu *vgpu = mdev_get_drvdata(mdev); |
| 1002 | 1002 | ||
| @@ -1014,7 +1014,17 @@ static int intel_vgpu_mmap(struct mdev_device *mdev, struct vm_area_struct *vma) · 11 unmodified lines | |||
| 1014 | pg_prot = vma->vm_page_prot; | 1014 | pg_prot = vma->vm_page_prot; |
| 1015 | virtaddr = vma->vm_start; | 1015 | virtaddr = vma->vm_start; |
| 1016 | req_size = vma->vm_end - vma->vm_start; | 1016 | req_size = vma->vm_end - vma->vm_start; |
| 1017 | pgoff = vgpu_aperture_pa_base(vgpu) >> PAGE_SHIFT; | 1017 | pgoff = vma->vm_pgoff & |
| 1018 | ((1U << (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT)) - 1); | ||
| 1019 | req_start = pgoff << PAGE_SHIFT; | ||
| 1020 | |||
| 1021 | if (!intel_vgpu_in_aperture(vgpu, req_start)) | ||
| 1022 | return -EINVAL; | ||
| 1023 | if (req_start + req_size > | ||
| 1024 | vgpu_aperture_offset(vgpu) + vgpu_aperture_sz(vgpu)) | ||
| 1025 | return -EINVAL; | ||
| 1026 | |||
| 1027 | pgoff = (gvt_aperture_pa_base(vgpu->gvt) >> PAGE_SHIFT) + pgoff; | ||
| 1018 | 1028 | ||
| 1019 | return remap_pfn_range(vma, virtaddr, pgoff, req_size, pg_prot); | 1029 | return remap_pfn_range(vma, virtaddr, pgoff, req_size, pg_prot); |
| 1020 | } | 1030 | } |
| @@ -1662,9 +1672,21 @@ static int kvmgt_attach_vgpu(void *vgpu, unsigned long *handle) · 641 unmodified lines | |||
| 1662 | return 0; | 1672 | return 0; |
| 1663 | } | 1673 | } |
| 1664 | 1674 | ||
| 1665 | static void kvmgt_detach_vgpu(unsigned long handle) | 1675 | static void kvmgt_detach_vgpu(void *p_vgpu) |
| 1666 | { | 1676 | { |
| 1667 | /* nothing to do here */ | 1677 | int i; |
| 1678 | struct intel_vgpu *vgpu = (struct intel_vgpu *)p_vgpu; | ||
| 1679 | |||
| 1680 | if (!vgpu->vdev.region) | ||
| 1681 | return; | ||
| 1682 | |||
| 1683 | for (i = 0; i < vgpu->vdev.num_regions; i++) | ||
| 1684 | if (vgpu->vdev.region[i].ops->release) | ||
| 1685 | vgpu->vdev.region[i].ops->release(vgpu, | ||
| 1686 | &vgpu->vdev.region[i]); | ||
| 1687 | vgpu->vdev.num_regions = 0; | ||
| 1688 | kfree(vgpu->vdev.region); | ||
| 1689 | vgpu->vdev.region = NULL; | ||
| 1668 | } | 1690 | } |
| 1669 | 1691 | ||
| 1670 | static int kvmgt_inject_msi(unsigned long handle, u32 addr, u16 data) | 1692 | static int kvmgt_inject_msi(unsigned long handle, u32 addr, u16 data) |
| @@ -101,7 +101,7 @@ static inline void intel_gvt_hypervisor_detach_vgpu(struct intel_vgpu *vgpu) · 100 unmodified lines | |||
| 101 | if (!intel_gvt_host.mpt->detach_vgpu) | 101 | if (!intel_gvt_host.mpt->detach_vgpu) |
| 102 | return; | 102 | return; |
| 103 | 103 | ||
| 104 | intel_gvt_host.mpt->detach_vgpu(vgpu->handle); | 104 | intel_gvt_host.mpt->detach_vgpu(vgpu); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | #define MSI_CAP_CONTROL(offset) (offset + 2) | 107 | #define MSI_CAP_CONTROL(offset) (offset + 2) |
| @@ -332,6 +332,9 @@ static void release_shadow_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 331 unmodified lines | |||
| 332 | 332 | ||
| 333 | i915_gem_object_unpin_map(wa_ctx->indirect_ctx.obj); | 333 | i915_gem_object_unpin_map(wa_ctx->indirect_ctx.obj); |
| 334 | i915_gem_object_put(wa_ctx->indirect_ctx.obj); | 334 | i915_gem_object_put(wa_ctx->indirect_ctx.obj); |
| 335 | |||
| 336 | wa_ctx->indirect_ctx.obj = NULL; | ||
| 337 | wa_ctx->indirect_ctx.shadow_va = NULL; | ||
| 335 | } | 338 | } |
| 336 | 339 | ||
| 337 | static int set_context_ppgtt_from_shadow(struct intel_vgpu_workload *workload, | 340 | static int set_context_ppgtt_from_shadow(struct intel_vgpu_workload *workload, |
| @@ -356,6 +359,33 @@ static int set_context_ppgtt_from_shadow(struct intel_vgpu_workload *workload, · 18 unmodified lines | |||
| 356 | return 0; | 359 | return 0; |
| 357 | } | 360 | } |
| 358 | 361 | ||
| 362 | static int | ||
| 363 | intel_gvt_workload_req_alloc(struct intel_vgpu_workload *workload) | ||
| 364 | { | ||
| 365 | struct intel_vgpu *vgpu = workload->vgpu; | ||
| 366 | struct intel_vgpu_submission *s = &vgpu->submission; | ||
| 367 | struct i915_gem_context *shadow_ctx = s->shadow_ctx; | ||
| 368 | struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; | ||
| 369 | struct intel_engine_cs *engine = dev_priv->engine[workload->ring_id]; | ||
| 370 | struct i915_request *rq; | ||
| 371 | int ret = 0; | ||
| 372 | |||
| 373 | lockdep_assert_held(&dev_priv->drm.struct_mutex); | ||
| 374 | |||
| 375 | if (workload->req) | ||
| 376 | goto out; | ||
| 377 | |||
| 378 | rq = i915_request_alloc(engine, shadow_ctx); | ||
| 379 | if (IS_ERR(rq)) { | ||
| 380 | gvt_vgpu_err("fail to allocate gem request\n"); | ||
| 381 | ret = PTR_ERR(rq); | ||
| 382 | goto out; | ||
| 383 | } | ||
| 384 | workload->req = i915_request_get(rq); | ||
| 385 | out: | ||
| 386 | return ret; | ||
| 387 | } | ||
| 388 | |||
| 359 | /** | 389 | /** |
| 360 | * intel_gvt_scan_and_shadow_workload - audit the workload by scanning and | 390 | * intel_gvt_scan_and_shadow_workload - audit the workload by scanning and |
| 361 | * shadow it as well, include ringbuffer,wa_ctx and ctx. | 391 | * shadow it as well, include ringbuffer,wa_ctx and ctx. |
| @@ -372,12 +402,11 @@ int intel_gvt_scan_and_shadow_workload(struct intel_vgpu_workload *workload) · 10 unmodified lines | |||
| 372 | struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; | 402 | struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; |
| 373 | struct intel_engine_cs *engine = dev_priv->engine[workload->ring_id]; | 403 | struct intel_engine_cs *engine = dev_priv->engine[workload->ring_id]; |
| 374 | struct intel_context *ce; | 404 | struct intel_context *ce; |
| 375 | struct i915_request *rq; | ||
| 376 | int ret; | 405 | int ret; |
| 377 | 406 | ||
| 378 | lockdep_assert_held(&dev_priv->drm.struct_mutex); | 407 | lockdep_assert_held(&dev_priv->drm.struct_mutex); |
| 379 | 408 | ||
| 380 | if (workload->req) | 409 | if (workload->shadow) |
| 381 | return 0; | 410 | return 0; |
| 382 | 411 | ||
| 383 | ret = set_context_ppgtt_from_shadow(workload, shadow_ctx); | 412 | ret = set_context_ppgtt_from_shadow(workload, shadow_ctx); |
| @@ -417,22 +446,8 @@ int intel_gvt_scan_and_shadow_workload(struct intel_vgpu_workload *workload) · 33 unmodified lines | |||
| 417 | goto err_shadow; | 446 | goto err_shadow; |
| 418 | } | 447 | } |
| 419 | 448 | ||
| 420 | rq = i915_request_alloc(engine, shadow_ctx); | 449 | workload->shadow = true; |
| 421 | if (IS_ERR(rq)) { | ||
| 422 | gvt_vgpu_err("fail to allocate gem request\n"); | ||
| 423 | ret = PTR_ERR(rq); | ||
| 424 | goto err_shadow; | ||
| 425 | } | ||
| 426 | workload->req = i915_request_get(rq); | ||
| 427 | |||
| 428 | ret = populate_shadow_context(workload); | ||
| 429 | if (ret) | ||
| 430 | goto err_req; | ||
| 431 | |||
| 432 | return 0; | 450 | return 0; |
| 433 | err_req: | ||
| 434 | rq = fetch_and_zero(&workload->req); | ||
| 435 | i915_request_put(rq); | ||
| 436 | err_shadow: | 451 | err_shadow: |
| 437 | release_shadow_wa_ctx(&workload->wa_ctx); | 452 | release_shadow_wa_ctx(&workload->wa_ctx); |
| 438 | err_unpin: | 453 | err_unpin: |
| @@ -671,23 +686,31 @@ static int dispatch_workload(struct intel_vgpu_workload *workload) · 232 unmodified lines | |||
| 671 | mutex_lock(&vgpu->vgpu_lock); | 686 | mutex_lock(&vgpu->vgpu_lock); |
| 672 | mutex_lock(&dev_priv->drm.struct_mutex); | 687 | mutex_lock(&dev_priv->drm.struct_mutex); |
| 673 | 688 | ||
| 689 | ret = intel_gvt_workload_req_alloc(workload); | ||
| 690 | if (ret) | ||
| 691 | goto err_req; | ||
| 692 | |||
| 674 | ret = intel_gvt_scan_and_shadow_workload(workload); | 693 | ret = intel_gvt_scan_and_shadow_workload(workload); |
| 675 | if (ret) | 694 | if (ret) |
| 676 | goto out; | 695 | goto out; |
| 677 | 696 | ||
| 678 | ret = prepare_workload(workload); | 697 | ret = populate_shadow_context(workload); |
| 698 | if (ret) { | ||
| 699 | release_shadow_wa_ctx(&workload->wa_ctx); | ||
| 700 | goto out; | ||
| 701 | } | ||
| 679 | 702 | ||
| 703 | ret = prepare_workload(workload); | ||
| 680 | out: | 704 | out: |
| 681 | if (ret) | ||
| 682 | workload->status = ret; | ||
| 683 | |||
| 684 | if (!IS_ERR_OR_NULL(workload->req)) { | 705 | if (!IS_ERR_OR_NULL(workload->req)) { |
| 685 | gvt_dbg_sched("ring id %d submit workload to i915 %p\n", | 706 | gvt_dbg_sched("ring id %d submit workload to i915 %p\n", |
| 686 | ring_id, workload->req); | 707 | ring_id, workload->req); |
| 687 | i915_request_add(workload->req); | 708 | i915_request_add(workload->req); |
| 688 | workload->dispatched = true; | 709 | workload->dispatched = true; |
| 689 | } | 710 | } |
| 690 | 711 | err_req: | |
| 712 | if (ret) | ||
| 713 | workload->status = ret; | ||
| 691 | mutex_unlock(&dev_priv->drm.struct_mutex); | 714 | mutex_unlock(&dev_priv->drm.struct_mutex); |
| 692 | mutex_unlock(&vgpu->vgpu_lock); | 715 | mutex_unlock(&vgpu->vgpu_lock); |
| 693 | return ret; | 716 | return ret; |
| @@ -891,11 +914,6 @@ static void complete_current_workload(struct intel_gvt *gvt, int ring_id) · 197 unmodified lines | |||
| 891 | 914 | ||
| 892 | list_del_init(&workload->list); | 915 | list_del_init(&workload->list); |
| 893 | 916 | ||
| 894 | if (!workload->status) { | ||
| 895 | release_shadow_batch_buffer(workload); | ||
| 896 | release_shadow_wa_ctx(&workload->wa_ctx); | ||
| 897 | } | ||
| 898 | |||
| 899 | if (workload->status || (vgpu->resetting_eng & ENGINE_MASK(ring_id))) { | 917 | if (workload->status || (vgpu->resetting_eng & ENGINE_MASK(ring_id))) { |
| 900 | /* if workload->status is not successful means HW GPU | 918 | /* if workload->status is not successful means HW GPU |
| 901 | * has occurred GPU hang or something wrong with i915/GVT, | 919 | * has occurred GPU hang or something wrong with i915/GVT, |
| @@ -1263,6 +1281,9 @@ void intel_vgpu_destroy_workload(struct intel_vgpu_workload *workload) · 361 unmodified lines | |||
| 1263 | { | 1281 | { |
| 1264 | struct intel_vgpu_submission *s = &workload->vgpu->submission; | 1282 | struct intel_vgpu_submission *s = &workload->vgpu->submission; |
| 1265 | 1283 | ||
| 1284 | release_shadow_batch_buffer(workload); | ||
| 1285 | release_shadow_wa_ctx(&workload->wa_ctx); | ||
| 1286 | |||
| 1266 | if (workload->shadow_mm) | 1287 | if (workload->shadow_mm) |
| 1267 | intel_vgpu_mm_put(workload->shadow_mm); | 1288 | intel_vgpu_mm_put(workload->shadow_mm); |
| 1268 | 1289 | ||
| @@ -83,6 +83,7 @@ struct intel_vgpu_workload { · 82 unmodified lines | |||
| 83 | struct i915_request *req; | 83 | struct i915_request *req; |
| 84 | /* if this workload has been dispatched to i915? */ | 84 | /* if this workload has been dispatched to i915? */ |
| 85 | bool dispatched; | 85 | bool dispatched; |
| 86 | bool shadow; /* if workload has done shadow of guest request */ | ||
| 86 | int status; | 87 | int status; |
| 87 | 88 | ||
| 88 | struct intel_vgpu_mm *shadow_mm; | 89 | struct intel_vgpu_mm *shadow_mm; |
| @@ -984,8 +984,8 @@ static int i915_gpu_info_open(struct inode *inode, struct file *file) · 983 unmodified lines | |||
| 984 | intel_runtime_pm_get(i915); | 984 | intel_runtime_pm_get(i915); |
| 985 | gpu = i915_capture_gpu_state(i915); | 985 | gpu = i915_capture_gpu_state(i915); |
| 986 | intel_runtime_pm_put(i915); | 986 | intel_runtime_pm_put(i915); |
| 987 | if (!gpu) | 987 | if (IS_ERR(gpu)) |
| 988 | return -ENOMEM; | 988 | return PTR_ERR(gpu); |
| 989 | 989 | ||
| 990 | file->private_data = gpu; | 990 | file->private_data = gpu; |
| 991 | return 0; | 991 | return 0; |
| @@ -1018,7 +1018,13 @@ i915_error_state_write(struct file *filp, · 26 unmodified lines | |||
| 1018 | 1018 | ||
| 1019 | static int i915_error_state_open(struct inode *inode, struct file *file) | 1019 | static int i915_error_state_open(struct inode *inode, struct file *file) |
| 1020 | { | 1020 | { |
| 1021 | file->private_data = i915_first_error_state(inode->i_private); | 1021 | struct i915_gpu_state *error; |
| 1022 | |||
| 1023 | error = i915_first_error_state(inode->i_private); | ||
| 1024 | if (IS_ERR(error)) | ||
| 1025 | return PTR_ERR(error); | ||
| 1026 | |||
| 1027 | file->private_data = error; | ||
| 1022 | return 0; | 1028 | return 0; |
| 1023 | } | 1029 | } |
| 1024 | 1030 | ||
| @@ -2075,6 +2075,7 @@ static struct i915_vma *pd_vma_create(struct gen6_hw_ppgtt *ppgtt, int size) · 2074 unmodified lines | |||
| 2075 | int gen6_ppgtt_pin(struct i915_hw_ppgtt *base) | 2075 | int gen6_ppgtt_pin(struct i915_hw_ppgtt *base) |
| 2076 | { | 2076 | { |
| 2077 | struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(base); | 2077 | struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(base); |
| 2078 | int err; | ||
| 2078 | 2079 | ||
| 2079 | /* | 2080 | /* |
| 2080 | * Workaround the limited maximum vma->pin_count and the aliasing_ppgtt | 2081 | * Workaround the limited maximum vma->pin_count and the aliasing_ppgtt |
| @@ -2090,9 +2091,17 @@ int gen6_ppgtt_pin(struct i915_hw_ppgtt *base) · 9 unmodified lines | |||
| 2090 | * allocator works in address space sizes, so it's multiplied by page | 2091 | * allocator works in address space sizes, so it's multiplied by page |
| 2091 | * size. We allocate at the top of the GTT to avoid fragmentation. | 2092 | * size. We allocate at the top of the GTT to avoid fragmentation. |
| 2092 | */ | 2093 | */ |
| 2093 | return i915_vma_pin(ppgtt->vma, | 2094 | err = i915_vma_pin(ppgtt->vma, |
| 2094 | 0, GEN6_PD_ALIGN, | 2095 | 0, GEN6_PD_ALIGN, |
| 2095 | PIN_GLOBAL | PIN_HIGH); | 2096 | PIN_GLOBAL | PIN_HIGH); |
| 2097 | if (err) | ||
| 2098 | goto unpin; | ||
| 2099 | |||
| 2100 | return 0; | ||
| 2101 | |||
| 2102 | unpin: | ||
| 2103 | ppgtt->pin_count = 0; | ||
| 2104 | return err; | ||
| 2096 | } | 2105 | } |
| 2097 | 2106 | ||
| 2098 | void gen6_ppgtt_unpin(struct i915_hw_ppgtt *base) | 2107 | void gen6_ppgtt_unpin(struct i915_hw_ppgtt *base) |
| @@ -1907,9 +1907,16 @@ i915_capture_gpu_state(struct drm_i915_private *i915) · 1906 unmodified lines | |||
| 1907 | { | 1907 | { |
| 1908 | struct i915_gpu_state *error; | 1908 | struct i915_gpu_state *error; |
| 1909 | 1909 | ||
| 1910 | /* Check if GPU capture has been disabled */ | ||
| 1911 | error = READ_ONCE(i915->gpu_error.first_error); | ||
| 1912 | if (IS_ERR(error)) | ||
| 1913 | return error; | ||
| 1914 | |||
| 1910 | error = kzalloc(sizeof(*error), GFP_ATOMIC); | 1915 | error = kzalloc(sizeof(*error), GFP_ATOMIC); |
| 1911 | if (!error) | 1916 | if (!error) { |
| 1912 | return NULL; | 1917 | i915_disable_error_state(i915, -ENOMEM); |
| 1918 | return ERR_PTR(-ENOMEM); | ||
| 1919 | } | ||
| 1913 | 1920 | ||
| 1914 | kref_init(&error->ref); | 1921 | kref_init(&error->ref); |
| 1915 | error->i915 = i915; | 1922 | error->i915 = i915; |
| @@ -1945,11 +1952,8 @@ void i915_capture_error_state(struct drm_i915_private *i915, · 29 unmodified lines | |||
| 1945 | return; | 1952 | return; |
| 1946 | 1953 | ||
| 1947 | error = i915_capture_gpu_state(i915); | 1954 | error = i915_capture_gpu_state(i915); |
| 1948 | if (!error) { | 1955 | if (IS_ERR(error)) |
| 1949 | DRM_DEBUG_DRIVER("out of memory, not capturing error state\n"); | ||
| 1950 | i915_disable_error_state(i915, -ENOMEM); | ||
| 1951 | return; | 1956 | return; |
| 1952 | } | ||
| 1953 | 1957 | ||
| 1954 | i915_error_capture_msg(i915, error, engine_mask, error_msg); | 1958 | i915_error_capture_msg(i915, error, engine_mask, error_msg); |
| 1955 | DRM_INFO("%s\n", error->error_msg); | 1959 | DRM_INFO("%s\n", error->error_msg); |
| @@ -1987,7 +1991,7 @@ i915_first_error_state(struct drm_i915_private *i915) · 31 unmodified lines | |||
| 1987 | 1991 | ||
| 1988 | spin_lock_irq(&i915->gpu_error.lock); | 1992 | spin_lock_irq(&i915->gpu_error.lock); |
| 1989 | error = i915->gpu_error.first_error; | 1993 | error = i915->gpu_error.first_error; |
| 1990 | if (error) | 1994 | if (!IS_ERR_OR_NULL(error)) |
| 1991 | i915_gpu_state_get(error); | 1995 | i915_gpu_state_get(error); |
| 1992 | spin_unlock_irq(&i915->gpu_error.lock); | 1996 | spin_unlock_irq(&i915->gpu_error.lock); |
| 1993 | 1997 | ||
| @@ -2000,10 +2004,11 @@ void i915_reset_error_state(struct drm_i915_private *i915) · 6 unmodified lines | |||
| 2000 | 2004 | ||
| 2001 | spin_lock_irq(&i915->gpu_error.lock); | 2005 | spin_lock_irq(&i915->gpu_error.lock); |
| 2002 | error = i915->gpu_error.first_error; | 2006 | error = i915->gpu_error.first_error; |
| 2003 | i915->gpu_error.first_error = NULL; | 2007 | if (error != ERR_PTR(-ENODEV)) /* if disabled, always disabled */ |
| 2008 | i915->gpu_error.first_error = NULL; | ||
| 2004 | spin_unlock_irq(&i915->gpu_error.lock); | 2009 | spin_unlock_irq(&i915->gpu_error.lock); |
| 2005 | 2010 | ||
| 2006 | if (!IS_ERR(error)) | 2011 | if (!IS_ERR_OR_NULL(error)) |
| 2007 | i915_gpu_state_put(error); | 2012 | i915_gpu_state_put(error); |
| 2008 | } | 2013 | } |
| 2009 | 2014 | ||
| @@ -521,7 +521,9 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj, · 520 unmodified lines | |||
| 521 | ssize_t ret; | 521 | ssize_t ret; |
| 522 | 522 | ||
| 523 | gpu = i915_first_error_state(i915); | 523 | gpu = i915_first_error_state(i915); |
| 524 | if (gpu) { | 524 | if (IS_ERR(gpu)) { |
| 525 | ret = PTR_ERR(gpu); | ||
| 526 | } else if (gpu) { | ||
| 525 | ret = i915_gpu_state_copy_to_buffer(gpu, buf, off, count); | 527 | ret = i915_gpu_state_copy_to_buffer(gpu, buf, off, count); |
| 526 | i915_gpu_state_put(gpu); | 528 | i915_gpu_state_put(gpu); |
| 527 | } else { | 529 | } else { |
| @@ -1086,7 +1086,7 @@ static uint32_t icl_pll_to_ddi_pll_sel(struct intel_encoder *encoder, · 1085 unmodified lines | |||
| 1086 | return DDI_CLK_SEL_TBT_810; | 1086 | return DDI_CLK_SEL_TBT_810; |
| 1087 | default: | 1087 | default: |
| 1088 | MISSING_CASE(clock); | 1088 | MISSING_CASE(clock); |
| 1089 | break; | 1089 | return DDI_CLK_SEL_NONE; |
| 1090 | } | 1090 | } |
| 1091 | case DPLL_ID_ICL_MGPLL1: | 1091 | case DPLL_ID_ICL_MGPLL1: |
| 1092 | case DPLL_ID_ICL_MGPLL2: | 1092 | case DPLL_ID_ICL_MGPLL2: |
| @@ -15415,16 +15415,45 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc, · 15414 unmodified lines | |||
| 15415 | } | 15415 | } |
| 15416 | } | 15416 | } |
| 15417 | 15417 | ||
| 15418 | static bool has_bogus_dpll_config(const struct intel_crtc_state *crtc_state) | ||
| 15419 | { | ||
| 15420 | struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev); | ||
| 15421 | |||
| 15422 | /* | ||
| 15423 | * Some SNB BIOSen (eg. ASUS K53SV) are known to misprogram | ||
| 15424 | * the hardware when a high res displays plugged in. DPLL P | ||
| 15425 | * divider is zero, and the pipe timings are bonkers. We'll | ||
| 15426 | * try to disable everything in that case. | ||
| 15427 | * | ||
| 15428 | * FIXME would be nice to be able to sanitize this state | ||
| 15429 | * without several WARNs, but for now let's take the easy | ||
| 15430 | * road. | ||
| 15431 | */ | ||
| 15432 | return IS_GEN6(dev_priv) && | ||
| 15433 | crtc_state->base.active && | ||
| 15434 | crtc_state->shared_dpll && | ||
| 15435 | crtc_state->port_clock == 0; | ||
| 15436 | } | ||
| 15437 | |||
| 15418 | static void intel_sanitize_encoder(struct intel_encoder *encoder) | 15438 | static void intel_sanitize_encoder(struct intel_encoder *encoder) |
| 15419 | { | 15439 | { |
| 15420 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); | 15440 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
| 15421 | struct intel_connector *connector; | 15441 | struct intel_connector *connector; |
| 15442 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); | ||
| 15443 | struct intel_crtc_state *crtc_state = crtc ? | ||
| 15444 | to_intel_crtc_state(crtc->base.state) : NULL; | ||
| 15422 | 15445 | ||
| 15423 | /* We need to check both for a crtc link (meaning that the | 15446 | /* We need to check both for a crtc link (meaning that the |
| 15424 | * encoder is active and trying to read from a pipe) and the | 15447 | * encoder is active and trying to read from a pipe) and the |
| 15425 | * pipe itself being active. */ | 15448 | * pipe itself being active. */ |
| 15426 | bool has_active_crtc = encoder->base.crtc && | 15449 | bool has_active_crtc = crtc_state && |
| 15427 | to_intel_crtc(encoder->base.crtc)->active; | 15450 | crtc_state->base.active; |
| 15451 | |||
| 15452 | if (crtc_state && has_bogus_dpll_config(crtc_state)) { | ||
| 15453 | DRM_DEBUG_KMS("BIOS has misprogrammed the hardware. Disabling pipe %c\n", | ||
| 15454 | pipe_name(crtc->pipe)); | ||
| 15455 | has_active_crtc = false; | ||
| 15456 | } | ||
| 15428 | 15457 | ||
| 15429 | connector = intel_encoder_find_connector(encoder); | 15458 | connector = intel_encoder_find_connector(encoder); |
| 15430 | if (connector && !has_active_crtc) { | 15459 | if (connector && !has_active_crtc) { |
| @@ -15435,16 +15464,25 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder) · 4 unmodified lines | |||
| 15435 | /* Connector is active, but has no active pipe. This is | 15464 | /* Connector is active, but has no active pipe. This is |
| 15436 | * fallout from our resume register restoring. Disable | 15465 | * fallout from our resume register restoring. Disable |
| 15437 | * the encoder manually again. */ | 15466 | * the encoder manually again. */ |
| 15438 | if (encoder->base.crtc) { | 15467 | if (crtc_state) { |
| 15439 | struct drm_crtc_state *crtc_state = encoder->base.crtc->state; | 15468 | struct drm_encoder *best_encoder; |
| 15440 | 15469 | ||
| 15441 | DRM_DEBUG_KMS("[ENCODER:%d:%s] manually disabled\n", | 15470 | DRM_DEBUG_KMS("[ENCODER:%d:%s] manually disabled\n", |
| 15442 | encoder->base.base.id, | 15471 | encoder->base.base.id, |
| 15443 | encoder->base.name); | 15472 | encoder->base.name); |
| 15473 | |||
| 15474 | /* avoid oopsing in case the hooks consult best_encoder */ | ||
| 15475 | best_encoder = connector->base.state->best_encoder; | ||
| 15476 | connector->base.state->best_encoder = &encoder->base; | ||
| 15477 | |||
| 15444 | if (encoder->disable) | 15478 | if (encoder->disable) |
| 15445 | encoder->disable(encoder, to_intel_crtc_state(crtc_state), connector->base.state); | 15479 | encoder->disable(encoder, crtc_state, |
| 15480 | connector->base.state); | ||
| 15446 | if (encoder->post_disable) | 15481 | if (encoder->post_disable) |
| 15447 | encoder->post_disable(encoder, to_intel_crtc_state(crtc_state), connector->base.state); | 15482 | encoder->post_disable(encoder, crtc_state, |
| 15483 | connector->base.state); | ||
| 15484 | |||
| 15485 | connector->base.state->best_encoder = best_encoder; | ||
| 15448 | } | 15486 | } |
| 15449 | encoder->base.crtc = NULL; | 15487 | encoder->base.crtc = NULL; |
| 15450 | 15488 | ||
| @@ -303,6 +303,7 @@ static void __unwind_incomplete_requests(struct intel_engine_cs *engine) · 302 unmodified lines | |||
| 303 | */ | 303 | */ |
| 304 | if (!(prio & I915_PRIORITY_NEWCLIENT)) { | 304 | if (!(prio & I915_PRIORITY_NEWCLIENT)) { |
| 305 | prio |= I915_PRIORITY_NEWCLIENT; | 305 | prio |= I915_PRIORITY_NEWCLIENT; |
| 306 | active->sched.attr.priority = prio; | ||
| 306 | list_move_tail(&active->sched.link, | 307 | list_move_tail(&active->sched.link, |
| 307 | i915_sched_lookup_priolist(engine, prio)); | 308 | i915_sched_lookup_priolist(engine, prio)); |
| 308 | } | 309 | } |
| @@ -645,6 +646,9 @@ static void execlists_dequeue(struct intel_engine_cs *engine) · 336 unmodified lines | |||
| 645 | int i; | 646 | int i; |
| 646 | 647 | ||
| 647 | priolist_for_each_request_consume(rq, rn, p, i) { | 648 | priolist_for_each_request_consume(rq, rn, p, i) { |
| 649 | GEM_BUG_ON(last && | ||
| 650 | need_preempt(engine, last, rq_prio(rq))); | ||
| 651 | |||
| 648 | /* | 652 | /* |
| 649 | * Can we combine this request with the current port? | 653 | * Can we combine this request with the current port? |
| 650 | * It has to be the same context/ringbuffer and not | 654 | * It has to be the same context/ringbuffer and not |
| @@ -2244,6 +2248,8 @@ static int logical_ring_init(struct intel_engine_cs *engine) · 1593 unmodified lines | |||
| 2244 | if (ret) | 2248 | if (ret) |
| 2245 | return ret; | 2249 | return ret; |
| 2246 | 2250 | ||
| 2251 | intel_engine_init_workarounds(engine); | ||
| 2252 | |||
| 2247 | if (HAS_LOGICAL_RING_ELSQ(i915)) { | 2253 | if (HAS_LOGICAL_RING_ELSQ(i915)) { |
| 2248 | execlists->submit_reg = i915->regs + | 2254 | execlists->submit_reg = i915->regs + |
| 2249 | i915_mmio_reg_offset(RING_EXECLIST_SQ_CONTENTS(engine)); | 2255 | i915_mmio_reg_offset(RING_EXECLIST_SQ_CONTENTS(engine)); |
| @@ -2310,7 +2316,6 @@ int logical_render_ring_init(struct intel_engine_cs *engine) · 60 unmodified lines | |||
| 2310 | } | 2316 | } |
| 2311 | 2317 | ||
| 2312 | intel_engine_init_whitelist(engine); | 2318 | intel_engine_init_whitelist(engine); |
| 2313 | intel_engine_init_workarounds(engine); | ||
| 2314 | 2319 | ||
| 2315 | return 0; | 2320 | return 0; |
| 2316 | } | 2321 | } |
| @@ -274,10 +274,16 @@ void intel_psr_init_dpcd(struct intel_dp *intel_dp) · 273 unmodified lines | |||
| 274 | DRM_DEBUG_KMS("eDP panel supports PSR version %x\n", | 274 | DRM_DEBUG_KMS("eDP panel supports PSR version %x\n", |
| 275 | intel_dp->psr_dpcd[0]); | 275 | intel_dp->psr_dpcd[0]); |
| 276 | 276 | ||
| 277 | if (drm_dp_has_quirk(&intel_dp->desc, DP_DPCD_QUIRK_NO_PSR)) { | ||
| 278 | DRM_DEBUG_KMS("PSR support not currently available for this panel\n"); | ||
| 279 | return; | ||
| 280 | } | ||
| 281 | |||
| 277 | if (!(intel_dp->edp_dpcd[1] & DP_EDP_SET_POWER_CAP)) { | 282 | if (!(intel_dp->edp_dpcd[1] & DP_EDP_SET_POWER_CAP)) { |
| 278 | DRM_DEBUG_KMS("Panel lacks power state control, PSR cannot be enabled\n"); | 283 | DRM_DEBUG_KMS("Panel lacks power state control, PSR cannot be enabled\n"); |
| 279 | return; | 284 | return; |
| 280 | } | 285 | } |
| 286 | |||
| 281 | dev_priv->psr.sink_support = true; | 287 | dev_priv->psr.sink_support = true; |
| 282 | dev_priv->psr.sink_sync_latency = | 288 | dev_priv->psr.sink_sync_latency = |
| 283 | intel_dp_get_sink_sync_latency(intel_dp); | 289 | intel_dp_get_sink_sync_latency(intel_dp); |
| @@ -494,7 +494,7 @@ skl_program_plane(struct intel_plane *plane, · 493 unmodified lines | |||
| 494 | 494 | ||
| 495 | keymax = (key->max_value & 0xffffff) | PLANE_KEYMAX_ALPHA(alpha); | 495 | keymax = (key->max_value & 0xffffff) | PLANE_KEYMAX_ALPHA(alpha); |
| 496 | 496 | ||
| 497 | keymsk = key->channel_mask & 0x3ffffff; | 497 | keymsk = key->channel_mask & 0x7ffffff; |
| 498 | if (alpha < 0xff) | 498 | if (alpha < 0xff) |
| 499 | keymsk |= PLANE_KEYMSK_ALPHA_ENABLE; | 499 | keymsk |= PLANE_KEYMSK_ALPHA_ENABLE; |
| 500 | 500 | ||
| @@ -46,7 +46,6 @@ struct meson_crtc { · 45 unmodified lines | |||
| 46 | struct drm_crtc base; | 46 | struct drm_crtc base; |
| 47 | struct drm_pending_vblank_event *event; | 47 | struct drm_pending_vblank_event *event; |
| 48 | struct meson_drm *priv; | 48 | struct meson_drm *priv; |
| 49 | bool enabled; | ||
| 50 | }; | 49 | }; |
| 51 | #define to_meson_crtc(x) container_of(x, struct meson_crtc, base) | 50 | #define to_meson_crtc(x) container_of(x, struct meson_crtc, base) |
| 52 | 51 | ||
| @@ -82,7 +81,8 @@ static const struct drm_crtc_funcs meson_crtc_funcs = { · 29 unmodified lines | |||
| 82 | 81 | ||
| 83 | }; | 82 | }; |
| 84 | 83 | ||
| 85 | static void meson_crtc_enable(struct drm_crtc *crtc) | 84 | static void meson_crtc_atomic_enable(struct drm_crtc *crtc, |
| 85 | struct drm_crtc_state *old_state) | ||
| 86 | { | 86 | { |
| 87 | struct meson_crtc *meson_crtc = to_meson_crtc(crtc); | 87 | struct meson_crtc *meson_crtc = to_meson_crtc(crtc); |
| 88 | struct drm_crtc_state *crtc_state = crtc->state; | 88 | struct drm_crtc_state *crtc_state = crtc->state; |
| @@ -108,20 +108,6 @@ static void meson_crtc_enable(struct drm_crtc *crtc) · 19 unmodified lines | |||
| 108 | 108 | ||
| 109 | drm_crtc_vblank_on(crtc); | 109 | drm_crtc_vblank_on(crtc); |
| 110 | 110 | ||
| 111 | meson_crtc->enabled = true; | ||
| 112 | } | ||
| 113 | |||
| 114 | static void meson_crtc_atomic_enable(struct drm_crtc *crtc, | ||
| 115 | struct drm_crtc_state *old_state) | ||
| 116 | { | ||
| 117 | struct meson_crtc *meson_crtc = to_meson_crtc(crtc); | ||
| 118 | struct meson_drm *priv = meson_crtc->priv; | ||
| 119 | |||
| 120 | DRM_DEBUG_DRIVER("\n"); | ||
| 121 | |||
| 122 | if (!meson_crtc->enabled) | ||
| 123 | meson_crtc_enable(crtc); | ||
| 124 | |||
| 125 | priv->viu.osd1_enabled = true; | 111 | priv->viu.osd1_enabled = true; |
| 126 | } | 112 | } |
| 127 | 113 | ||
| @@ -153,8 +139,6 @@ static void meson_crtc_atomic_disable(struct drm_crtc *crtc, · 25 unmodified lines | |||
| 153 | 139 | ||
| 154 | crtc->state->event = NULL; | 140 | crtc->state->event = NULL; |
| 155 | } | 141 | } |
| 156 | |||
| 157 | meson_crtc->enabled = false; | ||
| 158 | } | 142 | } |
| 159 | 143 | ||
| 160 | static void meson_crtc_atomic_begin(struct drm_crtc *crtc, | 144 | static void meson_crtc_atomic_begin(struct drm_crtc *crtc, |
| @@ -163,9 +147,6 @@ static void meson_crtc_atomic_begin(struct drm_crtc *crtc, · 2 unmodified lines | |||
| 163 | struct meson_crtc *meson_crtc = to_meson_crtc(crtc); | 147 | struct meson_crtc *meson_crtc = to_meson_crtc(crtc); |
| 164 | unsigned long flags; | 148 | unsigned long flags; |
| 165 | 149 | ||
| 166 | if (crtc->state->enable && !meson_crtc->enabled) | ||
| 167 | meson_crtc_enable(crtc); | ||
| 168 | |||
| 169 | if (crtc->state->event) { | 150 | if (crtc->state->event) { |
| 170 | WARN_ON(drm_crtc_vblank_get(crtc) != 0); | 151 | WARN_ON(drm_crtc_vblank_get(crtc) != 0); |
| 171 | 152 | ||
| @@ -75,6 +75,10 @@ static const struct drm_mode_config_funcs meson_mode_config_funcs = { · 74 unmodified lines | |||
| 75 | .fb_create = drm_gem_fb_create, | 75 | .fb_create = drm_gem_fb_create, |
| 76 | }; | 76 | }; |
| 77 | 77 | ||
| 78 | static const struct drm_mode_config_helper_funcs meson_mode_config_helpers = { | ||
| 79 | .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, | ||
| 80 | }; | ||
| 81 | |||
| 78 | static irqreturn_t meson_irq(int irq, void *arg) | 82 | static irqreturn_t meson_irq(int irq, void *arg) |
| 79 | { | 83 | { |
| 80 | struct drm_device *dev = arg; | 84 | struct drm_device *dev = arg; |
| @@ -266,6 +270,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) · 185 unmodified lines | |||
| 266 | drm->mode_config.max_width = 3840; | 270 | drm->mode_config.max_width = 3840; |
| 267 | drm->mode_config.max_height = 2160; | 271 | drm->mode_config.max_height = 2160; |
| 268 | drm->mode_config.funcs = &meson_mode_config_funcs; | 272 | drm->mode_config.funcs = &meson_mode_config_funcs; |
| 273 | drm->mode_config.helper_private = &meson_mode_config_helpers; | ||
| 269 | 274 | ||
| 270 | /* Hardware Initialization */ | 275 | /* Hardware Initialization */ |
| 271 | 276 | ||
| @@ -388,8 +393,10 @@ static int meson_probe_remote(struct platform_device *pdev, · 116 unmodified lines | |||
| 388 | remote_node = of_graph_get_remote_port_parent(ep); | 393 | remote_node = of_graph_get_remote_port_parent(ep); |
| 389 | if (!remote_node || | 394 | if (!remote_node || |
| 390 | remote_node == parent || /* Ignore parent endpoint */ | 395 | remote_node == parent || /* Ignore parent endpoint */ |
| 391 | !of_device_is_available(remote_node)) | 396 | !of_device_is_available(remote_node)) { |
| 397 | of_node_put(remote_node); | ||
| 392 | continue; | 398 | continue; |
| 399 | } | ||
| 393 | 400 | ||
| 394 | count += meson_probe_remote(pdev, match, remote, remote_node); | 401 | count += meson_probe_remote(pdev, match, remote, remote_node); |
| 395 | 402 | ||
| @@ -408,10 +415,13 @@ static int meson_drv_probe(struct platform_device *pdev) · 12 unmodified lines | |||
| 408 | 415 | ||
| 409 | for_each_endpoint_of_node(np, ep) { | 416 | for_each_endpoint_of_node(np, ep) { |
| 410 | remote = of_graph_get_remote_port_parent(ep); | 417 | remote = of_graph_get_remote_port_parent(ep); |
| 411 | if (!remote || !of_device_is_available(remote)) | 418 | if (!remote || !of_device_is_available(remote)) { |
| 419 | of_node_put(remote); | ||
| 412 | continue; | 420 | continue; |
| 421 | } | ||
| 413 | 422 | ||
| 414 | count += meson_probe_remote(pdev, &match, np, remote); | 423 | count += meson_probe_remote(pdev, &match, np, remote); |
| 424 | of_node_put(remote); | ||
| 415 | } | 425 | } |
| 416 | 426 | ||
| 417 | if (count && !match) | 427 | if (count && !match) |
| @@ -944,7 +944,7 @@ static u32 a6xx_gmu_get_arc_level(struct device *dev, unsigned long freq) · 943 unmodified lines | |||
| 944 | np = dev_pm_opp_get_of_node(opp); | 944 | np = dev_pm_opp_get_of_node(opp); |
| 945 | 945 | ||
| 946 | if (np) { | 946 | if (np) { |
| 947 | of_property_read_u32(np, "qcom,level", &val); | 947 | of_property_read_u32(np, "opp-level", &val); |
| 948 | of_node_put(np); | 948 | of_node_put(np); |
| 949 | } | 949 | } |
| 950 | 950 | ||
| @@ -765,7 +765,6 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev, · 764 unmodified lines | |||
| 765 | adreno_gpu->rev = config->rev; | 765 | adreno_gpu->rev = config->rev; |
| 766 | 766 | ||
| 767 | adreno_gpu_config.ioname = "kgsl_3d0_reg_memory"; | 767 | adreno_gpu_config.ioname = "kgsl_3d0_reg_memory"; |
| 768 | adreno_gpu_config.irqname = "kgsl_3d0_irq"; | ||
| 769 | 768 | ||
| 770 | adreno_gpu_config.va_start = SZ_16M; | 769 | adreno_gpu_config.va_start = SZ_16M; |
| 771 | adreno_gpu_config.va_end = 0xffffffff; | 770 | adreno_gpu_config.va_end = 0xffffffff; |
| @@ -365,19 +365,6 @@ static void _dpu_plane_set_qos_ctrl(struct drm_plane *plane, · 364 unmodified lines | |||
| 365 | &pdpu->pipe_qos_cfg); | 365 | &pdpu->pipe_qos_cfg); |
| 366 | } | 366 | } |
| 367 | 367 | ||
| 368 | static void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable) | ||
| 369 | { | ||
| 370 | struct dpu_plane *pdpu = to_dpu_plane(plane); | ||
| 371 | struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane); | ||
| 372 | |||
| 373 | if (!pdpu->is_rt_pipe) | ||
| 374 | return; | ||
| 375 | |||
| 376 | pm_runtime_get_sync(&dpu_kms->pdev->dev); | ||
| 377 | _dpu_plane_set_qos_ctrl(plane, enable, DPU_PLANE_QOS_PANIC_CTRL); | ||
| 378 | pm_runtime_put_sync(&dpu_kms->pdev->dev); | ||
| 379 | } | ||
| 380 | |||
| 381 | /** | 368 | /** |
| 382 | * _dpu_plane_set_ot_limit - set OT limit for the given plane | 369 | * _dpu_plane_set_ot_limit - set OT limit for the given plane |
| 383 | * @plane: Pointer to drm plane | 370 | * @plane: Pointer to drm plane |
| @@ -1248,6 +1235,19 @@ static void dpu_plane_reset(struct drm_plane *plane) · 864 unmodified lines | |||
| 1248 | } | 1235 | } |
| 1249 | 1236 | ||
| 1250 | #ifdef CONFIG_DEBUG_FS | 1237 | #ifdef CONFIG_DEBUG_FS |
| 1238 | static void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable) | ||
| 1239 | { | ||
| 1240 | struct dpu_plane *pdpu = to_dpu_plane(plane); | ||
| 1241 | struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane); | ||
| 1242 | |||
| 1243 | if (!pdpu->is_rt_pipe) | ||
| 1244 | return; | ||
| 1245 | |||
| 1246 | pm_runtime_get_sync(&dpu_kms->pdev->dev); | ||
| 1247 | _dpu_plane_set_qos_ctrl(plane, enable, DPU_PLANE_QOS_PANIC_CTRL); | ||
| 1248 | pm_runtime_put_sync(&dpu_kms->pdev->dev); | ||
| 1249 | } | ||
| 1250 | |||
| 1251 | static ssize_t _dpu_plane_danger_read(struct file *file, | 1251 | static ssize_t _dpu_plane_danger_read(struct file *file, |
| 1252 | char __user *buff, size_t count, loff_t *ppos) | 1252 | char __user *buff, size_t count, loff_t *ppos) |
| 1253 | { | 1253 | { |
| @@ -250,7 +250,8 @@ void msm_gem_purge_vma(struct msm_gem_address_space *aspace, · 249 unmodified lines | |||
| 250 | void msm_gem_unmap_vma(struct msm_gem_address_space *aspace, | 250 | void msm_gem_unmap_vma(struct msm_gem_address_space *aspace, |
| 251 | struct msm_gem_vma *vma); | 251 | struct msm_gem_vma *vma); |
| 252 | int msm_gem_map_vma(struct msm_gem_address_space *aspace, | 252 | int msm_gem_map_vma(struct msm_gem_address_space *aspace, |
| 253 | struct msm_gem_vma *vma, struct sg_table *sgt, int npages); | 253 | struct msm_gem_vma *vma, int prot, |
| 254 | struct sg_table *sgt, int npages); | ||
| 254 | void msm_gem_close_vma(struct msm_gem_address_space *aspace, | 255 | void msm_gem_close_vma(struct msm_gem_address_space *aspace, |
| 255 | struct msm_gem_vma *vma); | 256 | struct msm_gem_vma *vma); |
| 256 | 257 | ||
| @@ -333,6 +334,7 @@ void msm_gem_kernel_put(struct drm_gem_object *bo, · 76 unmodified lines | |||
| 333 | struct drm_gem_object *msm_gem_import(struct drm_device *dev, | 334 | struct drm_gem_object *msm_gem_import(struct drm_device *dev, |
| 334 | struct dma_buf *dmabuf, struct sg_table *sgt); | 335 | struct dma_buf *dmabuf, struct sg_table *sgt); |
| 335 | 336 | ||
| 337 | __printf(2, 3) | ||
| 336 | void msm_gem_object_set_name(struct drm_gem_object *bo, const char *fmt, ...); | 338 | void msm_gem_object_set_name(struct drm_gem_object *bo, const char *fmt, ...); |
| 337 | 339 | ||
| 338 | int msm_framebuffer_prepare(struct drm_framebuffer *fb, | 340 | int msm_framebuffer_prepare(struct drm_framebuffer *fb, |
| @@ -396,12 +398,14 @@ void msm_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m); · 57 unmodified lines | |||
| 396 | int msm_debugfs_late_init(struct drm_device *dev); | 398 | int msm_debugfs_late_init(struct drm_device *dev); |
| 397 | int msm_rd_debugfs_init(struct drm_minor *minor); | 399 | int msm_rd_debugfs_init(struct drm_minor *minor); |
| 398 | void msm_rd_debugfs_cleanup(struct msm_drm_private *priv); | 400 | void msm_rd_debugfs_cleanup(struct msm_drm_private *priv); |
| 401 | __printf(3, 4) | ||
| 399 | void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, | 402 | void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, |
| 400 | const char *fmt, ...); | 403 | const char *fmt, ...); |
| 401 | int msm_perf_debugfs_init(struct drm_minor *minor); | 404 | int msm_perf_debugfs_init(struct drm_minor *minor); |
| 402 | void msm_perf_debugfs_cleanup(struct msm_drm_private *priv); | 405 | void msm_perf_debugfs_cleanup(struct msm_drm_private *priv); |
| 403 | #else | 406 | #else |
| 404 | static inline int msm_debugfs_late_init(struct drm_device *dev) { return 0; } | 407 | static inline int msm_debugfs_late_init(struct drm_device *dev) { return 0; } |
| 408 | __printf(3, 4) | ||
| 405 | static inline void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, | 409 | static inline void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, |
| 406 | const char *fmt, ...) {} | 410 | const char *fmt, ...) {} |
| 407 | static inline void msm_rd_debugfs_cleanup(struct msm_drm_private *priv) {} | 411 | static inline void msm_rd_debugfs_cleanup(struct msm_drm_private *priv) {} |
| @@ -391,6 +391,10 @@ static int msm_gem_pin_iova(struct drm_gem_object *obj, · 390 unmodified lines | |||
| 391 | struct msm_gem_object *msm_obj = to_msm_bo(obj); | 391 | struct msm_gem_object *msm_obj = to_msm_bo(obj); |
| 392 | struct msm_gem_vma *vma; | 392 | struct msm_gem_vma *vma; |
| 393 | struct page **pages; | 393 | struct page **pages; |
| 394 | int prot = IOMMU_READ; | ||
| 395 | |||
| 396 | if (!(msm_obj->flags & MSM_BO_GPU_READONLY)) | ||
| 397 | prot |= IOMMU_WRITE; | ||
| 394 | 398 | ||
| 395 | WARN_ON(!mutex_is_locked(&msm_obj->lock)); | 399 | WARN_ON(!mutex_is_locked(&msm_obj->lock)); |
| 396 | 400 | ||
| @@ -405,8 +409,8 @@ static int msm_gem_pin_iova(struct drm_gem_object *obj, · 8 unmodified lines | |||
| 405 | if (IS_ERR(pages)) | 409 | if (IS_ERR(pages)) |
| 406 | return PTR_ERR(pages); | 410 | return PTR_ERR(pages); |
| 407 | 411 | ||
| 408 | return msm_gem_map_vma(aspace, vma, msm_obj->sgt, | 412 | return msm_gem_map_vma(aspace, vma, prot, |
| 409 | obj->size >> PAGE_SHIFT); | 413 | msm_obj->sgt, obj->size >> PAGE_SHIFT); |
| 410 | } | 414 | } |
| 411 | 415 | ||
| 412 | /* get iova and pin it. Should have a matching put */ | 416 | /* get iova and pin it. Should have a matching put */ |
| @@ -68,7 +68,8 @@ void msm_gem_unmap_vma(struct msm_gem_address_space *aspace, · 67 unmodified lines | |||
| 68 | 68 | ||
| 69 | int | 69 | int |
| 70 | msm_gem_map_vma(struct msm_gem_address_space *aspace, | 70 | msm_gem_map_vma(struct msm_gem_address_space *aspace, |
| 71 | struct msm_gem_vma *vma, struct sg_table *sgt, int npages) | 71 | struct msm_gem_vma *vma, int prot, |
| 72 | struct sg_table *sgt, int npages) | ||
| 72 | { | 73 | { |
| 73 | unsigned size = npages << PAGE_SHIFT; | 74 | unsigned size = npages << PAGE_SHIFT; |
| 74 | int ret = 0; | 75 | int ret = 0; |
| @@ -86,7 +87,7 @@ msm_gem_map_vma(struct msm_gem_address_space *aspace, · 11 unmodified lines | |||
| 86 | 87 | ||
| 87 | if (aspace->mmu) | 88 | if (aspace->mmu) |
| 88 | ret = aspace->mmu->funcs->map(aspace->mmu, vma->iova, sgt, | 89 | ret = aspace->mmu->funcs->map(aspace->mmu, vma->iova, sgt, |
| 89 | size, IOMMU_READ | IOMMU_WRITE); | 90 | size, prot); |
| 90 | 91 | ||
| 91 | if (ret) | 92 | if (ret) |
| 92 | vma->mapped = false; | 93 | vma->mapped = false; |
| @@ -900,7 +900,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, · 899 unmodified lines | |||
| 900 | } | 900 | } |
| 901 | 901 | ||
| 902 | /* Get Interrupt: */ | 902 | /* Get Interrupt: */ |
| 903 | gpu->irq = platform_get_irq_byname(pdev, config->irqname); | 903 | gpu->irq = platform_get_irq(pdev, 0); |
| 904 | if (gpu->irq < 0) { | 904 | if (gpu->irq < 0) { |
| 905 | ret = gpu->irq; | 905 | ret = gpu->irq; |
| 906 | DRM_DEV_ERROR(drm->dev, "failed to get irq: %d\n", ret); | 906 | DRM_DEV_ERROR(drm->dev, "failed to get irq: %d\n", ret); |
| @@ -31,7 +31,6 @@ struct msm_gpu_state; · 30 unmodified lines | |||
| 31 | 31 | ||
| 32 | struct msm_gpu_config { | 32 | struct msm_gpu_config { |
| 33 | const char *ioname; | 33 | const char *ioname; |
| 34 | const char *irqname; | ||
| 35 | uint64_t va_start; | 34 | uint64_t va_start; |
| 36 | uint64_t va_end; | 35 | uint64_t va_end; |
| 37 | unsigned int nr_rings; | 36 | unsigned int nr_rings; |
| @@ -63,7 +62,7 @@ struct msm_gpu_funcs { · 25 unmodified lines | |||
| 63 | struct msm_ringbuffer *(*active_ring)(struct msm_gpu *gpu); | 62 | struct msm_ringbuffer *(*active_ring)(struct msm_gpu *gpu); |
| 64 | void (*recover)(struct msm_gpu *gpu); | 63 | void (*recover)(struct msm_gpu *gpu); |
| 65 | void (*destroy)(struct msm_gpu *gpu); | 64 | void (*destroy)(struct msm_gpu *gpu); |
| 66 | #ifdef CONFIG_DEBUG_FS | 65 | #if defined(CONFIG_DEBUG_FS) || defined(CONFIG_DEV_COREDUMP) |
| 67 | /* show GPU status in debugfs: */ | 66 | /* show GPU status in debugfs: */ |
| 68 | void (*show)(struct msm_gpu *gpu, struct msm_gpu_state *state, | 67 | void (*show)(struct msm_gpu *gpu, struct msm_gpu_state *state, |
| 69 | struct drm_printer *p); | 68 | struct drm_printer *p); |
| @@ -115,7 +115,9 @@ static void rd_write(struct msm_rd_state *rd, const void *buf, int sz) · 114 unmodified lines | |||
| 115 | char *fptr = &fifo->buf[fifo->head]; | 115 | char *fptr = &fifo->buf[fifo->head]; |
| 116 | int n; | 116 | int n; |
| 117 | 117 | ||
| 118 | wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0); | 118 | wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0 || !rd->open); |
| 119 | if (!rd->open) | ||
| 120 | return; | ||
| 119 | 121 | ||
| 120 | /* Note that smp_load_acquire() is not strictly required | 122 | /* Note that smp_load_acquire() is not strictly required |
| 121 | * as CIRC_SPACE_TO_END() does not access the tail more | 123 | * as CIRC_SPACE_TO_END() does not access the tail more |
| @@ -213,7 +215,10 @@ out: · 91 unmodified lines | |||
| 213 | static int rd_release(struct inode *inode, struct file *file) | 215 | static int rd_release(struct inode *inode, struct file *file) |
| 214 | { | 216 | { |
| 215 | struct msm_rd_state *rd = inode->i_private; | 217 | struct msm_rd_state *rd = inode->i_private; |
| 218 | |||
| 216 | rd->open = false; | 219 | rd->open = false; |
| 220 | wake_up_all(&rd->fifo_event); | ||
| 221 | |||
| 217 | return 0; | 222 | return 0; |
| 218 | } | 223 | } |
| 219 | 224 | ||
| @@ -253,6 +253,9 @@ nouveau_backlight_init(struct drm_connector *connector) · 252 unmodified lines | |||
| 253 | case NV_DEVICE_INFO_V0_FERMI: | 253 | case NV_DEVICE_INFO_V0_FERMI: |
| 254 | case NV_DEVICE_INFO_V0_KEPLER: | 254 | case NV_DEVICE_INFO_V0_KEPLER: |
| 255 | case NV_DEVICE_INFO_V0_MAXWELL: | 255 | case NV_DEVICE_INFO_V0_MAXWELL: |
| 256 | case NV_DEVICE_INFO_V0_PASCAL: | ||
| 257 | case NV_DEVICE_INFO_V0_VOLTA: | ||
| 258 | case NV_DEVICE_INFO_V0_TURING: | ||
| 256 | ret = nv50_backlight_init(nv_encoder, &props, &ops); | 259 | ret = nv50_backlight_init(nv_encoder, &props, &ops); |
| 257 | break; | 260 | break; |
| 258 | default: | 261 | default: |
| @@ -2434,6 +2434,38 @@ nv140_chipset = { · 2433 unmodified lines | |||
| 2434 | .sec2 = gp102_sec2_new, | 2434 | .sec2 = gp102_sec2_new, |
| 2435 | }; | 2435 | }; |
| 2436 | 2436 | ||
| 2437 | static const struct nvkm_device_chip | ||
| 2438 | nv162_chipset = { | ||
| 2439 | .name = "TU102", | ||
| 2440 | .bar = tu104_bar_new, | ||
| 2441 | .bios = nvkm_bios_new, | ||
| 2442 | .bus = gf100_bus_new, | ||
| 2443 | .devinit = tu104_devinit_new, | ||
| 2444 | .fault = tu104_fault_new, | ||
| 2445 | .fb = gv100_fb_new, | ||
| 2446 | .fuse = gm107_fuse_new, | ||
| 2447 | .gpio = gk104_gpio_new, | ||
| 2448 | .i2c = gm200_i2c_new, | ||
| 2449 | .ibus = gm200_ibus_new, | ||
| 2450 | .imem = nv50_instmem_new, | ||
| 2451 | .ltc = gp102_ltc_new, | ||
| 2452 | .mc = tu104_mc_new, | ||
| 2453 | .mmu = tu104_mmu_new, | ||
| 2454 | .pci = gp100_pci_new, | ||
| 2455 | .pmu = gp102_pmu_new, | ||
| 2456 | .therm = gp100_therm_new, | ||
| 2457 | .timer = gk20a_timer_new, | ||
| 2458 | .top = gk104_top_new, | ||
| 2459 | .ce[0] = tu104_ce_new, | ||
| 2460 | .ce[1] = tu104_ce_new, | ||
| 2461 | .ce[2] = tu104_ce_new, | ||
| 2462 | .ce[3] = tu104_ce_new, | ||
| 2463 | .ce[4] = tu104_ce_new, | ||
| 2464 | .disp = tu104_disp_new, | ||
| 2465 | .dma = gv100_dma_new, | ||
| 2466 | .fifo = tu104_fifo_new, | ||
| 2467 | }; | ||
| 2468 | |||
| 2437 | static const struct nvkm_device_chip | 2469 | static const struct nvkm_device_chip |
| 2438 | nv164_chipset = { | 2470 | nv164_chipset = { |
| 2439 | .name = "TU104", | 2471 | .name = "TU104", |
| @@ -2950,6 +2982,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, · 510 unmodified lines | |||
| 2950 | case 0x138: device->chip = &nv138_chipset; break; | 2982 | case 0x138: device->chip = &nv138_chipset; break; |
| 2951 | case 0x13b: device->chip = &nv13b_chipset; break; | 2983 | case 0x13b: device->chip = &nv13b_chipset; break; |
| 2952 | case 0x140: device->chip = &nv140_chipset; break; | 2984 | case 0x140: device->chip = &nv140_chipset; break; |
| 2985 | case 0x162: device->chip = &nv162_chipset; break; | ||
| 2953 | case 0x164: device->chip = &nv164_chipset; break; | 2986 | case 0x164: device->chip = &nv164_chipset; break; |
| 2954 | case 0x166: device->chip = &nv166_chipset; break; | 2987 | case 0x166: device->chip = &nv166_chipset; break; |
| 2955 | default: | 2988 | default: |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | |||
| 22 | #include <engine/falcon.h> | 22 | #include <engine/falcon.h> |
| 23 | 23 | ||
| 24 | #include <core/gpuobj.h> | 24 | #include <core/gpuobj.h> |
| 25 | #include <subdev/mc.h> | ||
| 25 | #include <subdev/timer.h> | 26 | #include <subdev/timer.h> |
| 26 | #include <engine/fifo.h> | 27 | #include <engine/fifo.h> |
| 27 | 28 | ||
| @@ -107,8 +108,10 @@ nvkm_falcon_fini(struct nvkm_engine *engine, bool suspend) · 79 unmodified lines | |||
| 107 | } | 108 | } |
| 108 | } | 109 | } |
| 109 | 110 | ||
| 110 | nvkm_mask(device, base + 0x048, 0x00000003, 0x00000000); | 111 | if (nvkm_mc_enabled(device, engine->subdev.index)) { |
| 111 | nvkm_wr32(device, base + 0x014, 0xffffffff); | 112 | nvkm_mask(device, base + 0x048, 0x00000003, 0x00000000); |
| 113 | nvkm_wr32(device, base + 0x014, 0xffffffff); | ||
| 114 | } | ||
| 112 | return 0; | 115 | return 0; |
| 113 | } | 116 | } |
| 114 | 117 | ||
| @@ -132,11 +132,12 @@ nvkm_therm_update(struct nvkm_therm *therm, int mode) · 131 unmodified lines | |||
| 132 | duty = nvkm_therm_update_linear(therm); | 132 | duty = nvkm_therm_update_linear(therm); |
| 133 | break; | 133 | break; |
| 134 | case NVBIOS_THERM_FAN_OTHER: | 134 | case NVBIOS_THERM_FAN_OTHER: |
| 135 | if (therm->cstate) | 135 | if (therm->cstate) { |
| 136 | duty = therm->cstate; | 136 | duty = therm->cstate; |
| 137 | else | 137 | poll = false; |
| 138 | } else { | ||
| 138 | duty = nvkm_therm_update_linear_fallback(therm); | 139 | duty = nvkm_therm_update_linear_fallback(therm); |
| 139 | poll = false; | 140 | } |
| 140 | break; | 141 | break; |
| 141 | } | 142 | } |
| 142 | immd = false; | 143 | immd = false; |
| @@ -1406,7 +1406,7 @@ static void dsi_pll_disable(struct dss_pll *pll) · 1405 unmodified lines | |||
| 1406 | 1406 | ||
| 1407 | static int dsi_dump_dsi_clocks(struct seq_file *s, void *p) | 1407 | static int dsi_dump_dsi_clocks(struct seq_file *s, void *p) |
| 1408 | { | 1408 | { |
| 1409 | struct dsi_data *dsi = p; | 1409 | struct dsi_data *dsi = s->private; |
| 1410 | struct dss_pll_clock_info *cinfo = &dsi->pll.cinfo; | 1410 | struct dss_pll_clock_info *cinfo = &dsi->pll.cinfo; |
| 1411 | enum dss_clk_source dispc_clk_src, dsi_clk_src; | 1411 | enum dss_clk_source dispc_clk_src, dsi_clk_src; |
| 1412 | int dsi_module = dsi->module_id; | 1412 | int dsi_module = dsi->module_id; |
| @@ -1467,7 +1467,7 @@ static int dsi_dump_dsi_clocks(struct seq_file *s, void *p) · 54 unmodified lines | |||
| 1467 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | 1467 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS |
| 1468 | static int dsi_dump_dsi_irqs(struct seq_file *s, void *p) | 1468 | static int dsi_dump_dsi_irqs(struct seq_file *s, void *p) |
| 1469 | { | 1469 | { |
| 1470 | struct dsi_data *dsi = p; | 1470 | struct dsi_data *dsi = s->private; |
| 1471 | unsigned long flags; | 1471 | unsigned long flags; |
| 1472 | struct dsi_irq_stats stats; | 1472 | struct dsi_irq_stats stats; |
| 1473 | 1473 | ||
| @@ -1558,7 +1558,7 @@ static int dsi_dump_dsi_irqs(struct seq_file *s, void *p) · 84 unmodified lines | |||
| 1558 | 1558 | ||
| 1559 | static int dsi_dump_dsi_regs(struct seq_file *s, void *p) | 1559 | static int dsi_dump_dsi_regs(struct seq_file *s, void *p) |
| 1560 | { | 1560 | { |
| 1561 | struct dsi_data *dsi = p; | 1561 | struct dsi_data *dsi = s->private; |
| 1562 | 1562 | ||
| 1563 | if (dsi_runtime_get(dsi)) | 1563 | if (dsi_runtime_get(dsi)) |
| 1564 | return 0; | 1564 | return 0; |
| @@ -4751,6 +4751,17 @@ static int dsi_set_config(struct omap_dss_device *dssdev, · 3186 unmodified lines | |||
| 4751 | dsi->vm.flags |= DISPLAY_FLAGS_HSYNC_HIGH; | 4751 | dsi->vm.flags |= DISPLAY_FLAGS_HSYNC_HIGH; |
| 4752 | dsi->vm.flags &= ~DISPLAY_FLAGS_VSYNC_LOW; | 4752 | dsi->vm.flags &= ~DISPLAY_FLAGS_VSYNC_LOW; |
| 4753 | dsi->vm.flags |= DISPLAY_FLAGS_VSYNC_HIGH; | 4753 | dsi->vm.flags |= DISPLAY_FLAGS_VSYNC_HIGH; |
| 4754 | /* | ||
| 4755 | * HACK: These flags should be handled through the omap_dss_device bus | ||
| 4756 | * flags, but this will only be possible when the DSI encoder will be | ||
| 4757 | * converted to the omapdrm-managed encoder model. | ||
| 4758 | */ | ||
| 4759 | dsi->vm.flags &= ~DISPLAY_FLAGS_PIXDATA_NEGEDGE; | ||
| 4760 | dsi->vm.flags |= DISPLAY_FLAGS_PIXDATA_POSEDGE; | ||
| 4761 | dsi->vm.flags &= ~DISPLAY_FLAGS_DE_LOW; | ||
| 4762 | dsi->vm.flags |= DISPLAY_FLAGS_DE_HIGH; | ||
| 4763 | dsi->vm.flags &= ~DISPLAY_FLAGS_SYNC_POSEDGE; | ||
| 4764 | dsi->vm.flags |= DISPLAY_FLAGS_SYNC_NEGEDGE; | ||
| 4754 | 4765 | ||
| 4755 | dss_mgr_set_timings(&dsi->output, &dsi->vm); | 4766 | dss_mgr_set_timings(&dsi->output, &dsi->vm); |
| 4756 | 4767 | ||
| @@ -5083,15 +5094,15 @@ static int dsi_bind(struct device *dev, struct device *master, void *data) · 326 unmodified lines | |||
| 5083 | 5094 | ||
| 5084 | snprintf(name, sizeof(name), "dsi%u_regs", dsi->module_id + 1); | 5095 | snprintf(name, sizeof(name), "dsi%u_regs", dsi->module_id + 1); |
| 5085 | dsi->debugfs.regs = dss_debugfs_create_file(dss, name, | 5096 | dsi->debugfs.regs = dss_debugfs_create_file(dss, name, |
| 5086 | dsi_dump_dsi_regs, &dsi); | 5097 | dsi_dump_dsi_regs, dsi); |
| 5087 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | 5098 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS |
| 5088 | snprintf(name, sizeof(name), "dsi%u_irqs", dsi->module_id + 1); | 5099 | snprintf(name, sizeof(name), "dsi%u_irqs", dsi->module_id + 1); |
| 5089 | dsi->debugfs.irqs = dss_debugfs_create_file(dss, name, | 5100 | dsi->debugfs.irqs = dss_debugfs_create_file(dss, name, |
| 5090 | dsi_dump_dsi_irqs, &dsi); | 5101 | dsi_dump_dsi_irqs, dsi); |
| 5091 | #endif | 5102 | #endif |
| 5092 | snprintf(name, sizeof(name), "dsi%u_clks", dsi->module_id + 1); | 5103 | snprintf(name, sizeof(name), "dsi%u_clks", dsi->module_id + 1); |
| 5093 | dsi->debugfs.clks = dss_debugfs_create_file(dss, name, | 5104 | dsi->debugfs.clks = dss_debugfs_create_file(dss, name, |
| 5094 | dsi_dump_dsi_clocks, &dsi); | 5105 | dsi_dump_dsi_clocks, dsi); |
| 5095 | 5106 | ||
| 5096 | return 0; | 5107 | return 0; |
| 5097 | } | 5108 | } |
| @@ -5104,8 +5115,6 @@ static void dsi_unbind(struct device *dev, struct device *master, void *data) · 6 unmodified lines | |||
| 5104 | dss_debugfs_remove_file(dsi->debugfs.irqs); | 5115 | dss_debugfs_remove_file(dsi->debugfs.irqs); |
| 5105 | dss_debugfs_remove_file(dsi->debugfs.regs); | 5116 | dss_debugfs_remove_file(dsi->debugfs.regs); |
| 5106 | 5117 | ||
| 5107 | of_platform_depopulate(dev); | ||
| 5108 | |||
| 5109 | WARN_ON(dsi->scp_clk_refcount > 0); | 5118 | WARN_ON(dsi->scp_clk_refcount > 0); |
| 5110 | 5119 | ||
| 5111 | dss_pll_unregister(&dsi->pll); | 5120 | dss_pll_unregister(&dsi->pll); |
| @@ -5457,6 +5466,8 @@ static int dsi_remove(struct platform_device *pdev) · 345 unmodified lines | |||
| 5457 | 5466 | ||
| 5458 | dsi_uninit_output(dsi); | 5467 | dsi_uninit_output(dsi); |
| 5459 | 5468 | ||
| 5469 | of_platform_depopulate(&pdev->dev); | ||
| 5470 | |||
| 5460 | pm_runtime_disable(&pdev->dev); | 5471 | pm_runtime_disable(&pdev->dev); |
| 5461 | 5472 | ||
| 5462 | if (dsi->vdds_dsi_reg != NULL && dsi->vdds_dsi_enabled) { | 5473 | if (dsi->vdds_dsi_reg != NULL && dsi->vdds_dsi_enabled) { |
| @@ -250,14 +250,10 @@ static struct drm_driver qxl_driver = { · 249 unmodified lines | |||
| 250 | #if defined(CONFIG_DEBUG_FS) | 250 | #if defined(CONFIG_DEBUG_FS) |
| 251 | .debugfs_init = qxl_debugfs_init, | 251 | .debugfs_init = qxl_debugfs_init, |
| 252 | #endif | 252 | #endif |
| 253 | .prime_handle_to_fd = drm_gem_prime_handle_to_fd, | ||
| 254 | .prime_fd_to_handle = drm_gem_prime_fd_to_handle, | ||
| 255 | .gem_prime_export = drm_gem_prime_export, | 253 | .gem_prime_export = drm_gem_prime_export, |
| 256 | .gem_prime_import = drm_gem_prime_import, | 254 | .gem_prime_import = drm_gem_prime_import, |
| 257 | .gem_prime_pin = qxl_gem_prime_pin, | 255 | .gem_prime_pin = qxl_gem_prime_pin, |
| 258 | .gem_prime_unpin = qxl_gem_prime_unpin, | 256 | .gem_prime_unpin = qxl_gem_prime_unpin, |
| 259 | .gem_prime_get_sg_table = qxl_gem_prime_get_sg_table, | ||
| 260 | .gem_prime_import_sg_table = qxl_gem_prime_import_sg_table, | ||
| 261 | .gem_prime_vmap = qxl_gem_prime_vmap, | 257 | .gem_prime_vmap = qxl_gem_prime_vmap, |
| 262 | .gem_prime_vunmap = qxl_gem_prime_vunmap, | 258 | .gem_prime_vunmap = qxl_gem_prime_vunmap, |
| 263 | .gem_prime_mmap = qxl_gem_prime_mmap, | 259 | .gem_prime_mmap = qxl_gem_prime_mmap, |
| @@ -38,20 +38,6 @@ void qxl_gem_prime_unpin(struct drm_gem_object *obj) · 37 unmodified lines | |||
| 38 | WARN_ONCE(1, "not implemented"); | 38 | WARN_ONCE(1, "not implemented"); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | struct sg_table *qxl_gem_prime_get_sg_table(struct drm_gem_object *obj) | ||
| 42 | { | ||
| 43 | WARN_ONCE(1, "not implemented"); | ||
| 44 | return ERR_PTR(-ENOSYS); | ||
| 45 | } | ||
| 46 | |||
| 47 | struct drm_gem_object *qxl_gem_prime_import_sg_table( | ||
| 48 | struct drm_device *dev, struct dma_buf_attachment *attach, | ||
| 49 | struct sg_table *table) | ||
| 50 | { | ||
| 51 | WARN_ONCE(1, "not implemented"); | ||
| 52 | return ERR_PTR(-ENOSYS); | ||
| 53 | } | ||
| 54 | |||
| 55 | void *qxl_gem_prime_vmap(struct drm_gem_object *obj) | 41 | void *qxl_gem_prime_vmap(struct drm_gem_object *obj) |
| 56 | { | 42 | { |
| 57 | WARN_ONCE(1, "not implemented"); | 43 | WARN_ONCE(1, "not implemented"); |
| @@ -5676,7 +5676,7 @@ int ci_dpm_init(struct radeon_device *rdev) · 5675 unmodified lines | |||
| 5676 | u16 data_offset, size; | 5676 | u16 data_offset, size; |
| 5677 | u8 frev, crev; | 5677 | u8 frev, crev; |
| 5678 | struct ci_power_info *pi; | 5678 | struct ci_power_info *pi; |
| 5679 | enum pci_bus_speed speed_cap; | 5679 | enum pci_bus_speed speed_cap = PCI_SPEED_UNKNOWN; |
| 5680 | struct pci_dev *root = rdev->pdev->bus->self; | 5680 | struct pci_dev *root = rdev->pdev->bus->self; |
| 5681 | int ret; | 5681 | int ret; |
| 5682 | 5682 | ||
| @@ -5685,7 +5685,8 @@ int ci_dpm_init(struct radeon_device *rdev) · 2 unmodified lines | |||
| 5685 | return -ENOMEM; | 5685 | return -ENOMEM; |
| 5686 | rdev->pm.dpm.priv = pi; | 5686 | rdev->pm.dpm.priv = pi; |
| 5687 | 5687 | ||
| 5688 | speed_cap = pcie_get_speed_cap(root); | 5688 | if (!pci_is_root_bus(rdev->pdev->bus)) |
| 5689 | speed_cap = pcie_get_speed_cap(root); | ||
| 5689 | if (speed_cap == PCI_SPEED_UNKNOWN) { | 5690 | if (speed_cap == PCI_SPEED_UNKNOWN) { |
| 5690 | pi->sys_pcie_mask = 0; | 5691 | pi->sys_pcie_mask = 0; |
| 5691 | } else { | 5692 | } else { |
| @@ -6899,7 +6899,7 @@ int si_dpm_init(struct radeon_device *rdev) · 6898 unmodified lines | |||
| 6899 | struct ni_power_info *ni_pi; | 6899 | struct ni_power_info *ni_pi; |
| 6900 | struct si_power_info *si_pi; | 6900 | struct si_power_info *si_pi; |
| 6901 | struct atom_clock_dividers dividers; | 6901 | struct atom_clock_dividers dividers; |
| 6902 | enum pci_bus_speed speed_cap; | 6902 | enum pci_bus_speed speed_cap = PCI_SPEED_UNKNOWN; |
| 6903 | struct pci_dev *root = rdev->pdev->bus->self; | 6903 | struct pci_dev *root = rdev->pdev->bus->self; |
| 6904 | int ret; | 6904 | int ret; |
| 6905 | 6905 | ||
| @@ -6911,7 +6911,8 @@ int si_dpm_init(struct radeon_device *rdev) · 5 unmodified lines | |||
| 6911 | eg_pi = &ni_pi->eg; | 6911 | eg_pi = &ni_pi->eg; |
| 6912 | pi = &eg_pi->rv7xx; | 6912 | pi = &eg_pi->rv7xx; |
| 6913 | 6913 | ||
| 6914 | speed_cap = pcie_get_speed_cap(root); | 6914 | if (!pci_is_root_bus(rdev->pdev->bus)) |
| 6915 | speed_cap = pcie_get_speed_cap(root); | ||
| 6915 | if (speed_cap == PCI_SPEED_UNKNOWN) { | 6916 | if (speed_cap == PCI_SPEED_UNKNOWN) { |
| 6916 | si_pi->sys_pcie_mask = 0; | 6917 | si_pi->sys_pcie_mask = 0; |
| 6917 | } else { | 6918 | } else { |
| @@ -1,17 +1,8 @@ | |||
| 1 | //SPDX-License-Identifier: GPL-2.0+ | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* | 2 | /* |
| 3 | * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd | 3 | * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd |
| 4 | * Author: | 4 | * Author: |
| 5 | * Sandy Huang <hjc@rock-chips.com> | 5 | * Sandy Huang <hjc@rock-chips.com> |
| 6 | * | ||
| 7 | * This software is licensed under the terms of the GNU General Public | ||
| 8 | * License version 2, as published by the Free Software Foundation, and | ||
| 9 | * may be copied, distributed, and modified under those terms. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | */ | 6 | */ |
| 16 | 7 | ||
| 17 | #include <drm/drmP.h> | 8 | #include <drm/drmP.h> |
| @@ -113,8 +104,10 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev, · 95 unmodified lines | |||
| 113 | child_count++; | 104 | child_count++; |
| 114 | ret = drm_of_find_panel_or_bridge(dev->of_node, 0, endpoint_id, | 105 | ret = drm_of_find_panel_or_bridge(dev->of_node, 0, endpoint_id, |
| 115 | &panel, &bridge); | 106 | &panel, &bridge); |
| 116 | if (!ret) | 107 | if (!ret) { |
| 108 | of_node_put(endpoint); | ||
| 117 | break; | 109 | break; |
| 110 | } | ||
| 118 | } | 111 | } |
| 119 | 112 | ||
| 120 | of_node_put(port); | 113 | of_node_put(port); |
| @@ -1,17 +1,8 @@ | |||
| 1 | //SPDX-License-Identifier: GPL-2.0+ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd | 3 | * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd |
| 4 | * Author: | 4 | * Author: |
| 5 | * Sandy Huang <hjc@rock-chips.com> | 5 | * Sandy Huang <hjc@rock-chips.com> |
| 6 | * | ||
| 7 | * This software is licensed under the terms of the GNU General Public | ||
| 8 | * License version 2, as published by the Free Software Foundation, and | ||
| 9 | * may be copied, distributed, and modified under those terms. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | */ | 6 | */ |
| 16 | 7 | ||
| 17 | #ifdef CONFIG_ROCKCHIP_RGB | 8 | #ifdef CONFIG_ROCKCHIP_RGB |
| @@ -786,17 +786,18 @@ static struct sun4i_frontend *sun4i_backend_find_frontend(struct sun4i_drv *drv, · 785 unmodified lines | |||
| 786 | remote = of_graph_get_remote_port_parent(ep); | 786 | remote = of_graph_get_remote_port_parent(ep); |
| 787 | if (!remote) | 787 | if (!remote) |
| 788 | continue; | 788 | continue; |
| 789 | of_node_put(remote); | ||
| 789 | 790 | ||
| 790 | /* does this node match any registered engines? */ | 791 | /* does this node match any registered engines? */ |
| 791 | list_for_each_entry(frontend, &drv->frontend_list, list) { | 792 | list_for_each_entry(frontend, &drv->frontend_list, list) { |
| 792 | if (remote == frontend->node) { | 793 | if (remote == frontend->node) { |
| 793 | of_node_put(remote); | ||
| 794 | of_node_put(port); | 794 | of_node_put(port); |
| 795 | of_node_put(ep); | ||
| 795 | return frontend; | 796 | return frontend; |
| 796 | } | 797 | } |
| 797 | } | 798 | } |
| 798 | } | 799 | } |
| 799 | 800 | of_node_put(port); | |
| 800 | return ERR_PTR(-EINVAL); | 801 | return ERR_PTR(-EINVAL); |
| 801 | } | 802 | } |
| 802 | 803 | ||
| @@ -92,6 +92,8 @@ static void sun4i_hdmi_disable(struct drm_encoder *encoder) · 91 unmodified lines | |||
| 92 | val = readl(hdmi->base + SUN4I_HDMI_VID_CTRL_REG); | 92 | val = readl(hdmi->base + SUN4I_HDMI_VID_CTRL_REG); |
| 93 | val &= ~SUN4I_HDMI_VID_CTRL_ENABLE; | 93 | val &= ~SUN4I_HDMI_VID_CTRL_ENABLE; |
| 94 | writel(val, hdmi->base + SUN4I_HDMI_VID_CTRL_REG); | 94 | writel(val, hdmi->base + SUN4I_HDMI_VID_CTRL_REG); |
| 95 | |||
| 96 | clk_disable_unprepare(hdmi->tmds_clk); | ||
| 95 | } | 97 | } |
| 96 | 98 | ||
| 97 | static void sun4i_hdmi_enable(struct drm_encoder *encoder) | 99 | static void sun4i_hdmi_enable(struct drm_encoder *encoder) |
| @@ -102,6 +104,8 @@ static void sun4i_hdmi_enable(struct drm_encoder *encoder) · 4 unmodified lines | |||
| 102 | 104 | ||
| 103 | DRM_DEBUG_DRIVER("Enabling the HDMI Output\n"); | 105 | DRM_DEBUG_DRIVER("Enabling the HDMI Output\n"); |
| 104 | 106 | ||
| 107 | clk_prepare_enable(hdmi->tmds_clk); | ||
| 108 | |||
| 105 | sun4i_hdmi_setup_avi_infoframes(hdmi, mode); | 109 | sun4i_hdmi_setup_avi_infoframes(hdmi, mode); |
| 106 | val |= SUN4I_HDMI_PKT_CTRL_TYPE(0, SUN4I_HDMI_PKT_AVI); | 110 | val |= SUN4I_HDMI_PKT_CTRL_TYPE(0, SUN4I_HDMI_PKT_AVI); |
| 107 | val |= SUN4I_HDMI_PKT_CTRL_TYPE(1, SUN4I_HDMI_PKT_END); | 111 | val |= SUN4I_HDMI_PKT_CTRL_TYPE(1, SUN4I_HDMI_PKT_END); |
| @@ -761,6 +761,7 @@ static int sun4i_tcon_init_clocks(struct device *dev, · 760 unmodified lines | |||
| 761 | return PTR_ERR(tcon->sclk0); | 761 | return PTR_ERR(tcon->sclk0); |
| 762 | } | 762 | } |
| 763 | } | 763 | } |
| 764 | clk_prepare_enable(tcon->sclk0); | ||
| 764 | 765 | ||
| 765 | if (tcon->quirks->has_channel_1) { | 766 | if (tcon->quirks->has_channel_1) { |
| 766 | tcon->sclk1 = devm_clk_get(dev, "tcon-ch1"); | 767 | tcon->sclk1 = devm_clk_get(dev, "tcon-ch1"); |
| @@ -775,6 +776,7 @@ static int sun4i_tcon_init_clocks(struct device *dev, · 8 unmodified lines | |||
| 775 | 776 | ||
| 776 | static void sun4i_tcon_free_clocks(struct sun4i_tcon *tcon) | 777 | static void sun4i_tcon_free_clocks(struct sun4i_tcon *tcon) |
| 777 | { | 778 | { |
| 779 | clk_disable_unprepare(tcon->sclk0); | ||
| 778 | clk_disable_unprepare(tcon->clk); | 780 | clk_disable_unprepare(tcon->clk); |
| 779 | } | 781 | } |
| 780 | 782 | ||
| @@ -127,14 +127,10 @@ static struct drm_driver driver = { · 126 unmodified lines | |||
| 127 | #if defined(CONFIG_DEBUG_FS) | 127 | #if defined(CONFIG_DEBUG_FS) |
| 128 | .debugfs_init = virtio_gpu_debugfs_init, | 128 | .debugfs_init = virtio_gpu_debugfs_init, |
| 129 | #endif | 129 | #endif |
| 130 | .prime_handle_to_fd = drm_gem_prime_handle_to_fd, | ||
| 131 | .prime_fd_to_handle = drm_gem_prime_fd_to_handle, | ||
| 132 | .gem_prime_export = drm_gem_prime_export, | 130 | .gem_prime_export = drm_gem_prime_export, |
| 133 | .gem_prime_import = drm_gem_prime_import, | 131 | .gem_prime_import = drm_gem_prime_import, |
| 134 | .gem_prime_pin = virtgpu_gem_prime_pin, | 132 | .gem_prime_pin = virtgpu_gem_prime_pin, |
| 135 | .gem_prime_unpin = virtgpu_gem_prime_unpin, | 133 | .gem_prime_unpin = virtgpu_gem_prime_unpin, |
| 136 | .gem_prime_get_sg_table = virtgpu_gem_prime_get_sg_table, | ||
| 137 | .gem_prime_import_sg_table = virtgpu_gem_prime_import_sg_table, | ||
| 138 | .gem_prime_vmap = virtgpu_gem_prime_vmap, | 134 | .gem_prime_vmap = virtgpu_gem_prime_vmap, |
| 139 | .gem_prime_vunmap = virtgpu_gem_prime_vunmap, | 135 | .gem_prime_vunmap = virtgpu_gem_prime_vunmap, |
| 140 | .gem_prime_mmap = virtgpu_gem_prime_mmap, | 136 | .gem_prime_mmap = virtgpu_gem_prime_mmap, |
| @@ -372,10 +372,6 @@ int virtio_gpu_object_wait(struct virtio_gpu_object *bo, bool no_wait); · 371 unmodified lines | |||
| 372 | /* virtgpu_prime.c */ | 372 | /* virtgpu_prime.c */ |
| 373 | int virtgpu_gem_prime_pin(struct drm_gem_object *obj); | 373 | int virtgpu_gem_prime_pin(struct drm_gem_object *obj); |
| 374 | void virtgpu_gem_prime_unpin(struct drm_gem_object *obj); | 374 | void virtgpu_gem_prime_unpin(struct drm_gem_object *obj); |
| 375 | struct sg_table *virtgpu_gem_prime_get_sg_table(struct drm_gem_object *obj); | ||
| 376 | struct drm_gem_object *virtgpu_gem_prime_import_sg_table( | ||
| 377 | struct drm_device *dev, struct dma_buf_attachment *attach, | ||
| 378 | struct sg_table *sgt); | ||
| 379 | void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj); | 375 | void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj); |
| 380 | void virtgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); | 376 | void virtgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); |
| 381 | int virtgpu_gem_prime_mmap(struct drm_gem_object *obj, | 377 | int virtgpu_gem_prime_mmap(struct drm_gem_object *obj, |
| @@ -39,20 +39,6 @@ void virtgpu_gem_prime_unpin(struct drm_gem_object *obj) · 38 unmodified lines | |||
| 39 | WARN_ONCE(1, "not implemented"); | 39 | WARN_ONCE(1, "not implemented"); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | struct sg_table *virtgpu_gem_prime_get_sg_table(struct drm_gem_object *obj) | ||
| 43 | { | ||
| 44 | WARN_ONCE(1, "not implemented"); | ||
| 45 | return ERR_PTR(-ENODEV); | ||
| 46 | } | ||
| 47 | |||
| 48 | struct drm_gem_object *virtgpu_gem_prime_import_sg_table( | ||
| 49 | struct drm_device *dev, struct dma_buf_attachment *attach, | ||
| 50 | struct sg_table *table) | ||
| 51 | { | ||
| 52 | WARN_ONCE(1, "not implemented"); | ||
| 53 | return ERR_PTR(-ENODEV); | ||
| 54 | } | ||
| 55 | |||
| 56 | void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj) | 42 | void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj) |
| 57 | { | 43 | { |
| 58 | struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(obj); | 44 | struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(obj); |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | |||
| 26 | **************************************************************************/ | 26 | **************************************************************************/ |
| 27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
| 28 | #include <linux/console.h> | 28 | #include <linux/console.h> |
| 29 | #include <linux/dma-mapping.h> | ||
| 29 | 30 | ||
| 30 | #include <drm/drmP.h> | 31 | #include <drm/drmP.h> |
| 31 | #include "vmwgfx_drv.h" | 32 | #include "vmwgfx_drv.h" |
| @@ -34,7 +35,6 @@ · 2 unmodified lines | |||
| 34 | #include <drm/ttm/ttm_placement.h> | 35 | #include <drm/ttm/ttm_placement.h> |
| 35 | #include <drm/ttm/ttm_bo_driver.h> | 36 | #include <drm/ttm/ttm_bo_driver.h> |
| 36 | #include <drm/ttm/ttm_module.h> | 37 | #include <drm/ttm/ttm_module.h> |
| 37 | #include <linux/intel-iommu.h> | ||
| 38 | 38 | ||
| 39 | #define VMWGFX_DRIVER_DESC "Linux drm driver for VMware graphics devices" | 39 | #define VMWGFX_DRIVER_DESC "Linux drm driver for VMware graphics devices" |
| 40 | #define VMWGFX_CHIP_SVGAII 0 | 40 | #define VMWGFX_CHIP_SVGAII 0 |
| @@ -545,6 +545,21 @@ static void vmw_get_initial_size(struct vmw_private *dev_priv) · 504 unmodified lines | |||
| 545 | dev_priv->initial_height = height; | 545 | dev_priv->initial_height = height; |
| 546 | } | 546 | } |
| 547 | 547 | ||
| 548 | /** | ||
| 549 | * vmw_assume_iommu - Figure out whether coherent dma-remapping might be | ||
| 550 | * taking place. | ||
| 551 | * @dev: Pointer to the struct drm_device. | ||
| 552 | * | ||
| 553 | * Return: true if iommu present, false otherwise. | ||
| 554 | */ | ||
| 555 | static bool vmw_assume_iommu(struct drm_device *dev) | ||
| 556 | { | ||
| 557 | const struct dma_map_ops *ops = get_dma_ops(dev->dev); | ||
| 558 | |||
| 559 | return !dma_is_direct(ops) && ops && | ||
| 560 | ops->map_page != dma_direct_map_page; | ||
| 561 | } | ||
| 562 | |||
| 548 | /** | 563 | /** |
| 549 | * vmw_dma_select_mode - Determine how DMA mappings should be set up for this | 564 | * vmw_dma_select_mode - Determine how DMA mappings should be set up for this |
| 550 | * system. | 565 | * system. |
| @@ -565,55 +580,27 @@ static int vmw_dma_select_mode(struct vmw_private *dev_priv) · 14 unmodified lines | |||
| 565 | [vmw_dma_alloc_coherent] = "Using coherent TTM pages.", | 580 | [vmw_dma_alloc_coherent] = "Using coherent TTM pages.", |
| 566 | [vmw_dma_map_populate] = "Keeping DMA mappings.", | 581 | [vmw_dma_map_populate] = "Keeping DMA mappings.", |
| 567 | [vmw_dma_map_bind] = "Giving up DMA mappings early."}; | 582 | [vmw_dma_map_bind] = "Giving up DMA mappings early."}; |
| 568 | #ifdef CONFIG_X86 | ||
| 569 | const struct dma_map_ops *dma_ops = get_dma_ops(dev_priv->dev->dev); | ||
| 570 | 583 | ||
| 571 | #ifdef CONFIG_INTEL_IOMMU | 584 | if (vmw_force_coherent) |
| 572 | if (intel_iommu_enabled) { | 585 | dev_priv->map_mode = vmw_dma_alloc_coherent; |
| 586 | else if (vmw_assume_iommu(dev_priv->dev)) | ||
| 573 | dev_priv->map_mode = vmw_dma_map_populate; | 587 | dev_priv->map_mode = vmw_dma_map_populate; |
| 574 | goto out_fixup; | 588 | else if (!vmw_force_iommu) |
| 575 | } | ||
| 576 | #endif | ||
| 577 | |||
| 578 | if (!(vmw_force_iommu || vmw_force_coherent)) { | ||
| 579 | dev_priv->map_mode = vmw_dma_phys; | 589 | dev_priv->map_mode = vmw_dma_phys; |
| 580 | DRM_INFO("DMA map mode: %s\n", names[dev_priv->map_mode]); | 590 | else if (IS_ENABLED(CONFIG_SWIOTLB) && swiotlb_nr_tbl()) |
| 581 | return 0; | ||
| 582 | } | ||
| 583 | |||
| 584 | dev_priv->map_mode = vmw_dma_map_populate; | ||
| 585 | |||
| 586 | if (dma_ops && dma_ops->sync_single_for_cpu) | ||
| 587 | dev_priv->map_mode = vmw_dma_alloc_coherent; | 591 | dev_priv->map_mode = vmw_dma_alloc_coherent; |
| 588 | #ifdef CONFIG_SWIOTLB | 592 | else |
| 589 | if (swiotlb_nr_tbl() == 0) | ||
| 590 | dev_priv->map_mode = vmw_dma_map_populate; | 593 | dev_priv->map_mode = vmw_dma_map_populate; |
| 591 | #endif | ||
| 592 | 594 | ||
| 593 | #ifdef CONFIG_INTEL_IOMMU | 595 | if (dev_priv->map_mode == vmw_dma_map_populate && vmw_restrict_iommu) |
| 594 | out_fixup: | ||
| 595 | #endif | ||
| 596 | if (dev_priv->map_mode == vmw_dma_map_populate && | ||
| 597 | vmw_restrict_iommu) | ||
| 598 | dev_priv->map_mode = vmw_dma_map_bind; | 596 | dev_priv->map_mode = vmw_dma_map_bind; |
| 599 | 597 | ||
| 600 | if (vmw_force_coherent) | 598 | /* No TTM coherent page pool? FIXME: Ask TTM instead! */ |
| 601 | dev_priv->map_mode = vmw_dma_alloc_coherent; | 599 | if (!(IS_ENABLED(CONFIG_SWIOTLB) || IS_ENABLED(CONFIG_INTEL_IOMMU)) && |
| 602 | 600 | (dev_priv->map_mode == vmw_dma_alloc_coherent)) | |
| 603 | #if !defined(CONFIG_SWIOTLB) && !defined(CONFIG_INTEL_IOMMU) | ||
| 604 | /* | ||
| 605 | * No coherent page pool | ||
| 606 | */ | ||
| 607 | if (dev_priv->map_mode == vmw_dma_alloc_coherent) | ||
| 608 | return -EINVAL; | 601 | return -EINVAL; |
| 609 | #endif | ||
| 610 | |||
| 611 | #else /* CONFIG_X86 */ | ||
| 612 | dev_priv->map_mode = vmw_dma_map_populate; | ||
| 613 | #endif /* CONFIG_X86 */ | ||
| 614 | 602 | ||
| 615 | DRM_INFO("DMA map mode: %s\n", names[dev_priv->map_mode]); | 603 | DRM_INFO("DMA map mode: %s\n", names[dev_priv->map_mode]); |
| 616 | |||
| 617 | return 0; | 604 | return 0; |
| 618 | } | 605 | } |
| 619 | 606 | ||
| @@ -625,24 +612,20 @@ out_fixup: · 5 unmodified lines | |||
| 625 | * With 32-bit we can only handle 32 bit PFNs. Optionally set that | 612 | * With 32-bit we can only handle 32 bit PFNs. Optionally set that |
| 626 | * restriction also for 64-bit systems. | 613 | * restriction also for 64-bit systems. |
| 627 | */ | 614 | */ |
| 628 | #ifdef CONFIG_INTEL_IOMMU | ||
| 629 | static int vmw_dma_masks(struct vmw_private *dev_priv) | 615 | static int vmw_dma_masks(struct vmw_private *dev_priv) |
| 630 | { | 616 | { |
| 631 | struct drm_device *dev = dev_priv->dev; | 617 | struct drm_device *dev = dev_priv->dev; |
| 618 | int ret = 0; | ||
| 632 | 619 | ||
| 633 | if (intel_iommu_enabled && | 620 | ret = dma_set_mask_and_coherent(dev->dev, DMA_BIT_MASK(64)); |
| 621 | if (dev_priv->map_mode != vmw_dma_phys && | ||
| 634 | (sizeof(unsigned long) == 4 || vmw_restrict_dma_mask)) { | 622 | (sizeof(unsigned long) == 4 || vmw_restrict_dma_mask)) { |
| 635 | DRM_INFO("Restricting DMA addresses to 44 bits.\n"); | 623 | DRM_INFO("Restricting DMA addresses to 44 bits.\n"); |
| 636 | return dma_set_mask(dev->dev, DMA_BIT_MASK(44)); | 624 | return dma_set_mask_and_coherent(dev->dev, DMA_BIT_MASK(44)); |
| 637 | } | 625 | } |
| 638 | return 0; | 626 | |
| 639 | } | 627 | return ret; |
| 640 | #else | ||
| 641 | static int vmw_dma_masks(struct vmw_private *dev_priv) | ||
| 642 | { | ||
| 643 | return 0; | ||
| 644 | } | 628 | } |
| 645 | #endif | ||
| 646 | 629 | ||
| 647 | static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | 630 | static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) |
| 648 | { | 631 | { |
| @@ -3570,7 +3570,7 @@ int vmw_execbuf_fence_commands(struct drm_file *file_priv, · 3569 unmodified lines | |||
| 3570 | *p_fence = NULL; | 3570 | *p_fence = NULL; |
| 3571 | } | 3571 | } |
| 3572 | 3572 | ||
| 3573 | return 0; | 3573 | return ret; |
| 3574 | } | 3574 | } |
| 3575 | 3575 | ||
| 3576 | /** | 3576 | /** |
| @@ -1646,7 +1646,7 @@ static int vmw_kms_check_topology(struct drm_device *dev, · 1645 unmodified lines | |||
| 1646 | struct drm_connector_state *conn_state; | 1646 | struct drm_connector_state *conn_state; |
| 1647 | struct vmw_connector_state *vmw_conn_state; | 1647 | struct vmw_connector_state *vmw_conn_state; |
| 1648 | 1648 | ||
| 1649 | if (!du->pref_active) { | 1649 | if (!du->pref_active && new_crtc_state->enable) { |
| 1650 | ret = -EINVAL; | 1650 | ret = -EINVAL; |
| 1651 | goto clean; | 1651 | goto clean; |
| 1652 | } | 1652 | } |
| @@ -2554,8 +2554,8 @@ void vmw_kms_helper_validation_finish(struct vmw_private *dev_priv, · 901 unmodified lines | |||
| 2554 | user_fence_rep) | 2554 | user_fence_rep) |
| 2555 | { | 2555 | { |
| 2556 | struct vmw_fence_obj *fence = NULL; | 2556 | struct vmw_fence_obj *fence = NULL; |
| 2557 | uint32_t handle; | 2557 | uint32_t handle = 0; |
| 2558 | int ret; | 2558 | int ret = 0; |
| 2559 | 2559 | ||
| 2560 | if (file_priv || user_fence_rep || vmw_validation_has_bos(ctx) || | 2560 | if (file_priv || user_fence_rep || vmw_validation_has_bos(ctx) || |
| 2561 | out_fence) | 2561 | out_fence) |
| @@ -21,6 +21,7 @@ config VGA_SWITCHEROO · 20 unmodified lines | |||
| 21 | bool "Laptop Hybrid Graphics - GPU switching support" | 21 | bool "Laptop Hybrid Graphics - GPU switching support" |
| 22 | depends on X86 | 22 | depends on X86 |
| 23 | depends on ACPI | 23 | depends on ACPI |
| 24 | depends on PCI | ||
| 24 | select VGA_ARB | 25 | select VGA_ARB |
| 25 | help | 26 | help |
| 26 | Many laptops released in 2008/9/10 have two GPUs with a multiplexer | 27 | Many laptops released in 2008/9/10 have two GPUs with a multiplexer |
| @@ -125,6 +125,7 @@ static int open_collection(struct hid_parser *parser, unsigned type) · 124 unmodified lines | |||
| 125 | { | 125 | { |
| 126 | struct hid_collection *collection; | 126 | struct hid_collection *collection; |
| 127 | unsigned usage; | 127 | unsigned usage; |
| 128 | int collection_index; | ||
| 128 | 129 | ||
| 129 | usage = parser->local.usage[0]; | 130 | usage = parser->local.usage[0]; |
| 130 | 131 | ||
| @@ -167,13 +168,13 @@ static int open_collection(struct hid_parser *parser, unsigned type) · 36 unmodified lines | |||
| 167 | parser->collection_stack[parser->collection_stack_ptr++] = | 168 | parser->collection_stack[parser->collection_stack_ptr++] = |
| 168 | parser->device->maxcollection; | 169 | parser->device->maxcollection; |
| 169 | 170 | ||
| 170 | collection = parser->device->collection + | 171 | collection_index = parser->device->maxcollection++; |
| 171 | parser->device->maxcollection++; | 172 | collection = parser->device->collection + collection_index; |
| 172 | collection->type = type; | 173 | collection->type = type; |
| 173 | collection->usage = usage; | 174 | collection->usage = usage; |
| 174 | collection->level = parser->collection_stack_ptr - 1; | 175 | collection->level = parser->collection_stack_ptr - 1; |
| 175 | collection->parent = parser->active_collection; | 176 | collection->parent_idx = (collection->level == 0) ? -1 : |
| 176 | parser->active_collection = collection; | 177 | parser->collection_stack[collection->level - 1]; |
| 177 | 178 | ||
| 178 | if (type == HID_COLLECTION_APPLICATION) | 179 | if (type == HID_COLLECTION_APPLICATION) |
| 179 | parser->device->maxapplication++; | 180 | parser->device->maxapplication++; |
| @@ -192,8 +193,6 @@ static int close_collection(struct hid_parser *parser) · 12 unmodified lines | |||
| 192 | return -EINVAL; | 193 | return -EINVAL; |
| 193 | } | 194 | } |
| 194 | parser->collection_stack_ptr--; | 195 | parser->collection_stack_ptr--; |
| 195 | if (parser->active_collection) | ||
| 196 | parser->active_collection = parser->active_collection->parent; | ||
| 197 | return 0; | 196 | return 0; |
| 198 | } | 197 | } |
| 199 | 198 | ||
| @@ -1006,10 +1005,12 @@ static void hid_apply_multiplier_to_field(struct hid_device *hid, · 806 unmodified lines | |||
| 1006 | usage = &field->usage[i]; | 1005 | usage = &field->usage[i]; |
| 1007 | 1006 | ||
| 1008 | collection = &hid->collection[usage->collection_index]; | 1007 | collection = &hid->collection[usage->collection_index]; |
| 1009 | while (collection && collection != multiplier_collection) | 1008 | while (collection->parent_idx != -1 && |
| 1010 | collection = collection->parent; | 1009 | collection != multiplier_collection) |
| 1010 | collection = &hid->collection[collection->parent_idx]; | ||
| 1011 | 1011 | ||
| 1012 | if (collection || multiplier_collection == NULL) | 1012 | if (collection->parent_idx != -1 || |
| 1013 | multiplier_collection == NULL) | ||
| 1013 | usage->resolution_multiplier = effective_multiplier; | 1014 | usage->resolution_multiplier = effective_multiplier; |
| 1014 | 1015 | ||
| 1015 | } | 1016 | } |
| @@ -1044,9 +1045,9 @@ static void hid_apply_multiplier(struct hid_device *hid, · 28 unmodified lines | |||
| 1044 | * applicable fields later. | 1045 | * applicable fields later. |
| 1045 | */ | 1046 | */ |
| 1046 | multiplier_collection = &hid->collection[multiplier->usage->collection_index]; | 1047 | multiplier_collection = &hid->collection[multiplier->usage->collection_index]; |
| 1047 | while (multiplier_collection && | 1048 | while (multiplier_collection->parent_idx != -1 && |
| 1048 | multiplier_collection->type != HID_COLLECTION_LOGICAL) | 1049 | multiplier_collection->type != HID_COLLECTION_LOGICAL) |
| 1049 | multiplier_collection = multiplier_collection->parent; | 1050 | multiplier_collection = &hid->collection[multiplier_collection->parent_idx]; |
| 1050 | 1051 | ||
| 1051 | effective_multiplier = hid_calculate_multiplier(hid, multiplier); | 1052 | effective_multiplier = hid_calculate_multiplier(hid, multiplier); |
| 1052 | 1053 | ||
| @@ -30,6 +30,7 @@ · 29 unmodified lines | |||
| 30 | 30 | ||
| 31 | #include <linux/debugfs.h> | 31 | #include <linux/debugfs.h> |
| 32 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
| 33 | #include <linux/kfifo.h> | ||
| 33 | #include <linux/sched/signal.h> | 34 | #include <linux/sched/signal.h> |
| 34 | #include <linux/export.h> | 35 | #include <linux/export.h> |
| 35 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
| @@ -661,17 +662,12 @@ EXPORT_SYMBOL_GPL(hid_dump_device); · 625 unmodified lines | |||
| 661 | /* enqueue string to 'events' ring buffer */ | 662 | /* enqueue string to 'events' ring buffer */ |
| 662 | void hid_debug_event(struct hid_device *hdev, char *buf) | 663 | void hid_debug_event(struct hid_device *hdev, char *buf) |
| 663 | { | 664 | { |
| 664 | unsigned i; | ||
| 665 | struct hid_debug_list *list; | 665 | struct hid_debug_list *list; |
| 666 | unsigned long flags; | 666 | unsigned long flags; |
| 667 | 667 | ||
| 668 | spin_lock_irqsave(&hdev->debug_list_lock, flags); | 668 | spin_lock_irqsave(&hdev->debug_list_lock, flags); |
| 669 | list_for_each_entry(list, &hdev->debug_list, node) { | 669 | list_for_each_entry(list, &hdev->debug_list, node) |
| 670 | for (i = 0; buf[i]; i++) | 670 | kfifo_in(&list->hid_debug_fifo, buf, strlen(buf)); |
| 671 | list->hid_debug_buf[(list->tail + i) % HID_DEBUG_BUFSIZE] = | ||
| 672 | buf[i]; | ||
| 673 | list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE; | ||
| 674 | } | ||
| 675 | spin_unlock_irqrestore(&hdev->debug_list_lock, flags); | 671 | spin_unlock_irqrestore(&hdev->debug_list_lock, flags); |
| 676 | 672 | ||
| 677 | wake_up_interruptible(&hdev->debug_wait); | 673 | wake_up_interruptible(&hdev->debug_wait); |
| @@ -722,8 +718,7 @@ void hid_dump_input(struct hid_device *hdev, struct hid_usage *usage, __s32 valu · 44 unmodified lines | |||
| 722 | hid_debug_event(hdev, buf); | 718 | hid_debug_event(hdev, buf); |
| 723 | 719 | ||
| 724 | kfree(buf); | 720 | kfree(buf); |
| 725 | wake_up_interruptible(&hdev->debug_wait); | 721 | wake_up_interruptible(&hdev->debug_wait); |
| 726 | |||
| 727 | } | 722 | } |
| 728 | EXPORT_SYMBOL_GPL(hid_dump_input); | 723 | EXPORT_SYMBOL_GPL(hid_dump_input); |
| 729 | 724 | ||
| @@ -1083,8 +1078,8 @@ static int hid_debug_events_open(struct inode *inode, struct file *file) · 353 unmodified lines | |||
| 1083 | goto out; | 1078 | goto out; |
| 1084 | } | 1079 | } |
| 1085 | 1080 | ||
| 1086 | if (!(list->hid_debug_buf = kzalloc(HID_DEBUG_BUFSIZE, GFP_KERNEL))) { | 1081 | err = kfifo_alloc(&list->hid_debug_fifo, HID_DEBUG_FIFOSIZE, GFP_KERNEL); |
| 1087 | err = -ENOMEM; | 1082 | if (err) { |
| 1088 | kfree(list); | 1083 | kfree(list); |
| 1089 | goto out; | 1084 | goto out; |
| 1090 | } | 1085 | } |
| @@ -1104,77 +1099,57 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer, · 13 unmodified lines | |||
| 1104 | size_t count, loff_t *ppos) | 1099 | size_t count, loff_t *ppos) |
| 1105 | { | 1100 | { |
| 1106 | struct hid_debug_list *list = file->private_data; | 1101 | struct hid_debug_list *list = file->private_data; |
| 1107 | int ret = 0, len; | 1102 | int ret = 0, copied; |
| 1108 | DECLARE_WAITQUEUE(wait, current); | 1103 | DECLARE_WAITQUEUE(wait, current); |
| 1109 | 1104 | ||
| 1110 | mutex_lock(&list->read_mutex); | 1105 | mutex_lock(&list->read_mutex); |
| 1111 | while (ret == 0) { | 1106 | if (kfifo_is_empty(&list->hid_debug_fifo)) { |
| 1112 | if (list->head == list->tail) { | 1107 | add_wait_queue(&list->hdev->debug_wait, &wait); |
| 1113 | add_wait_queue(&list->hdev->debug_wait, &wait); | 1108 | set_current_state(TASK_INTERRUPTIBLE); |
| 1114 | set_current_state(TASK_INTERRUPTIBLE); | 1109 | |
| 1115 | 1110 | while (kfifo_is_empty(&list->hid_debug_fifo)) { | |
| 1116 | while (list->head == list->tail) { | 1111 | if (file->f_flags & O_NONBLOCK) { |
| 1117 | if (file->f_flags & O_NONBLOCK) { | 1112 | ret = -EAGAIN; |
| 1118 | ret = -EAGAIN; | 1113 | break; |
| 1119 | break; | 1114 | } |
| 1120 | } | ||
| 1121 | if (signal_pending(current)) { | ||
| 1122 | ret = -ERESTARTSYS; | ||
| 1123 | break; | ||
| 1124 | } | ||
| 1125 | 1115 | ||
| 1126 | if (!list->hdev || !list->hdev->debug) { | 1116 | if (signal_pending(current)) { |
| 1127 | ret = -EIO; | 1117 | ret = -ERESTARTSYS; |
| 1128 | set_current_state(TASK_RUNNING); | 1118 | break; |
| 1129 | goto out; | 1119 | } |
| 1130 | } | ||
| 1131 | 1120 | ||
| 1132 | /* allow O_NONBLOCK from other threads */ | 1121 | /* if list->hdev is NULL we cannot remove_wait_queue(). |
| 1133 | mutex_unlock(&list->read_mutex); | 1122 | * if list->hdev->debug is 0 then hid_debug_unregister() |
| 1134 | schedule(); | 1123 | * was already called and list->hdev is being destroyed. |
| 1135 | mutex_lock(&list->read_mutex); | 1124 | * if we add remove_wait_queue() here we can hit a race. |
| 1136 | set_current_state(TASK_INTERRUPTIBLE); | 1125 | */ |
| 1126 | if (!list->hdev || !list->hdev->debug) { | ||
| 1127 | ret = -EIO; | ||
| 1128 | set_current_state(TASK_RUNNING); | ||
| 1129 | goto out; | ||
| 1137 | } | 1130 | } |
| 1138 | 1131 | ||
| 1139 | set_current_state(TASK_RUNNING); | 1132 | /* allow O_NONBLOCK from other threads */ |
| 1140 | remove_wait_queue(&list->hdev->debug_wait, &wait); | 1133 | mutex_unlock(&list->read_mutex); |
| 1134 | schedule(); | ||
| 1135 | mutex_lock(&list->read_mutex); | ||
| 1136 | set_current_state(TASK_INTERRUPTIBLE); | ||
| 1141 | } | 1137 | } |
| 1142 | 1138 | ||
| 1143 | if (ret) | 1139 | __set_current_state(TASK_RUNNING); |
| 1144 | goto out; | 1140 | remove_wait_queue(&list->hdev->debug_wait, &wait); |
| 1145 | 1141 | ||
| 1146 | /* pass the ringbuffer contents to userspace */ | 1142 | if (ret) |
| 1147 | copy_rest: | ||
| 1148 | if (list->tail == list->head) | ||
| 1149 | goto out; | 1143 | goto out; |
| 1150 | if (list->tail > list->head) { | ||
| 1151 | len = list->tail - list->head; | ||
| 1152 | if (len > count) | ||
| 1153 | len = count; | ||
| 1154 | |||
| 1155 | if (copy_to_user(buffer + ret, &list->hid_debug_buf[list->head], len)) { | ||
| 1156 | ret = -EFAULT; | ||
| 1157 | goto out; | ||
| 1158 | } | ||
| 1159 | ret += len; | ||
| 1160 | list->head += len; | ||
| 1161 | } else { | ||
| 1162 | len = HID_DEBUG_BUFSIZE - list->head; | ||
| 1163 | if (len > count) | ||
| 1164 | len = count; | ||
| 1165 | |||
| 1166 | if (copy_to_user(buffer, &list->hid_debug_buf[list->head], len)) { | ||
| 1167 | ret = -EFAULT; | ||
| 1168 | goto out; | ||
| 1169 | } | ||
| 1170 | list->head = 0; | ||
| 1171 | ret += len; | ||
| 1172 | count -= len; | ||
| 1173 | if (count > 0) | ||
| 1174 | goto copy_rest; | ||
| 1175 | } | ||
| 1176 | |||
| 1177 | } | 1144 | } |
| 1145 | |||
| 1146 | /* pass the fifo content to userspace, locking is not needed with only | ||
| 1147 | * one concurrent reader and one concurrent writer | ||
| 1148 | */ | ||
| 1149 | ret = kfifo_to_user(&list->hid_debug_fifo, buffer, count, &copied); | ||
| 1150 | if (ret) | ||
| 1151 | goto out; | ||
| 1152 | ret = copied; | ||
| 1178 | out: | 1153 | out: |
| 1179 | mutex_unlock(&list->read_mutex); | 1154 | mutex_unlock(&list->read_mutex); |
| 1180 | return ret; | 1155 | return ret; |
| @@ -1185,7 +1160,7 @@ static __poll_t hid_debug_events_poll(struct file *file, poll_table *wait) · 4 unmodified lines | |||
| 1185 | struct hid_debug_list *list = file->private_data; | 1160 | struct hid_debug_list *list = file->private_data; |
| 1186 | 1161 | ||
| 1187 | poll_wait(file, &list->hdev->debug_wait, wait); | 1162 | poll_wait(file, &list->hdev->debug_wait, wait); |
| 1188 | if (list->head != list->tail) | 1163 | if (!kfifo_is_empty(&list->hid_debug_fifo)) |
| 1189 | return EPOLLIN | EPOLLRDNORM; | 1164 | return EPOLLIN | EPOLLRDNORM; |
| 1190 | if (!list->hdev->debug) | 1165 | if (!list->hdev->debug) |
| 1191 | return EPOLLERR | EPOLLHUP; | 1166 | return EPOLLERR | EPOLLHUP; |
| @@ -1200,7 +1175,7 @@ static int hid_debug_events_release(struct inode *inode, struct file *file) · 8 unmodified lines | |||
| 1200 | spin_lock_irqsave(&list->hdev->debug_list_lock, flags); | 1175 | spin_lock_irqsave(&list->hdev->debug_list_lock, flags); |
| 1201 | list_del(&list->node); | 1176 | list_del(&list->node); |
| 1202 | spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); | 1177 | spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); |
| 1203 | kfree(list->hid_debug_buf); | 1178 | kfifo_free(&list->hid_debug_fifo); |
| 1204 | kfree(list); | 1179 | kfree(list); |
| 1205 | 1180 | ||
| 1206 | return 0; | 1181 | return 0; |
| @@ -1246,4 +1221,3 @@ void hid_debug_exit(void) · 39 unmodified lines | |||
| 1246 | { | 1221 | { |
| 1247 | debugfs_remove_recursive(hid_debug_root); | 1222 | debugfs_remove_recursive(hid_debug_root); |
| 1248 | } | 1223 | } |
| 1249 | |||
| @@ -461,6 +461,9 @@ · 460 unmodified lines | |||
| 461 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_010A 0x010a | 461 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_010A 0x010a |
| 462 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100 0xe100 | 462 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100 0xe100 |
| 463 | 463 | ||
| 464 | #define I2C_VENDOR_ID_GOODIX 0x27c6 | ||
| 465 | #define I2C_DEVICE_ID_GOODIX_01F0 0x01f0 | ||
| 466 | |||
| 464 | #define USB_VENDOR_ID_GOODTOUCH 0x1aad | 467 | #define USB_VENDOR_ID_GOODTOUCH 0x1aad |
| 465 | #define USB_DEVICE_ID_GOODTOUCH_000f 0x000f | 468 | #define USB_DEVICE_ID_GOODTOUCH_000f 0x000f |
| 466 | 469 | ||
| @@ -179,6 +179,8 @@ static const struct i2c_hid_quirks { · 178 unmodified lines | |||
| 179 | I2C_HID_QUIRK_DELAY_AFTER_SLEEP }, | 179 | I2C_HID_QUIRK_DELAY_AFTER_SLEEP }, |
| 180 | { USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_8001, | 180 | { USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_8001, |
| 181 | I2C_HID_QUIRK_NO_RUNTIME_PM }, | 181 | I2C_HID_QUIRK_NO_RUNTIME_PM }, |
| 182 | { I2C_VENDOR_ID_GOODIX, I2C_DEVICE_ID_GOODIX_01F0, | ||
| 183 | I2C_HID_QUIRK_NO_RUNTIME_PM }, | ||
| 182 | { 0, 0 } | 184 | { 0, 0 } |
| 183 | }; | 185 | }; |
| 184 | 186 | ||
| @@ -701,19 +701,12 @@ static int vmbus_close_internal(struct vmbus_channel *channel) · 700 unmodified lines | |||
| 701 | int vmbus_disconnect_ring(struct vmbus_channel *channel) | 701 | int vmbus_disconnect_ring(struct vmbus_channel *channel) |
| 702 | { | 702 | { |
| 703 | struct vmbus_channel *cur_channel, *tmp; | 703 | struct vmbus_channel *cur_channel, *tmp; |
| 704 | unsigned long flags; | ||
| 705 | LIST_HEAD(list); | ||
| 706 | int ret; | 704 | int ret; |
| 707 | 705 | ||
| 708 | if (channel->primary_channel != NULL) | 706 | if (channel->primary_channel != NULL) |
| 709 | return -EINVAL; | 707 | return -EINVAL; |
| 710 | 708 | ||
| 711 | /* Snapshot the list of subchannels */ | 709 | list_for_each_entry_safe(cur_channel, tmp, &channel->sc_list, sc_list) { |
| 712 | spin_lock_irqsave(&channel->lock, flags); | ||
| 713 | list_splice_init(&channel->sc_list, &list); | ||
| 714 | spin_unlock_irqrestore(&channel->lock, flags); | ||
| 715 | |||
| 716 | list_for_each_entry_safe(cur_channel, tmp, &list, sc_list) { | ||
| 717 | if (cur_channel->rescind) | 710 | if (cur_channel->rescind) |
| 718 | wait_for_completion(&cur_channel->rescind_event); | 711 | wait_for_completion(&cur_channel->rescind_event); |
| 719 | 712 | ||
| @@ -888,12 +888,14 @@ static unsigned long handle_pg_range(unsigned long pg_start, · 887 unmodified lines | |||
| 888 | pfn_cnt -= pgs_ol; | 888 | pfn_cnt -= pgs_ol; |
| 889 | /* | 889 | /* |
| 890 | * Check if the corresponding memory block is already | 890 | * Check if the corresponding memory block is already |
| 891 | * online by checking its last previously backed page. | 891 | * online. It is possible to observe struct pages still |
| 892 | * In case it is we need to bring rest (which was not | 892 | * being uninitialized here so check section instead. |
| 893 | * backed previously) online too. | 893 | * In case the section is online we need to bring the |
| 894 | * rest of pfns (which were not backed previously) | ||
| 895 | * online too. | ||
| 894 | */ | 896 | */ |
| 895 | if (start_pfn > has->start_pfn && | 897 | if (start_pfn > has->start_pfn && |
| 896 | !PageReserved(pfn_to_page(start_pfn - 1))) | 898 | online_section_nr(pfn_to_section_nr(start_pfn))) |
| 897 | hv_bring_pgs_online(has, start_pfn, pgs_ol); | 899 | hv_bring_pgs_online(has, start_pfn, pgs_ol); |
| 898 | 900 | ||
| 899 | } | 901 | } |
| @@ -164,26 +164,25 @@ hv_get_ringbuffer_availbytes(const struct hv_ring_buffer_info *rbi, · 163 unmodified lines | |||
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | /* Get various debug metrics for the specified ring buffer. */ | 166 | /* Get various debug metrics for the specified ring buffer. */ |
| 167 | void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info, | 167 | int hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info, |
| 168 | struct hv_ring_buffer_debug_info *debug_info) | 168 | struct hv_ring_buffer_debug_info *debug_info) |
| 169 | { | 169 | { |
| 170 | u32 bytes_avail_towrite; | 170 | u32 bytes_avail_towrite; |
| 171 | u32 bytes_avail_toread; | 171 | u32 bytes_avail_toread; |
| 172 | 172 | ||
| 173 | if (ring_info->ring_buffer) { | 173 | if (!ring_info->ring_buffer) |
| 174 | hv_get_ringbuffer_availbytes(ring_info, | 174 | return -EINVAL; |
| 175 | &bytes_avail_toread, | 175 | |
| 176 | &bytes_avail_towrite); | 176 | hv_get_ringbuffer_availbytes(ring_info, |
| 177 | 177 | &bytes_avail_toread, | |
| 178 | debug_info->bytes_avail_toread = bytes_avail_toread; | 178 | &bytes_avail_towrite); |
| 179 | debug_info->bytes_avail_towrite = bytes_avail_towrite; | 179 | debug_info->bytes_avail_toread = bytes_avail_toread; |
| 180 | debug_info->current_read_index = | 180 | debug_info->bytes_avail_towrite = bytes_avail_towrite; |
| 181 | ring_info->ring_buffer->read_index; | 181 | debug_info->current_read_index = ring_info->ring_buffer->read_index; |
| 182 | debug_info->current_write_index = | 182 | debug_info->current_write_index = ring_info->ring_buffer->write_index; |
| 183 | ring_info->ring_buffer->write_index; | 183 | debug_info->current_interrupt_mask |
| 184 | debug_info->current_interrupt_mask = | 184 | = ring_info->ring_buffer->interrupt_mask; |
| 185 | ring_info->ring_buffer->interrupt_mask; | 185 | return 0; |
| 186 | } | ||
| 187 | } | 186 | } |
| 188 | EXPORT_SYMBOL_GPL(hv_ringbuffer_get_debuginfo); | 187 | EXPORT_SYMBOL_GPL(hv_ringbuffer_get_debuginfo); |
| 189 | 188 | ||
| @@ -313,12 +313,16 @@ static ssize_t out_intr_mask_show(struct device *dev, · 312 unmodified lines | |||
| 313 | { | 313 | { |
| 314 | struct hv_device *hv_dev = device_to_hv_device(dev); | 314 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 315 | struct hv_ring_buffer_debug_info outbound; | 315 | struct hv_ring_buffer_debug_info outbound; |
| 316 | int ret; | ||
| 316 | 317 | ||
| 317 | if (!hv_dev->channel) | 318 | if (!hv_dev->channel) |
| 318 | return -ENODEV; | 319 | return -ENODEV; |
| 319 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 320 | |
| 320 | return -EINVAL; | 321 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, |
| 321 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | 322 | &outbound); |
| 323 | if (ret < 0) | ||
| 324 | return ret; | ||
| 325 | |||
| 322 | return sprintf(buf, "%d\n", outbound.current_interrupt_mask); | 326 | return sprintf(buf, "%d\n", outbound.current_interrupt_mask); |
| 323 | } | 327 | } |
| 324 | static DEVICE_ATTR_RO(out_intr_mask); | 328 | static DEVICE_ATTR_RO(out_intr_mask); |
| @@ -328,12 +332,15 @@ static ssize_t out_read_index_show(struct device *dev, · 3 unmodified lines | |||
| 328 | { | 332 | { |
| 329 | struct hv_device *hv_dev = device_to_hv_device(dev); | 333 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 330 | struct hv_ring_buffer_debug_info outbound; | 334 | struct hv_ring_buffer_debug_info outbound; |
| 335 | int ret; | ||
| 331 | 336 | ||
| 332 | if (!hv_dev->channel) | 337 | if (!hv_dev->channel) |
| 333 | return -ENODEV; | 338 | return -ENODEV; |
| 334 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 339 | |
| 335 | return -EINVAL; | 340 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, |
| 336 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | 341 | &outbound); |
| 342 | if (ret < 0) | ||
| 343 | return ret; | ||
| 337 | return sprintf(buf, "%d\n", outbound.current_read_index); | 344 | return sprintf(buf, "%d\n", outbound.current_read_index); |
| 338 | } | 345 | } |
| 339 | static DEVICE_ATTR_RO(out_read_index); | 346 | static DEVICE_ATTR_RO(out_read_index); |
| @@ -344,12 +351,15 @@ static ssize_t out_write_index_show(struct device *dev, · 4 unmodified lines | |||
| 344 | { | 351 | { |
| 345 | struct hv_device *hv_dev = device_to_hv_device(dev); | 352 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 346 | struct hv_ring_buffer_debug_info outbound; | 353 | struct hv_ring_buffer_debug_info outbound; |
| 354 | int ret; | ||
| 347 | 355 | ||
| 348 | if (!hv_dev->channel) | 356 | if (!hv_dev->channel) |
| 349 | return -ENODEV; | 357 | return -ENODEV; |
| 350 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 358 | |
| 351 | return -EINVAL; | 359 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, |
| 352 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | 360 | &outbound); |
| 361 | if (ret < 0) | ||
| 362 | return ret; | ||
| 353 | return sprintf(buf, "%d\n", outbound.current_write_index); | 363 | return sprintf(buf, "%d\n", outbound.current_write_index); |
| 354 | } | 364 | } |
| 355 | static DEVICE_ATTR_RO(out_write_index); | 365 | static DEVICE_ATTR_RO(out_write_index); |
| @@ -360,12 +370,15 @@ static ssize_t out_read_bytes_avail_show(struct device *dev, · 4 unmodified lines | |||
| 360 | { | 370 | { |
| 361 | struct hv_device *hv_dev = device_to_hv_device(dev); | 371 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 362 | struct hv_ring_buffer_debug_info outbound; | 372 | struct hv_ring_buffer_debug_info outbound; |
| 373 | int ret; | ||
| 363 | 374 | ||
| 364 | if (!hv_dev->channel) | 375 | if (!hv_dev->channel) |
| 365 | return -ENODEV; | 376 | return -ENODEV; |
| 366 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 377 | |
| 367 | return -EINVAL; | 378 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, |
| 368 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | 379 | &outbound); |
| 380 | if (ret < 0) | ||
| 381 | return ret; | ||
| 369 | return sprintf(buf, "%d\n", outbound.bytes_avail_toread); | 382 | return sprintf(buf, "%d\n", outbound.bytes_avail_toread); |
| 370 | } | 383 | } |
| 371 | static DEVICE_ATTR_RO(out_read_bytes_avail); | 384 | static DEVICE_ATTR_RO(out_read_bytes_avail); |
| @@ -376,12 +389,15 @@ static ssize_t out_write_bytes_avail_show(struct device *dev, · 4 unmodified lines | |||
| 376 | { | 389 | { |
| 377 | struct hv_device *hv_dev = device_to_hv_device(dev); | 390 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 378 | struct hv_ring_buffer_debug_info outbound; | 391 | struct hv_ring_buffer_debug_info outbound; |
| 392 | int ret; | ||
| 379 | 393 | ||
| 380 | if (!hv_dev->channel) | 394 | if (!hv_dev->channel) |
| 381 | return -ENODEV; | 395 | return -ENODEV; |
| 382 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 396 | |
| 383 | return -EINVAL; | 397 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, |
| 384 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | 398 | &outbound); |
| 399 | if (ret < 0) | ||
| 400 | return ret; | ||
| 385 | return sprintf(buf, "%d\n", outbound.bytes_avail_towrite); | 401 | return sprintf(buf, "%d\n", outbound.bytes_avail_towrite); |
| 386 | } | 402 | } |
| 387 | static DEVICE_ATTR_RO(out_write_bytes_avail); | 403 | static DEVICE_ATTR_RO(out_write_bytes_avail); |
| @@ -391,12 +407,15 @@ static ssize_t in_intr_mask_show(struct device *dev, · 3 unmodified lines | |||
| 391 | { | 407 | { |
| 392 | struct hv_device *hv_dev = device_to_hv_device(dev); | 408 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 393 | struct hv_ring_buffer_debug_info inbound; | 409 | struct hv_ring_buffer_debug_info inbound; |
| 410 | int ret; | ||
| 394 | 411 | ||
| 395 | if (!hv_dev->channel) | 412 | if (!hv_dev->channel) |
| 396 | return -ENODEV; | 413 | return -ENODEV; |
| 397 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 414 | |
| 398 | return -EINVAL; | 415 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); |
| 399 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | 416 | if (ret < 0) |
| 417 | return ret; | ||
| 418 | |||
| 400 | return sprintf(buf, "%d\n", inbound.current_interrupt_mask); | 419 | return sprintf(buf, "%d\n", inbound.current_interrupt_mask); |
| 401 | } | 420 | } |
| 402 | static DEVICE_ATTR_RO(in_intr_mask); | 421 | static DEVICE_ATTR_RO(in_intr_mask); |
| @@ -406,12 +425,15 @@ static ssize_t in_read_index_show(struct device *dev, · 3 unmodified lines | |||
| 406 | { | 425 | { |
| 407 | struct hv_device *hv_dev = device_to_hv_device(dev); | 426 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 408 | struct hv_ring_buffer_debug_info inbound; | 427 | struct hv_ring_buffer_debug_info inbound; |
| 428 | int ret; | ||
| 409 | 429 | ||
| 410 | if (!hv_dev->channel) | 430 | if (!hv_dev->channel) |
| 411 | return -ENODEV; | 431 | return -ENODEV; |
| 412 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 432 | |
| 413 | return -EINVAL; | 433 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); |
| 414 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | 434 | if (ret < 0) |
| 435 | return ret; | ||
| 436 | |||
| 415 | return sprintf(buf, "%d\n", inbound.current_read_index); | 437 | return sprintf(buf, "%d\n", inbound.current_read_index); |
| 416 | } | 438 | } |
| 417 | static DEVICE_ATTR_RO(in_read_index); | 439 | static DEVICE_ATTR_RO(in_read_index); |
| @@ -421,12 +443,15 @@ static ssize_t in_write_index_show(struct device *dev, · 3 unmodified lines | |||
| 421 | { | 443 | { |
| 422 | struct hv_device *hv_dev = device_to_hv_device(dev); | 444 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 423 | struct hv_ring_buffer_debug_info inbound; | 445 | struct hv_ring_buffer_debug_info inbound; |
| 446 | int ret; | ||
| 424 | 447 | ||
| 425 | if (!hv_dev->channel) | 448 | if (!hv_dev->channel) |
| 426 | return -ENODEV; | 449 | return -ENODEV; |
| 427 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 450 | |
| 428 | return -EINVAL; | 451 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); |
| 429 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | 452 | if (ret < 0) |
| 453 | return ret; | ||
| 454 | |||
| 430 | return sprintf(buf, "%d\n", inbound.current_write_index); | 455 | return sprintf(buf, "%d\n", inbound.current_write_index); |
| 431 | } | 456 | } |
| 432 | static DEVICE_ATTR_RO(in_write_index); | 457 | static DEVICE_ATTR_RO(in_write_index); |
| @@ -437,12 +462,15 @@ static ssize_t in_read_bytes_avail_show(struct device *dev, · 4 unmodified lines | |||
| 437 | { | 462 | { |
| 438 | struct hv_device *hv_dev = device_to_hv_device(dev); | 463 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 439 | struct hv_ring_buffer_debug_info inbound; | 464 | struct hv_ring_buffer_debug_info inbound; |
| 465 | int ret; | ||
| 440 | 466 | ||
| 441 | if (!hv_dev->channel) | 467 | if (!hv_dev->channel) |
| 442 | return -ENODEV; | 468 | return -ENODEV; |
| 443 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 469 | |
| 444 | return -EINVAL; | 470 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); |
| 445 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | 471 | if (ret < 0) |
| 472 | return ret; | ||
| 473 | |||
| 446 | return sprintf(buf, "%d\n", inbound.bytes_avail_toread); | 474 | return sprintf(buf, "%d\n", inbound.bytes_avail_toread); |
| 447 | } | 475 | } |
| 448 | static DEVICE_ATTR_RO(in_read_bytes_avail); | 476 | static DEVICE_ATTR_RO(in_read_bytes_avail); |
| @@ -453,12 +481,15 @@ static ssize_t in_write_bytes_avail_show(struct device *dev, · 4 unmodified lines | |||
| 453 | { | 481 | { |
| 454 | struct hv_device *hv_dev = device_to_hv_device(dev); | 482 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 455 | struct hv_ring_buffer_debug_info inbound; | 483 | struct hv_ring_buffer_debug_info inbound; |
| 484 | int ret; | ||
| 456 | 485 | ||
| 457 | if (!hv_dev->channel) | 486 | if (!hv_dev->channel) |
| 458 | return -ENODEV; | 487 | return -ENODEV; |
| 459 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 488 | |
| 460 | return -EINVAL; | 489 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); |
| 461 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | 490 | if (ret < 0) |
| 491 | return ret; | ||
| 492 | |||
| 462 | return sprintf(buf, "%d\n", inbound.bytes_avail_towrite); | 493 | return sprintf(buf, "%d\n", inbound.bytes_avail_towrite); |
| 463 | } | 494 | } |
| 464 | static DEVICE_ATTR_RO(in_write_bytes_avail); | 495 | static DEVICE_ATTR_RO(in_write_bytes_avail); |
| @@ -393,8 +393,10 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, · 392 unmodified lines | |||
| 393 | } | 393 | } |
| 394 | 394 | ||
| 395 | rv = lm80_read_value(client, LM80_REG_FANDIV); | 395 | rv = lm80_read_value(client, LM80_REG_FANDIV); |
| 396 | if (rv < 0) | 396 | if (rv < 0) { |
| 397 | mutex_unlock(&data->update_lock); | ||
| 397 | return rv; | 398 | return rv; |
| 399 | } | ||
| 398 | reg = (rv & ~(3 << (2 * (nr + 1)))) | 400 | reg = (rv & ~(3 << (2 * (nr + 1)))) |
| 399 | | (data->fan_div[nr] << (2 * (nr + 1))); | 401 | | (data->fan_div[nr] << (2 * (nr + 1))); |
| 400 | lm80_write_value(client, LM80_REG_FANDIV, reg); | 402 | lm80_write_value(client, LM80_REG_FANDIV, reg); |
| @@ -44,8 +44,8 @@ · 43 unmodified lines | |||
| 44 | * nct6796d 14 7 7 2+6 0xd420 0xc1 0x5ca3 | 44 | * nct6796d 14 7 7 2+6 0xd420 0xc1 0x5ca3 |
| 45 | * nct6797d 14 7 7 2+6 0xd450 0xc1 0x5ca3 | 45 | * nct6797d 14 7 7 2+6 0xd450 0xc1 0x5ca3 |
| 46 | * (0xd451) | 46 | * (0xd451) |
| 47 | * nct6798d 14 7 7 2+6 0xd458 0xc1 0x5ca3 | 47 | * nct6798d 14 7 7 2+6 0xd428 0xc1 0x5ca3 |
| 48 | * (0xd459) | 48 | * (0xd429) |
| 49 | * | 49 | * |
| 50 | * #temp lists the number of monitored temperature sources (first value) plus | 50 | * #temp lists the number of monitored temperature sources (first value) plus |
| 51 | * the number of directly connectable temperature sensors (second value). | 51 | * the number of directly connectable temperature sensors (second value). |
| @@ -138,7 +138,7 @@ MODULE_PARM_DESC(fan_debounce, "Enable debouncing for fan RPM signal"); · 86 unmodified lines | |||
| 138 | #define SIO_NCT6795_ID 0xd350 | 138 | #define SIO_NCT6795_ID 0xd350 |
| 139 | #define SIO_NCT6796_ID 0xd420 | 139 | #define SIO_NCT6796_ID 0xd420 |
| 140 | #define SIO_NCT6797_ID 0xd450 | 140 | #define SIO_NCT6797_ID 0xd450 |
| 141 | #define SIO_NCT6798_ID 0xd458 | 141 | #define SIO_NCT6798_ID 0xd428 |
| 142 | #define SIO_ID_MASK 0xFFF8 | 142 | #define SIO_ID_MASK 0xFFF8 |
| 143 | 143 | ||
| 144 | enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 }; | 144 | enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 }; |
| @@ -4508,7 +4508,8 @@ static int __maybe_unused nct6775_resume(struct device *dev) · 4363 unmodified lines | |||
| 4508 | 4508 | ||
| 4509 | if (data->kind == nct6791 || data->kind == nct6792 || | 4509 | if (data->kind == nct6791 || data->kind == nct6792 || |
| 4510 | data->kind == nct6793 || data->kind == nct6795 || | 4510 | data->kind == nct6793 || data->kind == nct6795 || |
| 4511 | data->kind == nct6796) | 4511 | data->kind == nct6796 || data->kind == nct6797 || |
| 4512 | data->kind == nct6798) | ||
| 4512 | nct6791_enable_io_mapping(sioreg); | 4513 | nct6791_enable_io_mapping(sioreg); |
| 4513 | 4514 | ||
| 4514 | superio_exit(sioreg); | 4515 | superio_exit(sioreg); |
| @@ -4644,7 +4645,8 @@ static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data) · 129 unmodified lines | |||
| 4644 | 4645 | ||
| 4645 | if (sio_data->kind == nct6791 || sio_data->kind == nct6792 || | 4646 | if (sio_data->kind == nct6791 || sio_data->kind == nct6792 || |
| 4646 | sio_data->kind == nct6793 || sio_data->kind == nct6795 || | 4647 | sio_data->kind == nct6793 || sio_data->kind == nct6795 || |
| 4647 | sio_data->kind == nct6796) | 4648 | sio_data->kind == nct6796 || sio_data->kind == nct6797 || |
| 4649 | sio_data->kind == nct6798) | ||
| 4648 | nct6791_enable_io_mapping(sioaddr); | 4650 | nct6791_enable_io_mapping(sioaddr); |
| 4649 | 4651 | ||
| 4650 | superio_exit(sioaddr); | 4652 | superio_exit(sioaddr); |
| @@ -380,8 +380,8 @@ static ssize_t occ_show_power_1(struct device *dev, · 379 unmodified lines | |||
| 380 | val *= 1000000ULL; | 380 | val *= 1000000ULL; |
| 381 | break; | 381 | break; |
| 382 | case 2: | 382 | case 2: |
| 383 | val = get_unaligned_be32(&power->update_tag) * | 383 | val = (u64)get_unaligned_be32(&power->update_tag) * |
| 384 | occ->powr_sample_time_us; | 384 | occ->powr_sample_time_us; |
| 385 | break; | 385 | break; |
| 386 | case 3: | 386 | case 3: |
| 387 | val = get_unaligned_be16(&power->value) * 1000000ULL; | 387 | val = get_unaligned_be16(&power->value) * 1000000ULL; |
| @@ -425,8 +425,8 @@ static ssize_t occ_show_power_2(struct device *dev, · 37 unmodified lines | |||
| 425 | &power->update_tag); | 425 | &power->update_tag); |
| 426 | break; | 426 | break; |
| 427 | case 2: | 427 | case 2: |
| 428 | val = get_unaligned_be32(&power->update_tag) * | 428 | val = (u64)get_unaligned_be32(&power->update_tag) * |
| 429 | occ->powr_sample_time_us; | 429 | occ->powr_sample_time_us; |
| 430 | break; | 430 | break; |
| 431 | case 3: | 431 | case 3: |
| 432 | val = get_unaligned_be16(&power->value) * 1000000ULL; | 432 | val = get_unaligned_be16(&power->value) * 1000000ULL; |
| @@ -463,8 +463,8 @@ static ssize_t occ_show_power_a0(struct device *dev, · 30 unmodified lines | |||
| 463 | &power->system.update_tag); | 463 | &power->system.update_tag); |
| 464 | break; | 464 | break; |
| 465 | case 2: | 465 | case 2: |
| 466 | val = get_unaligned_be32(&power->system.update_tag) * | 466 | val = (u64)get_unaligned_be32(&power->system.update_tag) * |
| 467 | occ->powr_sample_time_us; | 467 | occ->powr_sample_time_us; |
| 468 | break; | 468 | break; |
| 469 | case 3: | 469 | case 3: |
| 470 | val = get_unaligned_be16(&power->system.value) * 1000000ULL; | 470 | val = get_unaligned_be16(&power->system.value) * 1000000ULL; |
| @@ -477,8 +477,8 @@ static ssize_t occ_show_power_a0(struct device *dev, · 6 unmodified lines | |||
| 477 | &power->proc.update_tag); | 477 | &power->proc.update_tag); |
| 478 | break; | 478 | break; |
| 479 | case 6: | 479 | case 6: |
| 480 | val = get_unaligned_be32(&power->proc.update_tag) * | 480 | val = (u64)get_unaligned_be32(&power->proc.update_tag) * |
| 481 | occ->powr_sample_time_us; | 481 | occ->powr_sample_time_us; |
| 482 | break; | 482 | break; |
| 483 | case 7: | 483 | case 7: |
| 484 | val = get_unaligned_be16(&power->proc.value) * 1000000ULL; | 484 | val = get_unaligned_be16(&power->proc.value) * 1000000ULL; |
| @@ -491,8 +491,8 @@ static ssize_t occ_show_power_a0(struct device *dev, · 6 unmodified lines | |||
| 491 | &power->vdd.update_tag); | 491 | &power->vdd.update_tag); |
| 492 | break; | 492 | break; |
| 493 | case 10: | 493 | case 10: |
| 494 | val = get_unaligned_be32(&power->vdd.update_tag) * | 494 | val = (u64)get_unaligned_be32(&power->vdd.update_tag) * |
| 495 | occ->powr_sample_time_us; | 495 | occ->powr_sample_time_us; |
| 496 | break; | 496 | break; |
| 497 | case 11: | 497 | case 11: |
| 498 | val = get_unaligned_be16(&power->vdd.value) * 1000000ULL; | 498 | val = get_unaligned_be16(&power->vdd.value) * 1000000ULL; |
| @@ -505,8 +505,8 @@ static ssize_t occ_show_power_a0(struct device *dev, · 6 unmodified lines | |||
| 505 | &power->vdn.update_tag); | 505 | &power->vdn.update_tag); |
| 506 | break; | 506 | break; |
| 507 | case 14: | 507 | case 14: |
| 508 | val = get_unaligned_be32(&power->vdn.update_tag) * | 508 | val = (u64)get_unaligned_be32(&power->vdn.update_tag) * |
| 509 | occ->powr_sample_time_us; | 509 | occ->powr_sample_time_us; |
| 510 | break; | 510 | break; |
| 511 | case 15: | 511 | case 15: |
| 512 | val = get_unaligned_be16(&power->vdn.value) * 1000000ULL; | 512 | val = get_unaligned_be16(&power->vdn.value) * 1000000ULL; |
| @@ -88,7 +88,7 @@ static const struct of_device_id tmp421_of_match[] = { · 87 unmodified lines | |||
| 88 | .data = (void *)2 | 88 | .data = (void *)2 |
| 89 | }, | 89 | }, |
| 90 | { | 90 | { |
| 91 | .compatible = "ti,tmp422", | 91 | .compatible = "ti,tmp442", |
| 92 | .data = (void *)3 | 92 | .data = (void *)3 |
| 93 | }, | 93 | }, |
| 94 | { }, | 94 | { }, |
| @@ -1500,8 +1500,7 @@ static int omap_i2c_remove(struct platform_device *pdev) · 1499 unmodified lines | |||
| 1500 | return 0; | 1500 | return 0; |
| 1501 | } | 1501 | } |
| 1502 | 1502 | ||
| 1503 | #ifdef CONFIG_PM | 1503 | static int __maybe_unused omap_i2c_runtime_suspend(struct device *dev) |
| 1504 | static int omap_i2c_runtime_suspend(struct device *dev) | ||
| 1505 | { | 1504 | { |
| 1506 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); | 1505 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); |
| 1507 | 1506 | ||
| @@ -1527,7 +1526,7 @@ static int omap_i2c_runtime_suspend(struct device *dev) · 19 unmodified lines | |||
| 1527 | return 0; | 1526 | return 0; |
| 1528 | } | 1527 | } |
| 1529 | 1528 | ||
| 1530 | static int omap_i2c_runtime_resume(struct device *dev) | 1529 | static int __maybe_unused omap_i2c_runtime_resume(struct device *dev) |
| 1531 | { | 1530 | { |
| 1532 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); | 1531 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); |
| 1533 | 1532 | ||
| @@ -1542,20 +1541,18 @@ static int omap_i2c_runtime_resume(struct device *dev) · 8 unmodified lines | |||
| 1542 | } | 1541 | } |
| 1543 | 1542 | ||
| 1544 | static const struct dev_pm_ops omap_i2c_pm_ops = { | 1543 | static const struct dev_pm_ops omap_i2c_pm_ops = { |
| 1544 | SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | ||
| 1545 | pm_runtime_force_resume) | ||
| 1545 | SET_RUNTIME_PM_OPS(omap_i2c_runtime_suspend, | 1546 | SET_RUNTIME_PM_OPS(omap_i2c_runtime_suspend, |
| 1546 | omap_i2c_runtime_resume, NULL) | 1547 | omap_i2c_runtime_resume, NULL) |
| 1547 | }; | 1548 | }; |
| 1548 | #define OMAP_I2C_PM_OPS (&omap_i2c_pm_ops) | ||
| 1549 | #else | ||
| 1550 | #define OMAP_I2C_PM_OPS NULL | ||
| 1551 | #endif /* CONFIG_PM */ | ||
| 1552 | 1549 | ||
| 1553 | static struct platform_driver omap_i2c_driver = { | 1550 | static struct platform_driver omap_i2c_driver = { |
| 1554 | .probe = omap_i2c_probe, | 1551 | .probe = omap_i2c_probe, |
| 1555 | .remove = omap_i2c_remove, | 1552 | .remove = omap_i2c_remove, |
| 1556 | .driver = { | 1553 | .driver = { |
| 1557 | .name = "omap_i2c", | 1554 | .name = "omap_i2c", |
| 1558 | .pm = OMAP_I2C_PM_OPS, | 1555 | .pm = &omap_i2c_pm_ops, |
| 1559 | .of_match_table = of_match_ptr(omap_i2c_of_match), | 1556 | .of_match_table = of_match_ptr(omap_i2c_of_match), |
| 1560 | }, | 1557 | }, |
| 1561 | }; | 1558 | }; |
| @@ -155,6 +155,8 @@ enum msg_end_type { · 154 unmodified lines | |||
| 155 | * @has_mst_fifo: The I2C controller contains the new MST FIFO interface that | 155 | * @has_mst_fifo: The I2C controller contains the new MST FIFO interface that |
| 156 | * provides additional features and allows for longer messages to | 156 | * provides additional features and allows for longer messages to |
| 157 | * be transferred in one go. | 157 | * be transferred in one go. |
| 158 | * @quirks: i2c adapter quirks for limiting write/read transfer size and not | ||
| 159 | * allowing 0 length transfers. | ||
| 158 | */ | 160 | */ |
| 159 | struct tegra_i2c_hw_feature { | 161 | struct tegra_i2c_hw_feature { |
| 160 | bool has_continue_xfer_support; | 162 | bool has_continue_xfer_support; |
| @@ -167,6 +169,7 @@ struct tegra_i2c_hw_feature { · 6 unmodified lines | |||
| 167 | bool has_multi_master_mode; | 169 | bool has_multi_master_mode; |
| 168 | bool has_slcg_override_reg; | 170 | bool has_slcg_override_reg; |
| 169 | bool has_mst_fifo; | 171 | bool has_mst_fifo; |
| 172 | const struct i2c_adapter_quirks *quirks; | ||
| 170 | }; | 173 | }; |
| 171 | 174 | ||
| 172 | /** | 175 | /** |
| @@ -837,6 +840,10 @@ static const struct i2c_adapter_quirks tegra_i2c_quirks = { · 664 unmodified lines | |||
| 837 | .max_write_len = 4096, | 840 | .max_write_len = 4096, |
| 838 | }; | 841 | }; |
| 839 | 842 | ||
| 843 | static const struct i2c_adapter_quirks tegra194_i2c_quirks = { | ||
| 844 | .flags = I2C_AQ_NO_ZERO_LEN, | ||
| 845 | }; | ||
| 846 | |||
| 840 | static const struct tegra_i2c_hw_feature tegra20_i2c_hw = { | 847 | static const struct tegra_i2c_hw_feature tegra20_i2c_hw = { |
| 841 | .has_continue_xfer_support = false, | 848 | .has_continue_xfer_support = false, |
| 842 | .has_per_pkt_xfer_complete_irq = false, | 849 | .has_per_pkt_xfer_complete_irq = false, |
| @@ -848,6 +855,7 @@ static const struct tegra_i2c_hw_feature tegra20_i2c_hw = { · 5 unmodified lines | |||
| 848 | .has_multi_master_mode = false, | 855 | .has_multi_master_mode = false, |
| 849 | .has_slcg_override_reg = false, | 856 | .has_slcg_override_reg = false, |
| 850 | .has_mst_fifo = false, | 857 | .has_mst_fifo = false, |
| 858 | .quirks = &tegra_i2c_quirks, | ||
| 851 | }; | 859 | }; |
| 852 | 860 | ||
| 853 | static const struct tegra_i2c_hw_feature tegra30_i2c_hw = { | 861 | static const struct tegra_i2c_hw_feature tegra30_i2c_hw = { |
| @@ -861,6 +869,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_hw = { · 7 unmodified lines | |||
| 861 | .has_multi_master_mode = false, | 869 | .has_multi_master_mode = false, |
| 862 | .has_slcg_override_reg = false, | 870 | .has_slcg_override_reg = false, |
| 863 | .has_mst_fifo = false, | 871 | .has_mst_fifo = false, |
| 872 | .quirks = &tegra_i2c_quirks, | ||
| 864 | }; | 873 | }; |
| 865 | 874 | ||
| 866 | static const struct tegra_i2c_hw_feature tegra114_i2c_hw = { | 875 | static const struct tegra_i2c_hw_feature tegra114_i2c_hw = { |
| @@ -874,6 +883,7 @@ static const struct tegra_i2c_hw_feature tegra114_i2c_hw = { · 7 unmodified lines | |||
| 874 | .has_multi_master_mode = false, | 883 | .has_multi_master_mode = false, |
| 875 | .has_slcg_override_reg = false, | 884 | .has_slcg_override_reg = false, |
| 876 | .has_mst_fifo = false, | 885 | .has_mst_fifo = false, |
| 886 | .quirks = &tegra_i2c_quirks, | ||
| 877 | }; | 887 | }; |
| 878 | 888 | ||
| 879 | static const struct tegra_i2c_hw_feature tegra124_i2c_hw = { | 889 | static const struct tegra_i2c_hw_feature tegra124_i2c_hw = { |
| @@ -887,6 +897,7 @@ static const struct tegra_i2c_hw_feature tegra124_i2c_hw = { · 7 unmodified lines | |||
| 887 | .has_multi_master_mode = false, | 897 | .has_multi_master_mode = false, |
| 888 | .has_slcg_override_reg = true, | 898 | .has_slcg_override_reg = true, |
| 889 | .has_mst_fifo = false, | 899 | .has_mst_fifo = false, |
| 900 | .quirks = &tegra_i2c_quirks, | ||
| 890 | }; | 901 | }; |
| 891 | 902 | ||
| 892 | static const struct tegra_i2c_hw_feature tegra210_i2c_hw = { | 903 | static const struct tegra_i2c_hw_feature tegra210_i2c_hw = { |
| @@ -900,6 +911,7 @@ static const struct tegra_i2c_hw_feature tegra210_i2c_hw = { · 7 unmodified lines | |||
| 900 | .has_multi_master_mode = true, | 911 | .has_multi_master_mode = true, |
| 901 | .has_slcg_override_reg = true, | 912 | .has_slcg_override_reg = true, |
| 902 | .has_mst_fifo = false, | 913 | .has_mst_fifo = false, |
| 914 | .quirks = &tegra_i2c_quirks, | ||
| 903 | }; | 915 | }; |
| 904 | 916 | ||
| 905 | static const struct tegra_i2c_hw_feature tegra194_i2c_hw = { | 917 | static const struct tegra_i2c_hw_feature tegra194_i2c_hw = { |
| @@ -913,6 +925,7 @@ static const struct tegra_i2c_hw_feature tegra194_i2c_hw = { · 7 unmodified lines | |||
| 913 | .has_multi_master_mode = true, | 925 | .has_multi_master_mode = true, |
| 914 | .has_slcg_override_reg = true, | 926 | .has_slcg_override_reg = true, |
| 915 | .has_mst_fifo = true, | 927 | .has_mst_fifo = true, |
| 928 | .quirks = &tegra194_i2c_quirks, | ||
| 916 | }; | 929 | }; |
| 917 | 930 | ||
| 918 | /* Match table for of_platform binding */ | 931 | /* Match table for of_platform binding */ |
| @@ -964,7 +977,6 @@ static int tegra_i2c_probe(struct platform_device *pdev) · 45 unmodified lines | |||
| 964 | i2c_dev->base = base; | 977 | i2c_dev->base = base; |
| 965 | i2c_dev->div_clk = div_clk; | 978 | i2c_dev->div_clk = div_clk; |
| 966 | i2c_dev->adapter.algo = &tegra_i2c_algo; | 979 | i2c_dev->adapter.algo = &tegra_i2c_algo; |
| 967 | i2c_dev->adapter.quirks = &tegra_i2c_quirks; | ||
| 968 | i2c_dev->irq = irq; | 980 | i2c_dev->irq = irq; |
| 969 | i2c_dev->cont_id = pdev->id; | 981 | i2c_dev->cont_id = pdev->id; |
| 970 | i2c_dev->dev = &pdev->dev; | 982 | i2c_dev->dev = &pdev->dev; |
| @@ -980,6 +992,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) · 9 unmodified lines | |||
| 980 | i2c_dev->hw = of_device_get_match_data(&pdev->dev); | 992 | i2c_dev->hw = of_device_get_match_data(&pdev->dev); |
| 981 | i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node, | 993 | i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node, |
| 982 | "nvidia,tegra20-i2c-dvc"); | 994 | "nvidia,tegra20-i2c-dvc"); |
| 995 | i2c_dev->adapter.quirks = i2c_dev->hw->quirks; | ||
| 983 | init_completion(&i2c_dev->msg_complete); | 996 | init_completion(&i2c_dev->msg_complete); |
| 984 | spin_lock_init(&i2c_dev->xfer_lock); | 997 | spin_lock_init(&i2c_dev->xfer_lock); |
| 985 | 998 | ||
| @@ -470,9 +470,15 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · 469 unmodified lines | |||
| 470 | data_arg.data); | 470 | data_arg.data); |
| 471 | } | 471 | } |
| 472 | case I2C_RETRIES: | 472 | case I2C_RETRIES: |
| 473 | if (arg > INT_MAX) | ||
| 474 | return -EINVAL; | ||
| 475 | |||
| 473 | client->adapter->retries = arg; | 476 | client->adapter->retries = arg; |
| 474 | break; | 477 | break; |
| 475 | case I2C_TIMEOUT: | 478 | case I2C_TIMEOUT: |
| 479 | if (arg > INT_MAX) | ||
| 480 | return -EINVAL; | ||
| 481 | |||
| 476 | /* For historical reasons, user-space sets the timeout | 482 | /* For historical reasons, user-space sets the timeout |
| 477 | * value in units of 10 ms. | 483 | * value in units of 10 ms. |
| 478 | */ | 484 | */ |
| @@ -1828,7 +1828,7 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master, · 1827 unmodified lines | |||
| 1828 | 1828 | ||
| 1829 | ret = i3c_master_retrieve_dev_info(newdev); | 1829 | ret = i3c_master_retrieve_dev_info(newdev); |
| 1830 | if (ret) | 1830 | if (ret) |
| 1831 | goto err_free_dev; | 1831 | goto err_detach_dev; |
| 1832 | 1832 | ||
| 1833 | olddev = i3c_master_search_i3c_dev_duplicate(newdev); | 1833 | olddev = i3c_master_search_i3c_dev_duplicate(newdev); |
| 1834 | if (olddev) { | 1834 | if (olddev) { |
| @@ -419,12 +419,9 @@ static void dw_i3c_master_enqueue_xfer(struct dw_i3c_master *master, · 418 unmodified lines | |||
| 419 | spin_unlock_irqrestore(&master->xferqueue.lock, flags); | 419 | spin_unlock_irqrestore(&master->xferqueue.lock, flags); |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | static void dw_i3c_master_dequeue_xfer(struct dw_i3c_master *master, | 422 | static void dw_i3c_master_dequeue_xfer_locked(struct dw_i3c_master *master, |
| 423 | struct dw_i3c_xfer *xfer) | 423 | struct dw_i3c_xfer *xfer) |
| 424 | { | 424 | { |
| 425 | unsigned long flags; | ||
| 426 | |||
| 427 | spin_lock_irqsave(&master->xferqueue.lock, flags); | ||
| 428 | if (master->xferqueue.cur == xfer) { | 425 | if (master->xferqueue.cur == xfer) { |
| 429 | u32 status; | 426 | u32 status; |
| 430 | 427 | ||
| @@ -439,6 +436,15 @@ static void dw_i3c_master_dequeue_xfer(struct dw_i3c_master *master, · 8 unmodified lines | |||
| 439 | } else { | 436 | } else { |
| 440 | list_del_init(&xfer->node); | 437 | list_del_init(&xfer->node); |
| 441 | } | 438 | } |
| 439 | } | ||
| 440 | |||
| 441 | static void dw_i3c_master_dequeue_xfer(struct dw_i3c_master *master, | ||
| 442 | struct dw_i3c_xfer *xfer) | ||
| 443 | { | ||
| 444 | unsigned long flags; | ||
| 445 | |||
| 446 | spin_lock_irqsave(&master->xferqueue.lock, flags); | ||
| 447 | dw_i3c_master_dequeue_xfer_locked(master, xfer); | ||
| 442 | spin_unlock_irqrestore(&master->xferqueue.lock, flags); | 448 | spin_unlock_irqrestore(&master->xferqueue.lock, flags); |
| 443 | } | 449 | } |
| 444 | 450 | ||
| @@ -494,7 +500,7 @@ static void dw_i3c_master_end_xfer_locked(struct dw_i3c_master *master, u32 isr) · 49 unmodified lines | |||
| 494 | complete(&xfer->comp); | 500 | complete(&xfer->comp); |
| 495 | 501 | ||
| 496 | if (ret < 0) { | 502 | if (ret < 0) { |
| 497 | dw_i3c_master_dequeue_xfer(master, xfer); | 503 | dw_i3c_master_dequeue_xfer_locked(master, xfer); |
| 498 | writel(readl(master->regs + DEVICE_CTRL) | DEV_CTRL_RESUME, | 504 | writel(readl(master->regs + DEVICE_CTRL) | DEV_CTRL_RESUME, |
| 499 | master->regs + DEVICE_CTRL); | 505 | master->regs + DEVICE_CTRL); |
| 500 | } | 506 | } |
| @@ -901,9 +907,6 @@ static int dw_i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev, · 400 unmodified lines | |||
| 901 | master->regs + | 907 | master->regs + |
| 902 | DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index)); | 908 | DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index)); |
| 903 | 909 | ||
| 904 | if (!old_dyn_addr) | ||
| 905 | return 0; | ||
| 906 | |||
| 907 | master->addrs[data->index] = dev->info.dyn_addr; | 910 | master->addrs[data->index] = dev->info.dyn_addr; |
| 908 | 911 | ||
| 909 | return 0; | 912 | return 0; |
| @@ -925,11 +928,11 @@ static int dw_i3c_master_attach_i3c_dev(struct i3c_dev_desc *dev) · 15 unmodified lines | |||
| 925 | return -ENOMEM; | 928 | return -ENOMEM; |
| 926 | 929 | ||
| 927 | data->index = pos; | 930 | data->index = pos; |
| 928 | master->addrs[pos] = dev->info.dyn_addr; | 931 | master->addrs[pos] = dev->info.dyn_addr ? : dev->info.static_addr; |
| 929 | master->free_pos &= ~BIT(pos); | 932 | master->free_pos &= ~BIT(pos); |
| 930 | i3c_dev_set_master_data(dev, data); | 933 | i3c_dev_set_master_data(dev, data); |
| 931 | 934 | ||
| 932 | writel(DEV_ADDR_TABLE_DYNAMIC_ADDR(dev->info.dyn_addr), | 935 | writel(DEV_ADDR_TABLE_DYNAMIC_ADDR(master->addrs[pos]), |
| 933 | master->regs + | 936 | master->regs + |
| 934 | DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index)); | 937 | DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index)); |
| 935 | 938 | ||
| @@ -1556,8 +1556,8 @@ static int cdns_i3c_master_probe(struct platform_device *pdev) · 1555 unmodified lines | |||
| 1556 | return PTR_ERR(master->pclk); | 1556 | return PTR_ERR(master->pclk); |
| 1557 | 1557 | ||
| 1558 | master->sysclk = devm_clk_get(&pdev->dev, "sysclk"); | 1558 | master->sysclk = devm_clk_get(&pdev->dev, "sysclk"); |
| 1559 | if (IS_ERR(master->pclk)) | 1559 | if (IS_ERR(master->sysclk)) |
| 1560 | return PTR_ERR(master->pclk); | 1560 | return PTR_ERR(master->sysclk); |
| 1561 | 1561 | ||
| 1562 | irq = platform_get_irq(pdev, 0); | 1562 | irq = platform_get_irq(pdev, 0); |
| 1563 | if (irq < 0) | 1563 | if (irq < 0) |
| @@ -235,21 +235,28 @@ EXPORT_SYMBOL_GPL(ide_prep_sense); · 234 unmodified lines | |||
| 235 | 235 | ||
| 236 | int ide_queue_sense_rq(ide_drive_t *drive, void *special) | 236 | int ide_queue_sense_rq(ide_drive_t *drive, void *special) |
| 237 | { | 237 | { |
| 238 | struct request *sense_rq = drive->sense_rq; | 238 | ide_hwif_t *hwif = drive->hwif; |
| 239 | struct request *sense_rq; | ||
| 240 | unsigned long flags; | ||
| 241 | |||
| 242 | spin_lock_irqsave(&hwif->lock, flags); | ||
| 239 | 243 | ||
| 240 | /* deferred failure from ide_prep_sense() */ | 244 | /* deferred failure from ide_prep_sense() */ |
| 241 | if (!drive->sense_rq_armed) { | 245 | if (!drive->sense_rq_armed) { |
| 242 | printk(KERN_WARNING PFX "%s: error queuing a sense request\n", | 246 | printk(KERN_WARNING PFX "%s: error queuing a sense request\n", |
| 243 | drive->name); | 247 | drive->name); |
| 248 | spin_unlock_irqrestore(&hwif->lock, flags); | ||
| 244 | return -ENOMEM; | 249 | return -ENOMEM; |
| 245 | } | 250 | } |
| 246 | 251 | ||
| 252 | sense_rq = drive->sense_rq; | ||
| 247 | ide_req(sense_rq)->special = special; | 253 | ide_req(sense_rq)->special = special; |
| 248 | drive->sense_rq_armed = false; | 254 | drive->sense_rq_armed = false; |
| 249 | 255 | ||
| 250 | drive->hwif->rq = NULL; | 256 | drive->hwif->rq = NULL; |
| 251 | 257 | ||
| 252 | ide_insert_request_head(drive, sense_rq); | 258 | ide_insert_request_head(drive, sense_rq); |
| 259 | spin_unlock_irqrestore(&hwif->lock, flags); | ||
| 253 | return 0; | 260 | return 0; |
| 254 | } | 261 | } |
| 255 | EXPORT_SYMBOL_GPL(ide_queue_sense_rq); | 262 | EXPORT_SYMBOL_GPL(ide_queue_sense_rq); |
| @@ -68,8 +68,10 @@ int ide_end_rq(ide_drive_t *drive, struct request *rq, blk_status_t error, · 67 unmodified lines | |||
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | if (!blk_update_request(rq, error, nr_bytes)) { | 70 | if (!blk_update_request(rq, error, nr_bytes)) { |
| 71 | if (rq == drive->sense_rq) | 71 | if (rq == drive->sense_rq) { |
| 72 | drive->sense_rq = NULL; | 72 | drive->sense_rq = NULL; |
| 73 | drive->sense_rq_active = false; | ||
| 74 | } | ||
| 73 | 75 | ||
| 74 | __blk_mq_end_request(rq, error); | 76 | __blk_mq_end_request(rq, error); |
| 75 | return 0; | 77 | return 0; |
| @@ -451,16 +453,11 @@ void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq) · 375 unmodified lines | |||
| 451 | blk_mq_delay_run_hw_queue(q->queue_hw_ctx[0], 3); | 453 | blk_mq_delay_run_hw_queue(q->queue_hw_ctx[0], 3); |
| 452 | } | 454 | } |
| 453 | 455 | ||
| 454 | /* | 456 | blk_status_t ide_issue_rq(ide_drive_t *drive, struct request *rq, |
| 455 | * Issue a new request to a device. | 457 | bool local_requeue) |
| 456 | */ | ||
| 457 | blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *hctx, | ||
| 458 | const struct blk_mq_queue_data *bd) | ||
| 459 | { | 458 | { |
| 460 | ide_drive_t *drive = hctx->queue->queuedata; | 459 | ide_hwif_t *hwif = drive->hwif; |
| 461 | ide_hwif_t *hwif = drive->hwif; | ||
| 462 | struct ide_host *host = hwif->host; | 460 | struct ide_host *host = hwif->host; |
| 463 | struct request *rq = bd->rq; | ||
| 464 | ide_startstop_t startstop; | 461 | ide_startstop_t startstop; |
| 465 | 462 | ||
| 466 | if (!blk_rq_is_passthrough(rq) && !(rq->rq_flags & RQF_DONTPREP)) { | 463 | if (!blk_rq_is_passthrough(rq) && !(rq->rq_flags & RQF_DONTPREP)) { |
| @@ -474,8 +471,6 @@ blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *hctx, · 7 unmodified lines | |||
| 474 | if (ide_lock_host(host, hwif)) | 471 | if (ide_lock_host(host, hwif)) |
| 475 | return BLK_STS_DEV_RESOURCE; | 472 | return BLK_STS_DEV_RESOURCE; |
| 476 | 473 | ||
| 477 | blk_mq_start_request(rq); | ||
| 478 | |||
| 479 | spin_lock_irq(&hwif->lock); | 474 | spin_lock_irq(&hwif->lock); |
| 480 | 475 | ||
| 481 | if (!ide_lock_port(hwif)) { | 476 | if (!ide_lock_port(hwif)) { |
| @@ -510,18 +505,6 @@ repeat: · 28 unmodified lines | |||
| 510 | hwif->cur_dev = drive; | 505 | hwif->cur_dev = drive; |
| 511 | drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED); | 506 | drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED); |
| 512 | 507 | ||
| 513 | /* | ||
| 514 | * we know that the queue isn't empty, but this can happen | ||
| 515 | * if ->prep_rq() decides to kill a request | ||
| 516 | */ | ||
| 517 | if (!rq) { | ||
| 518 | rq = bd->rq; | ||
| 519 | if (!rq) { | ||
| 520 | ide_unlock_port(hwif); | ||
| 521 | goto out; | ||
| 522 | } | ||
| 523 | } | ||
| 524 | |||
| 525 | /* | 508 | /* |
| 526 | * Sanity: don't accept a request that isn't a PM request | 509 | * Sanity: don't accept a request that isn't a PM request |
| 527 | * if we are currently power managed. This is very important as | 510 | * if we are currently power managed. This is very important as |
| @@ -560,9 +543,12 @@ repeat: · 32 unmodified lines | |||
| 560 | } | 543 | } |
| 561 | } else { | 544 | } else { |
| 562 | plug_device: | 545 | plug_device: |
| 546 | if (local_requeue) | ||
| 547 | list_add(&rq->queuelist, &drive->rq_list); | ||
| 563 | spin_unlock_irq(&hwif->lock); | 548 | spin_unlock_irq(&hwif->lock); |
| 564 | ide_unlock_host(host); | 549 | ide_unlock_host(host); |
| 565 | ide_requeue_and_plug(drive, rq); | 550 | if (!local_requeue) |
| 551 | ide_requeue_and_plug(drive, rq); | ||
| 566 | return BLK_STS_OK; | 552 | return BLK_STS_OK; |
| 567 | } | 553 | } |
| 568 | 554 | ||
| @@ -573,6 +559,26 @@ out: · 4 unmodified lines | |||
| 573 | return BLK_STS_OK; | 559 | return BLK_STS_OK; |
| 574 | } | 560 | } |
| 575 | 561 | ||
| 562 | /* | ||
| 563 | * Issue a new request to a device. | ||
| 564 | */ | ||
| 565 | blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *hctx, | ||
| 566 | const struct blk_mq_queue_data *bd) | ||
| 567 | { | ||
| 568 | ide_drive_t *drive = hctx->queue->queuedata; | ||
| 569 | ide_hwif_t *hwif = drive->hwif; | ||
| 570 | |||
| 571 | spin_lock_irq(&hwif->lock); | ||
| 572 | if (drive->sense_rq_active) { | ||
| 573 | spin_unlock_irq(&hwif->lock); | ||
| 574 | return BLK_STS_DEV_RESOURCE; | ||
| 575 | } | ||
| 576 | spin_unlock_irq(&hwif->lock); | ||
| 577 | |||
| 578 | blk_mq_start_request(bd->rq); | ||
| 579 | return ide_issue_rq(drive, bd->rq, false); | ||
| 580 | } | ||
| 581 | |||
| 576 | static int drive_is_ready(ide_drive_t *drive) | 582 | static int drive_is_ready(ide_drive_t *drive) |
| 577 | { | 583 | { |
| 578 | ide_hwif_t *hwif = drive->hwif; | 584 | ide_hwif_t *hwif = drive->hwif; |
| @@ -893,13 +899,8 @@ EXPORT_SYMBOL_GPL(ide_pad_transfer); · 314 unmodified lines | |||
| 893 | 899 | ||
| 894 | void ide_insert_request_head(ide_drive_t *drive, struct request *rq) | 900 | void ide_insert_request_head(ide_drive_t *drive, struct request *rq) |
| 895 | { | 901 | { |
| 896 | ide_hwif_t *hwif = drive->hwif; | 902 | drive->sense_rq_active = true; |
| 897 | unsigned long flags; | ||
| 898 | |||
| 899 | spin_lock_irqsave(&hwif->lock, flags); | ||
| 900 | list_add_tail(&rq->queuelist, &drive->rq_list); | 903 | list_add_tail(&rq->queuelist, &drive->rq_list); |
| 901 | spin_unlock_irqrestore(&hwif->lock, flags); | ||
| 902 | |||
| 903 | kblockd_schedule_work(&drive->rq_work); | 904 | kblockd_schedule_work(&drive->rq_work); |
| 904 | } | 905 | } |
| 905 | EXPORT_SYMBOL_GPL(ide_insert_request_head); | 906 | EXPORT_SYMBOL_GPL(ide_insert_request_head); |
| @@ -54,7 +54,9 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) · 53 unmodified lines | |||
| 54 | scsi_req(rq)->cmd[0] = REQ_UNPARK_HEADS; | 54 | scsi_req(rq)->cmd[0] = REQ_UNPARK_HEADS; |
| 55 | scsi_req(rq)->cmd_len = 1; | 55 | scsi_req(rq)->cmd_len = 1; |
| 56 | ide_req(rq)->type = ATA_PRIV_MISC; | 56 | ide_req(rq)->type = ATA_PRIV_MISC; |
| 57 | spin_lock_irq(&hwif->lock); | ||
| 57 | ide_insert_request_head(drive, rq); | 58 | ide_insert_request_head(drive, rq); |
| 59 | spin_unlock_irq(&hwif->lock); | ||
| 58 | 60 | ||
| 59 | out: | 61 | out: |
| 60 | return; | 62 | return; |
| @@ -1159,18 +1159,27 @@ static void drive_rq_insert_work(struct work_struct *work) · 1158 unmodified lines | |||
| 1159 | ide_drive_t *drive = container_of(work, ide_drive_t, rq_work); | 1159 | ide_drive_t *drive = container_of(work, ide_drive_t, rq_work); |
| 1160 | ide_hwif_t *hwif = drive->hwif; | 1160 | ide_hwif_t *hwif = drive->hwif; |
| 1161 | struct request *rq; | 1161 | struct request *rq; |
| 1162 | blk_status_t ret; | ||
| 1162 | LIST_HEAD(list); | 1163 | LIST_HEAD(list); |
| 1163 | 1164 | ||
| 1164 | spin_lock_irq(&hwif->lock); | 1165 | blk_mq_quiesce_queue(drive->queue); |
| 1165 | if (!list_empty(&drive->rq_list)) | ||
| 1166 | list_splice_init(&drive->rq_list, &list); | ||
| 1167 | spin_unlock_irq(&hwif->lock); | ||
| 1168 | 1166 | ||
| 1169 | while (!list_empty(&list)) { | 1167 | ret = BLK_STS_OK; |
| 1170 | rq = list_first_entry(&list, struct request, queuelist); | 1168 | spin_lock_irq(&hwif->lock); |
| 1169 | while (!list_empty(&drive->rq_list)) { | ||
| 1170 | rq = list_first_entry(&drive->rq_list, struct request, queuelist); | ||
| 1171 | list_del_init(&rq->queuelist); | 1171 | list_del_init(&rq->queuelist); |
| 1172 | blk_execute_rq_nowait(drive->queue, rq->rq_disk, rq, true, NULL); | 1172 | |
| 1173 | spin_unlock_irq(&hwif->lock); | ||
| 1174 | ret = ide_issue_rq(drive, rq, true); | ||
| 1175 | spin_lock_irq(&hwif->lock); | ||
| 1173 | } | 1176 | } |
| 1177 | spin_unlock_irq(&hwif->lock); | ||
| 1178 | |||
| 1179 | blk_mq_unquiesce_queue(drive->queue); | ||
| 1180 | |||
| 1181 | if (ret != BLK_STS_OK) | ||
| 1182 | kblockd_schedule_work(&drive->rq_work); | ||
| 1174 | } | 1183 | } |
| 1175 | 1184 | ||
| 1176 | static const u8 ide_hwif_to_major[] = | 1185 | static const u8 ide_hwif_to_major[] = |
| @@ -544,7 +544,7 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif) · 543 unmodified lines | |||
| 544 | drive->proc = proc_mkdir(drive->name, parent); | 544 | drive->proc = proc_mkdir(drive->name, parent); |
| 545 | if (drive->proc) { | 545 | if (drive->proc) { |
| 546 | ide_add_proc_entries(drive->proc, generic_drive_entries, drive); | 546 | ide_add_proc_entries(drive->proc, generic_drive_entries, drive); |
| 547 | proc_create_data("setting", S_IFREG|S_IRUSR|S_IWUSR, | 547 | proc_create_data("settings", S_IFREG|S_IRUSR|S_IWUSR, |
| 548 | drive->proc, &ide_settings_proc_fops, | 548 | drive->proc, &ide_settings_proc_fops, |
| 549 | drive); | 549 | drive); |
| 550 | } | 550 | } |
| @@ -27,9 +27,18 @@ · 26 unmodified lines | |||
| 27 | #include <linux/iio/machine.h> | 27 | #include <linux/iio/machine.h> |
| 28 | #include <linux/iio/driver.h> | 28 | #include <linux/iio/driver.h> |
| 29 | 29 | ||
| 30 | #define AXP288_ADC_EN_MASK 0xF1 | 30 | /* |
| 31 | #define AXP288_ADC_TS_PIN_GPADC 0xF2 | 31 | * This mask enables all ADCs except for the battery temp-sensor (TS), that is |
| 32 | #define AXP288_ADC_TS_PIN_ON 0xF3 | 32 | * left as-is to avoid breaking charging on devices without a temp-sensor. |
| 33 | */ | ||
| 34 | #define AXP288_ADC_EN_MASK 0xF0 | ||
| 35 | #define AXP288_ADC_TS_ENABLE 0x01 | ||
| 36 | |||
| 37 | #define AXP288_ADC_TS_CURRENT_ON_OFF_MASK GENMASK(1, 0) | ||
| 38 | #define AXP288_ADC_TS_CURRENT_OFF (0 << 0) | ||
| 39 | #define AXP288_ADC_TS_CURRENT_ON_WHEN_CHARGING (1 << 0) | ||
| 40 | #define AXP288_ADC_TS_CURRENT_ON_ONDEMAND (2 << 0) | ||
| 41 | #define AXP288_ADC_TS_CURRENT_ON (3 << 0) | ||
| 33 | 42 | ||
| 34 | enum axp288_adc_id { | 43 | enum axp288_adc_id { |
| 35 | AXP288_ADC_TS, | 44 | AXP288_ADC_TS, |
| @@ -44,6 +53,7 @@ enum axp288_adc_id { · 8 unmodified lines | |||
| 44 | struct axp288_adc_info { | 53 | struct axp288_adc_info { |
| 45 | int irq; | 54 | int irq; |
| 46 | struct regmap *regmap; | 55 | struct regmap *regmap; |
| 56 | bool ts_enabled; | ||
| 47 | }; | 57 | }; |
| 48 | 58 | ||
| 49 | static const struct iio_chan_spec axp288_adc_channels[] = { | 59 | static const struct iio_chan_spec axp288_adc_channels[] = { |
| @@ -115,21 +125,33 @@ static int axp288_adc_read_channel(int *val, unsigned long address, · 65 unmodified lines | |||
| 115 | return IIO_VAL_INT; | 125 | return IIO_VAL_INT; |
| 116 | } | 126 | } |
| 117 | 127 | ||
| 118 | static int axp288_adc_set_ts(struct regmap *regmap, unsigned int mode, | 128 | /* |
| 119 | unsigned long address) | 129 | * The current-source used for the battery temp-sensor (TS) is shared |
| 130 | * with the GPADC. For proper fuel-gauge and charger operation the TS | ||
| 131 | * current-source needs to be permanently on. But to read the GPADC we | ||
| 132 | * need to temporary switch the TS current-source to ondemand, so that | ||
| 133 | * the GPADC can use it, otherwise we will always read an all 0 value. | ||
| 134 | */ | ||
| 135 | static int axp288_adc_set_ts(struct axp288_adc_info *info, | ||
| 136 | unsigned int mode, unsigned long address) | ||
| 120 | { | 137 | { |
| 121 | int ret; | 138 | int ret; |
| 122 | 139 | ||
| 123 | /* channels other than GPADC do not need to switch TS pin */ | 140 | /* No need to switch the current-source if the TS pin is disabled */ |
| 141 | if (!info->ts_enabled) | ||
| 142 | return 0; | ||
| 143 | |||
| 144 | /* Channels other than GPADC do not need the current source */ | ||
| 124 | if (address != AXP288_GP_ADC_H) | 145 | if (address != AXP288_GP_ADC_H) |
| 125 | return 0; | 146 | return 0; |
| 126 | 147 | ||
| 127 | ret = regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, mode); | 148 | ret = regmap_update_bits(info->regmap, AXP288_ADC_TS_PIN_CTRL, |
| 149 | AXP288_ADC_TS_CURRENT_ON_OFF_MASK, mode); | ||
| 128 | if (ret) | 150 | if (ret) |
| 129 | return ret; | 151 | return ret; |
| 130 | 152 | ||
| 131 | /* When switching to the GPADC pin give things some time to settle */ | 153 | /* When switching to the GPADC pin give things some time to settle */ |
| 132 | if (mode == AXP288_ADC_TS_PIN_GPADC) | 154 | if (mode == AXP288_ADC_TS_CURRENT_ON_ONDEMAND) |
| 133 | usleep_range(6000, 10000); | 155 | usleep_range(6000, 10000); |
| 134 | 156 | ||
| 135 | return 0; | 157 | return 0; |
| @@ -145,14 +167,14 @@ static int axp288_adc_read_raw(struct iio_dev *indio_dev, · 9 unmodified lines | |||
| 145 | mutex_lock(&indio_dev->mlock); | 167 | mutex_lock(&indio_dev->mlock); |
| 146 | switch (mask) { | 168 | switch (mask) { |
| 147 | case IIO_CHAN_INFO_RAW: | 169 | case IIO_CHAN_INFO_RAW: |
| 148 | if (axp288_adc_set_ts(info->regmap, AXP288_ADC_TS_PIN_GPADC, | 170 | if (axp288_adc_set_ts(info, AXP288_ADC_TS_CURRENT_ON_ONDEMAND, |
| 149 | chan->address)) { | 171 | chan->address)) { |
| 150 | dev_err(&indio_dev->dev, "GPADC mode\n"); | 172 | dev_err(&indio_dev->dev, "GPADC mode\n"); |
| 151 | ret = -EINVAL; | 173 | ret = -EINVAL; |
| 152 | break; | 174 | break; |
| 153 | } | 175 | } |
| 154 | ret = axp288_adc_read_channel(val, chan->address, info->regmap); | 176 | ret = axp288_adc_read_channel(val, chan->address, info->regmap); |
| 155 | if (axp288_adc_set_ts(info->regmap, AXP288_ADC_TS_PIN_ON, | 177 | if (axp288_adc_set_ts(info, AXP288_ADC_TS_CURRENT_ON, |
| 156 | chan->address)) | 178 | chan->address)) |
| 157 | dev_err(&indio_dev->dev, "TS pin restore\n"); | 179 | dev_err(&indio_dev->dev, "TS pin restore\n"); |
| 158 | break; | 180 | break; |
| @@ -164,13 +186,35 @@ static int axp288_adc_read_raw(struct iio_dev *indio_dev, · 5 unmodified lines | |||
| 164 | return ret; | 186 | return ret; |
| 165 | } | 187 | } |
| 166 | 188 | ||
| 167 | static int axp288_adc_set_state(struct regmap *regmap) | 189 | static int axp288_adc_initialize(struct axp288_adc_info *info) |
| 168 | { | 190 | { |
| 169 | /* ADC should be always enabled for internal FG to function */ | 191 | int ret, adc_enable_val; |
| 170 | if (regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, AXP288_ADC_TS_PIN_ON)) | 192 | |
| 171 | return -EIO; | 193 | /* |
| 194 | * Determine if the TS pin is enabled and set the TS current-source | ||
| 195 | * accordingly. | ||
| 196 | */ | ||
| 197 | ret = regmap_read(info->regmap, AXP20X_ADC_EN1, &adc_enable_val); | ||
| 198 | if (ret) | ||
| 199 | return ret; | ||
| 200 | |||
| 201 | if (adc_enable_val & AXP288_ADC_TS_ENABLE) { | ||
| 202 | info->ts_enabled = true; | ||
| 203 | ret = regmap_update_bits(info->regmap, AXP288_ADC_TS_PIN_CTRL, | ||
| 204 | AXP288_ADC_TS_CURRENT_ON_OFF_MASK, | ||
| 205 | AXP288_ADC_TS_CURRENT_ON); | ||
| 206 | } else { | ||
| 207 | info->ts_enabled = false; | ||
| 208 | ret = regmap_update_bits(info->regmap, AXP288_ADC_TS_PIN_CTRL, | ||
| 209 | AXP288_ADC_TS_CURRENT_ON_OFF_MASK, | ||
| 210 | AXP288_ADC_TS_CURRENT_OFF); | ||
| 211 | } | ||
| 212 | if (ret) | ||
| 213 | return ret; | ||
| 172 | 214 | ||
| 173 | return regmap_write(regmap, AXP20X_ADC_EN1, AXP288_ADC_EN_MASK); | 215 | /* Turn on the ADC for all channels except TS, leave TS as is */ |
| 216 | return regmap_update_bits(info->regmap, AXP20X_ADC_EN1, | ||
| 217 | AXP288_ADC_EN_MASK, AXP288_ADC_EN_MASK); | ||
| 174 | } | 218 | } |
| 175 | 219 | ||
| 176 | static const struct iio_info axp288_adc_iio_info = { | 220 | static const struct iio_info axp288_adc_iio_info = { |
| @@ -200,7 +244,7 @@ static int axp288_adc_probe(struct platform_device *pdev) · 23 unmodified lines | |||
| 200 | * Set ADC to enabled state at all time, including system suspend. | 244 | * Set ADC to enabled state at all time, including system suspend. |
| 201 | * otherwise internal fuel gauge functionality may be affected. | 245 | * otherwise internal fuel gauge functionality may be affected. |
| 202 | */ | 246 | */ |
| 203 | ret = axp288_adc_set_state(axp20x->regmap); | 247 | ret = axp288_adc_initialize(info); |
| 204 | if (ret) { | 248 | if (ret) { |
| 205 | dev_err(&pdev->dev, "unable to enable ADC device\n"); | 249 | dev_err(&pdev->dev, "unable to enable ADC device\n"); |
| 206 | return ret; | 250 | return ret; |
| @@ -41,6 +41,7 @@ · 40 unmodified lines | |||
| 41 | 41 | ||
| 42 | #define ADS8688_VREF_MV 4096 | 42 | #define ADS8688_VREF_MV 4096 |
| 43 | #define ADS8688_REALBITS 16 | 43 | #define ADS8688_REALBITS 16 |
| 44 | #define ADS8688_MAX_CHANNELS 8 | ||
| 44 | 45 | ||
| 45 | /* | 46 | /* |
| 46 | * enum ads8688_range - ADS8688 reference voltage range | 47 | * enum ads8688_range - ADS8688 reference voltage range |
| @@ -385,7 +386,7 @@ static irqreturn_t ads8688_trigger_handler(int irq, void *p) · 338 unmodified lines | |||
| 385 | { | 386 | { |
| 386 | struct iio_poll_func *pf = p; | 387 | struct iio_poll_func *pf = p; |
| 387 | struct iio_dev *indio_dev = pf->indio_dev; | 388 | struct iio_dev *indio_dev = pf->indio_dev; |
| 388 | u16 buffer[8]; | 389 | u16 buffer[ADS8688_MAX_CHANNELS + sizeof(s64)/sizeof(u16)]; |
| 389 | int i, j = 0; | 390 | int i, j = 0; |
| 390 | 391 | ||
| 391 | for (i = 0; i < indio_dev->masklength; i++) { | 392 | for (i = 0; i < indio_dev->masklength; i++) { |
| @@ -142,7 +142,10 @@ static void tiadc_step_config(struct iio_dev *indio_dev) · 141 unmodified lines | |||
| 142 | stepconfig |= STEPCONFIG_MODE_SWCNT; | 142 | stepconfig |= STEPCONFIG_MODE_SWCNT; |
| 143 | 143 | ||
| 144 | tiadc_writel(adc_dev, REG_STEPCONFIG(steps), | 144 | tiadc_writel(adc_dev, REG_STEPCONFIG(steps), |
| 145 | stepconfig | STEPCONFIG_INP(chan)); | 145 | stepconfig | STEPCONFIG_INP(chan) | |
| 146 | STEPCONFIG_INM_ADCREFM | | ||
| 147 | STEPCONFIG_RFP_VREFP | | ||
| 148 | STEPCONFIG_RFM_VREFN); | ||
| 146 | 149 | ||
| 147 | if (adc_dev->open_delay[i] > STEPDELAY_OPEN_MASK) { | 150 | if (adc_dev->open_delay[i] > STEPDELAY_OPEN_MASK) { |
| 148 | dev_warn(dev, "chan %d open delay truncating to 0x3FFFF\n", | 151 | dev_warn(dev, "chan %d open delay truncating to 0x3FFFF\n", |
| @@ -444,9 +444,8 @@ static int atlas_read_raw(struct iio_dev *indio_dev, · 443 unmodified lines | |||
| 444 | case IIO_CHAN_INFO_SCALE: | 444 | case IIO_CHAN_INFO_SCALE: |
| 445 | switch (chan->type) { | 445 | switch (chan->type) { |
| 446 | case IIO_TEMP: | 446 | case IIO_TEMP: |
| 447 | *val = 1; /* 0.01 */ | 447 | *val = 10; |
| 448 | *val2 = 100; | 448 | return IIO_VAL_INT; |
| 449 | break; | ||
| 450 | case IIO_PH: | 449 | case IIO_PH: |
| 451 | *val = 1; /* 0.001 */ | 450 | *val = 1; /* 0.001 */ |
| 452 | *val2 = 1000; | 451 | *val2 = 1000; |
| @@ -477,7 +476,7 @@ static int atlas_write_raw(struct iio_dev *indio_dev, · 24 unmodified lines | |||
| 477 | int val, int val2, long mask) | 476 | int val, int val2, long mask) |
| 478 | { | 477 | { |
| 479 | struct atlas_data *data = iio_priv(indio_dev); | 478 | struct atlas_data *data = iio_priv(indio_dev); |
| 480 | __be32 reg = cpu_to_be32(val); | 479 | __be32 reg = cpu_to_be32(val / 10); |
| 481 | 480 | ||
| 482 | if (val2 != 0 || val < 0 || val > 20000) | 481 | if (val2 != 0 || val < 0 || val > 20000) |
| 483 | return -EINVAL; | 482 | return -EINVAL; |
| @@ -494,7 +494,10 @@ static void _cma_attach_to_dev(struct rdma_id_private *id_priv, · 493 unmodified lines | |||
| 494 | id_priv->id.route.addr.dev_addr.transport = | 494 | id_priv->id.route.addr.dev_addr.transport = |
| 495 | rdma_node_get_transport(cma_dev->device->node_type); | 495 | rdma_node_get_transport(cma_dev->device->node_type); |
| 496 | list_add_tail(&id_priv->list, &cma_dev->id_list); | 496 | list_add_tail(&id_priv->list, &cma_dev->id_list); |
| 497 | rdma_restrack_kadd(&id_priv->res); | 497 | if (id_priv->res.kern_name) |
| 498 | rdma_restrack_kadd(&id_priv->res); | ||
| 499 | else | ||
| 500 | rdma_restrack_uadd(&id_priv->res); | ||
| 498 | } | 501 | } |
| 499 | 502 | ||
| 500 | static void cma_attach_to_dev(struct rdma_id_private *id_priv, | 503 | static void cma_attach_to_dev(struct rdma_id_private *id_priv, |
| @@ -267,7 +267,6 @@ static inline int ib_mad_enforce_security(struct ib_mad_agent_private *map, · 266 unmodified lines | |||
| 267 | #endif | 267 | #endif |
| 268 | 268 | ||
| 269 | struct ib_device *ib_device_get_by_index(u32 ifindex); | 269 | struct ib_device *ib_device_get_by_index(u32 ifindex); |
| 270 | void ib_device_put(struct ib_device *device); | ||
| 271 | /* RDMA device netlink */ | 270 | /* RDMA device netlink */ |
| 272 | void nldev_init(void); | 271 | void nldev_init(void); |
| 273 | void nldev_exit(void); | 272 | void nldev_exit(void); |
| @@ -156,19 +156,26 @@ struct ib_device *ib_device_get_by_index(u32 index) · 155 unmodified lines | |||
| 156 | down_read(&lists_rwsem); | 156 | down_read(&lists_rwsem); |
| 157 | device = __ib_device_get_by_index(index); | 157 | device = __ib_device_get_by_index(index); |
| 158 | if (device) { | 158 | if (device) { |
| 159 | /* Do not return a device if unregistration has started. */ | 159 | if (!ib_device_try_get(device)) |
| 160 | if (!refcount_inc_not_zero(&device->refcount)) | ||
| 161 | device = NULL; | 160 | device = NULL; |
| 162 | } | 161 | } |
| 163 | up_read(&lists_rwsem); | 162 | up_read(&lists_rwsem); |
| 164 | return device; | 163 | return device; |
| 165 | } | 164 | } |
| 166 | 165 | ||
| 166 | /** | ||
| 167 | * ib_device_put - Release IB device reference | ||
| 168 | * @device: device whose reference to be released | ||
| 169 | * | ||
| 170 | * ib_device_put() releases reference to the IB device to allow it to be | ||
| 171 | * unregistered and eventually free. | ||
| 172 | */ | ||
| 167 | void ib_device_put(struct ib_device *device) | 173 | void ib_device_put(struct ib_device *device) |
| 168 | { | 174 | { |
| 169 | if (refcount_dec_and_test(&device->refcount)) | 175 | if (refcount_dec_and_test(&device->refcount)) |
| 170 | complete(&device->unreg_completion); | 176 | complete(&device->unreg_completion); |
| 171 | } | 177 | } |
| 178 | EXPORT_SYMBOL(ib_device_put); | ||
| 172 | 179 | ||
| 173 | static struct ib_device *__ib_device_get_by_name(const char *name) | 180 | static struct ib_device *__ib_device_get_by_name(const char *name) |
| 174 | { | 181 | { |
| @@ -303,7 +310,6 @@ struct ib_device *ib_alloc_device(size_t size) · 128 unmodified lines | |||
| 303 | rwlock_init(&device->client_data_lock); | 310 | rwlock_init(&device->client_data_lock); |
| 304 | INIT_LIST_HEAD(&device->client_data_list); | 311 | INIT_LIST_HEAD(&device->client_data_list); |
| 305 | INIT_LIST_HEAD(&device->port_list); | 312 | INIT_LIST_HEAD(&device->port_list); |
| 306 | refcount_set(&device->refcount, 1); | ||
| 307 | init_completion(&device->unreg_completion); | 313 | init_completion(&device->unreg_completion); |
| 308 | 314 | ||
| 309 | return device; | 315 | return device; |
| @@ -620,6 +626,7 @@ int ib_register_device(struct ib_device *device, const char *name, · 310 unmodified lines | |||
| 620 | goto cg_cleanup; | 626 | goto cg_cleanup; |
| 621 | } | 627 | } |
| 622 | 628 | ||
| 629 | refcount_set(&device->refcount, 1); | ||
| 623 | device->reg_state = IB_DEV_REGISTERED; | 630 | device->reg_state = IB_DEV_REGISTERED; |
| 624 | 631 | ||
| 625 | list_for_each_entry(client, &client_list, list) | 632 | list_for_each_entry(client, &client_list, list) |
| @@ -584,10 +584,6 @@ static int fill_res_pd_entry(struct sk_buff *msg, struct netlink_callback *cb, · 583 unmodified lines | |||
| 584 | if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_RES_USECNT, | 584 | if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_RES_USECNT, |
| 585 | atomic_read(&pd->usecnt), RDMA_NLDEV_ATTR_PAD)) | 585 | atomic_read(&pd->usecnt), RDMA_NLDEV_ATTR_PAD)) |
| 586 | goto err; | 586 | goto err; |
| 587 | if ((pd->flags & IB_PD_UNSAFE_GLOBAL_RKEY) && | ||
| 588 | nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY, | ||
| 589 | pd->unsafe_global_rkey)) | ||
| 590 | goto err; | ||
| 591 | 587 | ||
| 592 | if (fill_res_name_pid(msg, res)) | 588 | if (fill_res_name_pid(msg, res)) |
| 593 | goto err; | 589 | goto err; |
| @@ -106,6 +106,8 @@ int uverbs_finalize_object(struct ib_uobject *uobj, · 105 unmodified lines | |||
| 106 | enum uverbs_obj_access access, | 106 | enum uverbs_obj_access access, |
| 107 | bool commit); | 107 | bool commit); |
| 108 | 108 | ||
| 109 | int uverbs_output_written(const struct uverbs_attr_bundle *bundle, size_t idx); | ||
| 110 | |||
| 109 | void setup_ufile_idr_uobject(struct ib_uverbs_file *ufile); | 111 | void setup_ufile_idr_uobject(struct ib_uverbs_file *ufile); |
| 110 | void release_ufile_idr_uobject(struct ib_uverbs_file *ufile); | 112 | void release_ufile_idr_uobject(struct ib_uverbs_file *ufile); |
| 111 | 113 | ||
| @@ -352,6 +352,8 @@ struct ib_umem_odp *ib_alloc_odp_umem(struct ib_ucontext_per_mm *per_mm, · 351 unmodified lines | |||
| 352 | umem->writable = 1; | 352 | umem->writable = 1; |
| 353 | umem->is_odp = 1; | 353 | umem->is_odp = 1; |
| 354 | odp_data->per_mm = per_mm; | 354 | odp_data->per_mm = per_mm; |
| 355 | umem->owning_mm = per_mm->mm; | ||
| 356 | mmgrab(umem->owning_mm); | ||
| 355 | 357 | ||
| 356 | mutex_init(&odp_data->umem_mutex); | 358 | mutex_init(&odp_data->umem_mutex); |
| 357 | init_completion(&odp_data->notifier_completion); | 359 | init_completion(&odp_data->notifier_completion); |
| @@ -384,6 +386,7 @@ struct ib_umem_odp *ib_alloc_odp_umem(struct ib_ucontext_per_mm *per_mm, · 26 unmodified lines | |||
| 384 | out_page_list: | 386 | out_page_list: |
| 385 | vfree(odp_data->page_list); | 387 | vfree(odp_data->page_list); |
| 386 | out_odp_data: | 388 | out_odp_data: |
| 389 | mmdrop(umem->owning_mm); | ||
| 387 | kfree(odp_data); | 390 | kfree(odp_data); |
| 388 | return ERR_PTR(ret); | 391 | return ERR_PTR(ret); |
| 389 | } | 392 | } |
| @@ -60,6 +60,10 @@ static int uverbs_response(struct uverbs_attr_bundle *attrs, const void *resp, · 59 unmodified lines | |||
| 60 | { | 60 | { |
| 61 | int ret; | 61 | int ret; |
| 62 | 62 | ||
| 63 | if (uverbs_attr_is_valid(attrs, UVERBS_ATTR_CORE_OUT)) | ||
| 64 | return uverbs_copy_to_struct_or_zero( | ||
| 65 | attrs, UVERBS_ATTR_CORE_OUT, resp, resp_len); | ||
| 66 | |||
| 63 | if (copy_to_user(attrs->ucore.outbuf, resp, | 67 | if (copy_to_user(attrs->ucore.outbuf, resp, |
| 64 | min(attrs->ucore.outlen, resp_len))) | 68 | min(attrs->ucore.outlen, resp_len))) |
| 65 | return -EFAULT; | 69 | return -EFAULT; |
| @@ -1181,6 +1185,9 @@ static int ib_uverbs_poll_cq(struct uverbs_attr_bundle *attrs) · 1115 unmodified lines | |||
| 1181 | goto out_put; | 1185 | goto out_put; |
| 1182 | } | 1186 | } |
| 1183 | 1187 | ||
| 1188 | if (uverbs_attr_is_valid(attrs, UVERBS_ATTR_CORE_OUT)) | ||
| 1189 | ret = uverbs_output_written(attrs, UVERBS_ATTR_CORE_OUT); | ||
| 1190 | |||
| 1184 | ret = 0; | 1191 | ret = 0; |
| 1185 | 1192 | ||
| 1186 | out_put: | 1193 | out_put: |
| @@ -2012,8 +2019,10 @@ static int ib_uverbs_post_send(struct uverbs_attr_bundle *attrs) · 825 unmodified lines | |||
| 2012 | return -ENOMEM; | 2019 | return -ENOMEM; |
| 2013 | 2020 | ||
| 2014 | qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs); | 2021 | qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs); |
| 2015 | if (!qp) | 2022 | if (!qp) { |
| 2023 | ret = -EINVAL; | ||
| 2016 | goto out; | 2024 | goto out; |
| 2025 | } | ||
| 2017 | 2026 | ||
| 2018 | is_ud = qp->qp_type == IB_QPT_UD; | 2027 | is_ud = qp->qp_type == IB_QPT_UD; |
| 2019 | sg_ind = 0; | 2028 | sg_ind = 0; |
| @@ -144,6 +144,21 @@ static bool uverbs_is_attr_cleared(const struct ib_uverbs_attr *uattr, · 143 unmodified lines | |||
| 144 | 0, uattr->len - len); | 144 | 0, uattr->len - len); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | static int uverbs_set_output(const struct uverbs_attr_bundle *bundle, | ||
| 148 | const struct uverbs_attr *attr) | ||
| 149 | { | ||
| 150 | struct bundle_priv *pbundle = | ||
| 151 | container_of(bundle, struct bundle_priv, bundle); | ||
| 152 | u16 flags; | ||
| 153 | |||
| 154 | flags = pbundle->uattrs[attr->ptr_attr.uattr_idx].flags | | ||
| 155 | UVERBS_ATTR_F_VALID_OUTPUT; | ||
| 156 | if (put_user(flags, | ||
| 157 | &pbundle->user_attrs[attr->ptr_attr.uattr_idx].flags)) | ||
| 158 | return -EFAULT; | ||
| 159 | return 0; | ||
| 160 | } | ||
| 161 | |||
| 147 | static int uverbs_process_idrs_array(struct bundle_priv *pbundle, | 162 | static int uverbs_process_idrs_array(struct bundle_priv *pbundle, |
| 148 | const struct uverbs_api_attr *attr_uapi, | 163 | const struct uverbs_api_attr *attr_uapi, |
| 149 | struct uverbs_objs_arr_attr *attr, | 164 | struct uverbs_objs_arr_attr *attr, |
| @@ -455,6 +470,19 @@ static int ib_uverbs_run_method(struct bundle_priv *pbundle, · 305 unmodified lines | |||
| 455 | ret = handler(&pbundle->bundle); | 470 | ret = handler(&pbundle->bundle); |
| 456 | } | 471 | } |
| 457 | 472 | ||
| 473 | /* | ||
| 474 | * Until the drivers are revised to use the bundle directly we have to | ||
| 475 | * assume that the driver wrote to its UHW_OUT and flag userspace | ||
| 476 | * appropriately. | ||
| 477 | */ | ||
| 478 | if (!ret && pbundle->method_elm->has_udata) { | ||
| 479 | const struct uverbs_attr *attr = | ||
| 480 | uverbs_attr_get(&pbundle->bundle, UVERBS_ATTR_UHW_OUT); | ||
| 481 | |||
| 482 | if (!IS_ERR(attr)) | ||
| 483 | ret = uverbs_set_output(&pbundle->bundle, attr); | ||
| 484 | } | ||
| 485 | |||
| 458 | /* | 486 | /* |
| 459 | * EPROTONOSUPPORT is ONLY to be returned if the ioctl framework can | 487 | * EPROTONOSUPPORT is ONLY to be returned if the ioctl framework can |
| 460 | * not invoke the method because the request is not supported. No | 488 | * not invoke the method because the request is not supported. No |
| @@ -706,10 +734,7 @@ void uverbs_fill_udata(struct uverbs_attr_bundle *bundle, · 245 unmodified lines | |||
| 706 | int uverbs_copy_to(const struct uverbs_attr_bundle *bundle, size_t idx, | 734 | int uverbs_copy_to(const struct uverbs_attr_bundle *bundle, size_t idx, |
| 707 | const void *from, size_t size) | 735 | const void *from, size_t size) |
| 708 | { | 736 | { |
| 709 | struct bundle_priv *pbundle = | ||
| 710 | container_of(bundle, struct bundle_priv, bundle); | ||
| 711 | const struct uverbs_attr *attr = uverbs_attr_get(bundle, idx); | 737 | const struct uverbs_attr *attr = uverbs_attr_get(bundle, idx); |
| 712 | u16 flags; | ||
| 713 | size_t min_size; | 738 | size_t min_size; |
| 714 | 739 | ||
| 715 | if (IS_ERR(attr)) | 740 | if (IS_ERR(attr)) |
| @@ -719,16 +744,25 @@ int uverbs_copy_to(const struct uverbs_attr_bundle *bundle, size_t idx, · 3 unmodified lines | |||
| 719 | if (copy_to_user(u64_to_user_ptr(attr->ptr_attr.data), from, min_size)) | 744 | if (copy_to_user(u64_to_user_ptr(attr->ptr_attr.data), from, min_size)) |
| 720 | return -EFAULT; | 745 | return -EFAULT; |
| 721 | 746 | ||
| 722 | flags = pbundle->uattrs[attr->ptr_attr.uattr_idx].flags | | 747 | return uverbs_set_output(bundle, attr); |
| 723 | UVERBS_ATTR_F_VALID_OUTPUT; | ||
| 724 | if (put_user(flags, | ||
| 725 | &pbundle->user_attrs[attr->ptr_attr.uattr_idx].flags)) | ||
| 726 | return -EFAULT; | ||
| 727 | |||
| 728 | return 0; | ||
| 729 | } | 748 | } |
| 730 | EXPORT_SYMBOL(uverbs_copy_to); | 749 | EXPORT_SYMBOL(uverbs_copy_to); |
| 731 | 750 | ||
| 751 | |||
| 752 | /* | ||
| 753 | * This is only used if the caller has directly used copy_to_use to write the | ||
| 754 | * data. It signals to user space that the buffer is filled in. | ||
| 755 | */ | ||
| 756 | int uverbs_output_written(const struct uverbs_attr_bundle *bundle, size_t idx) | ||
| 757 | { | ||
| 758 | const struct uverbs_attr *attr = uverbs_attr_get(bundle, idx); | ||
| 759 | |||
| 760 | if (IS_ERR(attr)) | ||
| 761 | return PTR_ERR(attr); | ||
| 762 | |||
| 763 | return uverbs_set_output(bundle, attr); | ||
| 764 | } | ||
| 765 | |||
| 732 | int _uverbs_get_const(s64 *to, const struct uverbs_attr_bundle *attrs_bundle, | 766 | int _uverbs_get_const(s64 *to, const struct uverbs_attr_bundle *attrs_bundle, |
| 733 | size_t idx, s64 lower_bound, u64 upper_bound, | 767 | size_t idx, s64 lower_bound, u64 upper_bound, |
| 734 | s64 *def_val) | 768 | s64 *def_val) |
| @@ -757,8 +791,10 @@ int uverbs_copy_to_struct_or_zero(const struct uverbs_attr_bundle *bundle, · 22 unmodified lines | |||
| 757 | { | 791 | { |
| 758 | const struct uverbs_attr *attr = uverbs_attr_get(bundle, idx); | 792 | const struct uverbs_attr *attr = uverbs_attr_get(bundle, idx); |
| 759 | 793 | ||
| 760 | if (clear_user(u64_to_user_ptr(attr->ptr_attr.data), | 794 | if (size < attr->ptr_attr.len) { |
| 761 | attr->ptr_attr.len)) | 795 | if (clear_user(u64_to_user_ptr(attr->ptr_attr.data) + size, |
| 762 | return -EFAULT; | 796 | attr->ptr_attr.len - size)) |
| 797 | return -EFAULT; | ||
| 798 | } | ||
| 763 | return uverbs_copy_to(bundle, idx, from, size); | 799 | return uverbs_copy_to(bundle, idx, from, size); |
| 764 | } | 800 | } |
| @@ -204,6 +204,9 @@ void ib_uverbs_release_file(struct kref *ref) · 203 unmodified lines | |||
| 204 | if (atomic_dec_and_test(&file->device->refcount)) | 204 | if (atomic_dec_and_test(&file->device->refcount)) |
| 205 | ib_uverbs_comp_dev(file->device); | 205 | ib_uverbs_comp_dev(file->device); |
| 206 | 206 | ||
| 207 | if (file->async_file) | ||
| 208 | kref_put(&file->async_file->ref, | ||
| 209 | ib_uverbs_release_async_event_file); | ||
| 207 | put_device(&file->device->dev); | 210 | put_device(&file->device->dev); |
| 208 | kfree(file); | 211 | kfree(file); |
| 209 | } | 212 | } |
| @@ -690,6 +693,7 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf, · 480 unmodified lines | |||
| 690 | 693 | ||
| 691 | buf += sizeof(hdr); | 694 | buf += sizeof(hdr); |
| 692 | 695 | ||
| 696 | memset(bundle.attr_present, 0, sizeof(bundle.attr_present)); | ||
| 693 | bundle.ufile = file; | 697 | bundle.ufile = file; |
| 694 | if (!method_elm->is_ex) { | 698 | if (!method_elm->is_ex) { |
| 695 | size_t in_len = hdr.in_words * 4 - sizeof(hdr); | 699 | size_t in_len = hdr.in_words * 4 - sizeof(hdr); |
| @@ -963,11 +967,19 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) · 267 unmodified lines | |||
| 963 | 967 | ||
| 964 | /* Get an arbitrary mm pointer that hasn't been cleaned yet */ | 968 | /* Get an arbitrary mm pointer that hasn't been cleaned yet */ |
| 965 | mutex_lock(&ufile->umap_lock); | 969 | mutex_lock(&ufile->umap_lock); |
| 966 | if (!list_empty(&ufile->umaps)) { | 970 | while (!list_empty(&ufile->umaps)) { |
| 967 | mm = list_first_entry(&ufile->umaps, | 971 | int ret; |
| 968 | struct rdma_umap_priv, list) | 972 | |
| 969 | ->vma->vm_mm; | 973 | priv = list_first_entry(&ufile->umaps, |
| 970 | mmget(mm); | 974 | struct rdma_umap_priv, list); |
| 975 | mm = priv->vma->vm_mm; | ||
| 976 | ret = mmget_not_zero(mm); | ||
| 977 | if (!ret) { | ||
| 978 | list_del_init(&priv->list); | ||
| 979 | mm = NULL; | ||
| 980 | continue; | ||
| 981 | } | ||
| 982 | break; | ||
| 971 | } | 983 | } |
| 972 | mutex_unlock(&ufile->umap_lock); | 984 | mutex_unlock(&ufile->umap_lock); |
| 973 | if (!mm) | 985 | if (!mm) |
| @@ -1095,10 +1107,6 @@ static int ib_uverbs_close(struct inode *inode, struct file *filp) · 121 unmodified lines | |||
| 1095 | list_del_init(&file->list); | 1107 | list_del_init(&file->list); |
| 1096 | mutex_unlock(&file->device->lists_mutex); | 1108 | mutex_unlock(&file->device->lists_mutex); |
| 1097 | 1109 | ||
| 1098 | if (file->async_file) | ||
| 1099 | kref_put(&file->async_file->ref, | ||
| 1100 | ib_uverbs_release_async_event_file); | ||
| 1101 | |||
| 1102 | kref_put(&file->ref, ib_uverbs_release_file); | 1110 | kref_put(&file->ref, ib_uverbs_release_file); |
| 1103 | 1111 | ||
| 1104 | return 0; | 1112 | return 0; |
| @@ -168,12 +168,18 @@ void copy_port_attr_to_resp(struct ib_port_attr *attr, · 167 unmodified lines | |||
| 168 | static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_PORT)( | 168 | static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_PORT)( |
| 169 | struct uverbs_attr_bundle *attrs) | 169 | struct uverbs_attr_bundle *attrs) |
| 170 | { | 170 | { |
| 171 | struct ib_device *ib_dev = attrs->ufile->device->ib_dev; | 171 | struct ib_device *ib_dev; |
| 172 | struct ib_port_attr attr = {}; | 172 | struct ib_port_attr attr = {}; |
| 173 | struct ib_uverbs_query_port_resp_ex resp = {}; | 173 | struct ib_uverbs_query_port_resp_ex resp = {}; |
| 174 | struct ib_ucontext *ucontext; | ||
| 174 | int ret; | 175 | int ret; |
| 175 | u8 port_num; | 176 | u8 port_num; |
| 176 | 177 | ||
| 178 | ucontext = ib_uverbs_get_ucontext(attrs); | ||
| 179 | if (IS_ERR(ucontext)) | ||
| 180 | return PTR_ERR(ucontext); | ||
| 181 | ib_dev = ucontext->device; | ||
| 182 | |||
| 177 | /* FIXME: Extend the UAPI_DEF_OBJ_NEEDS_FN stuff.. */ | 183 | /* FIXME: Extend the UAPI_DEF_OBJ_NEEDS_FN stuff.. */ |
| 178 | if (!ib_dev->ops.query_port) | 184 | if (!ib_dev->ops.query_port) |
| 179 | return -EOPNOTSUPP; | 185 | return -EOPNOTSUPP; |
| @@ -766,8 +766,8 @@ struct bnxt_qplib_rcfw_sbuf *bnxt_qplib_rcfw_alloc_sbuf( · 765 unmodified lines | |||
| 766 | return NULL; | 766 | return NULL; |
| 767 | 767 | ||
| 768 | sbuf->size = size; | 768 | sbuf->size = size; |
| 769 | sbuf->sb = dma_zalloc_coherent(&rcfw->pdev->dev, sbuf->size, | 769 | sbuf->sb = dma_alloc_coherent(&rcfw->pdev->dev, sbuf->size, |
| 770 | &sbuf->dma_addr, GFP_ATOMIC); | 770 | &sbuf->dma_addr, GFP_ATOMIC); |
| 771 | if (!sbuf->sb) | 771 | if (!sbuf->sb) |
| 772 | goto bail; | 772 | goto bail; |
| 773 | 773 | ||
| @@ -105,10 +105,10 @@ static int __alloc_pbl(struct pci_dev *pdev, struct bnxt_qplib_pbl *pbl, · 104 unmodified lines | |||
| 105 | 105 | ||
| 106 | if (!sghead) { | 106 | if (!sghead) { |
| 107 | for (i = 0; i < pages; i++) { | 107 | for (i = 0; i < pages; i++) { |
| 108 | pbl->pg_arr[i] = dma_zalloc_coherent(&pdev->dev, | 108 | pbl->pg_arr[i] = dma_alloc_coherent(&pdev->dev, |
| 109 | pbl->pg_size, | 109 | pbl->pg_size, |
| 110 | &pbl->pg_map_arr[i], | 110 | &pbl->pg_map_arr[i], |
| 111 | GFP_KERNEL); | 111 | GFP_KERNEL); |
| 112 | if (!pbl->pg_arr[i]) | 112 | if (!pbl->pg_arr[i]) |
| 113 | goto fail; | 113 | goto fail; |
| 114 | pbl->pg_count++; | 114 | pbl->pg_count++; |
| @@ -291,9 +291,9 @@ int cxio_create_qp(struct cxio_rdev *rdev_p, u32 kernel_domain, · 290 unmodified lines | |||
| 291 | if (!wq->sq) | 291 | if (!wq->sq) |
| 292 | goto err3; | 292 | goto err3; |
| 293 | 293 | ||
| 294 | wq->queue = dma_zalloc_coherent(&(rdev_p->rnic_info.pdev->dev), | 294 | wq->queue = dma_alloc_coherent(&(rdev_p->rnic_info.pdev->dev), |
| 295 | depth * sizeof(union t3_wr), | 295 | depth * sizeof(union t3_wr), |
| 296 | &(wq->dma_addr), GFP_KERNEL); | 296 | &(wq->dma_addr), GFP_KERNEL); |
| 297 | if (!wq->queue) | 297 | if (!wq->queue) |
| 298 | goto err4; | 298 | goto err4; |
| 299 | 299 | ||
| @@ -2564,9 +2564,8 @@ static int alloc_srq_queue(struct c4iw_srq *srq, struct c4iw_dev_ucontext *uctx, · 2563 unmodified lines | |||
| 2564 | wq->rqt_abs_idx = (wq->rqt_hwaddr - rdev->lldi.vr->rq.start) >> | 2564 | wq->rqt_abs_idx = (wq->rqt_hwaddr - rdev->lldi.vr->rq.start) >> |
| 2565 | T4_RQT_ENTRY_SHIFT; | 2565 | T4_RQT_ENTRY_SHIFT; |
| 2566 | 2566 | ||
| 2567 | wq->queue = dma_zalloc_coherent(&rdev->lldi.pdev->dev, | 2567 | wq->queue = dma_alloc_coherent(&rdev->lldi.pdev->dev, wq->memsize, |
| 2568 | wq->memsize, &wq->dma_addr, | 2568 | &wq->dma_addr, GFP_KERNEL); |
| 2569 | GFP_KERNEL); | ||
| 2570 | if (!wq->queue) | 2569 | if (!wq->queue) |
| 2571 | goto err_free_rqtpool; | 2570 | goto err_free_rqtpool; |
| 2572 | 2571 | ||
| @@ -488,7 +488,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) · 487 unmodified lines | |||
| 488 | vmf = 1; | 488 | vmf = 1; |
| 489 | break; | 489 | break; |
| 490 | case STATUS: | 490 | case STATUS: |
| 491 | if (flags & (unsigned long)(VM_WRITE | VM_EXEC)) { | 491 | if (flags & VM_WRITE) { |
| 492 | ret = -EPERM; | 492 | ret = -EPERM; |
| 493 | goto done; | 493 | goto done; |
| 494 | } | 494 | } |
| @@ -899,10 +899,10 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit) · 898 unmodified lines | |||
| 899 | goto done; | 899 | goto done; |
| 900 | 900 | ||
| 901 | /* allocate dummy tail memory for all receive contexts */ | 901 | /* allocate dummy tail memory for all receive contexts */ |
| 902 | dd->rcvhdrtail_dummy_kvaddr = dma_zalloc_coherent( | 902 | dd->rcvhdrtail_dummy_kvaddr = dma_alloc_coherent(&dd->pcidev->dev, |
| 903 | &dd->pcidev->dev, sizeof(u64), | 903 | sizeof(u64), |
| 904 | &dd->rcvhdrtail_dummy_dma, | 904 | &dd->rcvhdrtail_dummy_dma, |
| 905 | GFP_KERNEL); | 905 | GFP_KERNEL); |
| 906 | 906 | ||
| 907 | if (!dd->rcvhdrtail_dummy_kvaddr) { | 907 | if (!dd->rcvhdrtail_dummy_kvaddr) { |
| 908 | dd_dev_err(dd, "cannot allocate dummy tail memory\n"); | 908 | dd_dev_err(dd, "cannot allocate dummy tail memory\n"); |
| @@ -1863,9 +1863,9 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) · 954 unmodified lines | |||
| 1863 | gfp_flags = GFP_KERNEL; | 1863 | gfp_flags = GFP_KERNEL; |
| 1864 | else | 1864 | else |
| 1865 | gfp_flags = GFP_USER; | 1865 | gfp_flags = GFP_USER; |
| 1866 | rcd->rcvhdrq = dma_zalloc_coherent( | 1866 | rcd->rcvhdrq = dma_alloc_coherent(&dd->pcidev->dev, amt, |
| 1867 | &dd->pcidev->dev, amt, &rcd->rcvhdrq_dma, | 1867 | &rcd->rcvhdrq_dma, |
| 1868 | gfp_flags | __GFP_COMP); | 1868 | gfp_flags | __GFP_COMP); |
| 1869 | 1869 | ||
| 1870 | if (!rcd->rcvhdrq) { | 1870 | if (!rcd->rcvhdrq) { |
| 1871 | dd_dev_err(dd, | 1871 | dd_dev_err(dd, |
| @@ -1876,9 +1876,10 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) · 4 unmodified lines | |||
| 1876 | 1876 | ||
| 1877 | if (HFI1_CAP_KGET_MASK(rcd->flags, DMA_RTAIL) || | 1877 | if (HFI1_CAP_KGET_MASK(rcd->flags, DMA_RTAIL) || |
| 1878 | HFI1_CAP_UGET_MASK(rcd->flags, DMA_RTAIL)) { | 1878 | HFI1_CAP_UGET_MASK(rcd->flags, DMA_RTAIL)) { |
| 1879 | rcd->rcvhdrtail_kvaddr = dma_zalloc_coherent( | 1879 | rcd->rcvhdrtail_kvaddr = dma_alloc_coherent(&dd->pcidev->dev, |
| 1880 | &dd->pcidev->dev, PAGE_SIZE, | 1880 | PAGE_SIZE, |
| 1881 | &rcd->rcvhdrqtailaddr_dma, gfp_flags); | 1881 | &rcd->rcvhdrqtailaddr_dma, |
| 1882 | gfp_flags); | ||
| 1882 | if (!rcd->rcvhdrtail_kvaddr) | 1883 | if (!rcd->rcvhdrtail_kvaddr) |
| 1883 | goto bail_free; | 1884 | goto bail_free; |
| 1884 | } | 1885 | } |
| @@ -1974,10 +1975,10 @@ int hfi1_setup_eagerbufs(struct hfi1_ctxtdata *rcd) · 89 unmodified lines | |||
| 1974 | while (alloced_bytes < rcd->egrbufs.size && | 1975 | while (alloced_bytes < rcd->egrbufs.size && |
| 1975 | rcd->egrbufs.alloced < rcd->egrbufs.count) { | 1976 | rcd->egrbufs.alloced < rcd->egrbufs.count) { |
| 1976 | rcd->egrbufs.buffers[idx].addr = | 1977 | rcd->egrbufs.buffers[idx].addr = |
| 1977 | dma_zalloc_coherent(&dd->pcidev->dev, | 1978 | dma_alloc_coherent(&dd->pcidev->dev, |
| 1978 | rcd->egrbufs.rcvtid_size, | 1979 | rcd->egrbufs.rcvtid_size, |
| 1979 | &rcd->egrbufs.buffers[idx].dma, | 1980 | &rcd->egrbufs.buffers[idx].dma, |
| 1980 | gfp_flags); | 1981 | gfp_flags); |
| 1981 | if (rcd->egrbufs.buffers[idx].addr) { | 1982 | if (rcd->egrbufs.buffers[idx].addr) { |
| 1982 | rcd->egrbufs.buffers[idx].len = | 1983 | rcd->egrbufs.buffers[idx].len = |
| 1983 | rcd->egrbufs.rcvtid_size; | 1984 | rcd->egrbufs.rcvtid_size; |
| @@ -2098,11 +2098,10 @@ int init_credit_return(struct hfi1_devdata *dd) · 2097 unmodified lines | |||
| 2098 | int bytes = TXE_NUM_CONTEXTS * sizeof(struct credit_return); | 2098 | int bytes = TXE_NUM_CONTEXTS * sizeof(struct credit_return); |
| 2099 | 2099 | ||
| 2100 | set_dev_node(&dd->pcidev->dev, i); | 2100 | set_dev_node(&dd->pcidev->dev, i); |
| 2101 | dd->cr_base[i].va = dma_zalloc_coherent( | 2101 | dd->cr_base[i].va = dma_alloc_coherent(&dd->pcidev->dev, |
| 2102 | &dd->pcidev->dev, | 2102 | bytes, |
| 2103 | bytes, | 2103 | &dd->cr_base[i].dma, |
| 2104 | &dd->cr_base[i].dma, | 2104 | GFP_KERNEL); |
| 2105 | GFP_KERNEL); | ||
| 2106 | if (!dd->cr_base[i].va) { | 2105 | if (!dd->cr_base[i].va) { |
| 2107 | set_dev_node(&dd->pcidev->dev, dd->node); | 2106 | set_dev_node(&dd->pcidev->dev, dd->node); |
| 2108 | dd_dev_err(dd, | 2107 | dd_dev_err(dd, |
| @@ -1453,12 +1453,9 @@ int sdma_init(struct hfi1_devdata *dd, u8 port) · 1452 unmodified lines | |||
| 1453 | timer_setup(&sde->err_progress_check_timer, | 1453 | timer_setup(&sde->err_progress_check_timer, |
| 1454 | sdma_err_progress_check, 0); | 1454 | sdma_err_progress_check, 0); |
| 1455 | 1455 | ||
| 1456 | sde->descq = dma_zalloc_coherent( | 1456 | sde->descq = dma_alloc_coherent(&dd->pcidev->dev, |
| 1457 | &dd->pcidev->dev, | 1457 | descq_cnt * sizeof(u64[2]), |
| 1458 | descq_cnt * sizeof(u64[2]), | 1458 | &sde->descq_phys, GFP_KERNEL); |
| 1459 | &sde->descq_phys, | ||
| 1460 | GFP_KERNEL | ||
| 1461 | ); | ||
| 1462 | if (!sde->descq) | 1459 | if (!sde->descq) |
| 1463 | goto bail; | 1460 | goto bail; |
| 1464 | sde->tx_ring = | 1461 | sde->tx_ring = |
| @@ -1471,24 +1468,18 @@ int sdma_init(struct hfi1_devdata *dd, u8 port) · 6 unmodified lines | |||
| 1471 | 1468 | ||
| 1472 | dd->sdma_heads_size = L1_CACHE_BYTES * num_engines; | 1469 | dd->sdma_heads_size = L1_CACHE_BYTES * num_engines; |
| 1473 | /* Allocate memory for DMA of head registers to memory */ | 1470 | /* Allocate memory for DMA of head registers to memory */ |
| 1474 | dd->sdma_heads_dma = dma_zalloc_coherent( | 1471 | dd->sdma_heads_dma = dma_alloc_coherent(&dd->pcidev->dev, |
| 1475 | &dd->pcidev->dev, | 1472 | dd->sdma_heads_size, |
| 1476 | dd->sdma_heads_size, | 1473 | &dd->sdma_heads_phys, |
| 1477 | &dd->sdma_heads_phys, | 1474 | GFP_KERNEL); |
| 1478 | GFP_KERNEL | ||
| 1479 | ); | ||
| 1480 | if (!dd->sdma_heads_dma) { | 1475 | if (!dd->sdma_heads_dma) { |
| 1481 | dd_dev_err(dd, "failed to allocate SendDMA head memory\n"); | 1476 | dd_dev_err(dd, "failed to allocate SendDMA head memory\n"); |
| 1482 | goto bail; | 1477 | goto bail; |
| 1483 | } | 1478 | } |
| 1484 | 1479 | ||
| 1485 | /* Allocate memory for pad */ | 1480 | /* Allocate memory for pad */ |
| 1486 | dd->sdma_pad_dma = dma_zalloc_coherent( | 1481 | dd->sdma_pad_dma = dma_alloc_coherent(&dd->pcidev->dev, sizeof(u32), |
| 1487 | &dd->pcidev->dev, | 1482 | &dd->sdma_pad_phys, GFP_KERNEL); |
| 1488 | sizeof(u32), | ||
| 1489 | &dd->sdma_pad_phys, | ||
| 1490 | GFP_KERNEL | ||
| 1491 | ); | ||
| 1492 | if (!dd->sdma_pad_dma) { | 1483 | if (!dd->sdma_pad_dma) { |
| 1493 | dd_dev_err(dd, "failed to allocate SendDMA pad memory\n"); | 1484 | dd_dev_err(dd, "failed to allocate SendDMA pad memory\n"); |
| 1494 | goto bail; | 1485 | goto bail; |
| @@ -987,7 +987,6 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) · 986 unmodified lines | |||
| 987 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { | 987 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { |
| 988 | wc.ex.imm_data = packet->ohdr->u.ud.imm_data; | 988 | wc.ex.imm_data = packet->ohdr->u.ud.imm_data; |
| 989 | wc.wc_flags = IB_WC_WITH_IMM; | 989 | wc.wc_flags = IB_WC_WITH_IMM; |
| 990 | tlen -= sizeof(u32); | ||
| 991 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { | 990 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { |
| 992 | wc.ex.imm_data = 0; | 991 | wc.ex.imm_data = 0; |
| 993 | wc.wc_flags = 0; | 992 | wc.wc_flags = 0; |
| @@ -197,8 +197,8 @@ int hns_roce_buf_alloc(struct hns_roce_dev *hr_dev, u32 size, u32 max_direct, · 196 unmodified lines | |||
| 197 | buf->npages = 1 << order; | 197 | buf->npages = 1 << order; |
| 198 | buf->page_shift = page_shift; | 198 | buf->page_shift = page_shift; |
| 199 | /* MTT PA must be recorded in 4k alignment, t is 4k aligned */ | 199 | /* MTT PA must be recorded in 4k alignment, t is 4k aligned */ |
| 200 | buf->direct.buf = dma_zalloc_coherent(dev, | 200 | buf->direct.buf = dma_alloc_coherent(dev, size, &t, |
| 201 | size, &t, GFP_KERNEL); | 201 | GFP_KERNEL); |
| 202 | if (!buf->direct.buf) | 202 | if (!buf->direct.buf) |
| 203 | return -ENOMEM; | 203 | return -ENOMEM; |
| 204 | 204 | ||
| @@ -219,9 +219,10 @@ int hns_roce_buf_alloc(struct hns_roce_dev *hr_dev, u32 size, u32 max_direct, · 14 unmodified lines | |||
| 219 | return -ENOMEM; | 219 | return -ENOMEM; |
| 220 | 220 | ||
| 221 | for (i = 0; i < buf->nbufs; ++i) { | 221 | for (i = 0; i < buf->nbufs; ++i) { |
| 222 | buf->page_list[i].buf = dma_zalloc_coherent(dev, | 222 | buf->page_list[i].buf = dma_alloc_coherent(dev, |
| 223 | page_size, &t, | 223 | page_size, |
| 224 | GFP_KERNEL); | 224 | &t, |
| 225 | GFP_KERNEL); | ||
| 225 | 226 | ||
| 226 | if (!buf->page_list[i].buf) | 227 | if (!buf->page_list[i].buf) |
| 227 | goto err_free; | 228 | goto err_free; |
| @@ -5091,7 +5091,7 @@ static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev, · 5090 unmodified lines | |||
| 5091 | eqe_alloc = i * (buf_chk_sz / eq->eqe_size); | 5091 | eqe_alloc = i * (buf_chk_sz / eq->eqe_size); |
| 5092 | size = (eq->entries - eqe_alloc) * eq->eqe_size; | 5092 | size = (eq->entries - eqe_alloc) * eq->eqe_size; |
| 5093 | } | 5093 | } |
| 5094 | eq->buf[i] = dma_zalloc_coherent(dev, size, | 5094 | eq->buf[i] = dma_alloc_coherent(dev, size, |
| 5095 | &(eq->buf_dma[i]), | 5095 | &(eq->buf_dma[i]), |
| 5096 | GFP_KERNEL); | 5096 | GFP_KERNEL); |
| 5097 | if (!eq->buf[i]) | 5097 | if (!eq->buf[i]) |
| @@ -5126,9 +5126,9 @@ static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev, · 28 unmodified lines | |||
| 5126 | size = (eq->entries - eqe_alloc) | 5126 | size = (eq->entries - eqe_alloc) |
| 5127 | * eq->eqe_size; | 5127 | * eq->eqe_size; |
| 5128 | } | 5128 | } |
| 5129 | eq->buf[idx] = dma_zalloc_coherent(dev, size, | 5129 | eq->buf[idx] = dma_alloc_coherent(dev, size, |
| 5130 | &(eq->buf_dma[idx]), | 5130 | &(eq->buf_dma[idx]), |
| 5131 | GFP_KERNEL); | 5131 | GFP_KERNEL); |
| 5132 | if (!eq->buf[idx]) | 5132 | if (!eq->buf[idx]) |
| 5133 | goto err_dma_alloc_buf; | 5133 | goto err_dma_alloc_buf; |
| 5134 | 5134 | ||
| @@ -5241,7 +5241,7 @@ static int hns_roce_v2_create_eq(struct hns_roce_dev *hr_dev, · 106 unmodified lines | |||
| 5241 | goto free_cmd_mbox; | 5241 | goto free_cmd_mbox; |
| 5242 | } | 5242 | } |
| 5243 | 5243 | ||
| 5244 | eq->buf_list->buf = dma_zalloc_coherent(dev, buf_chk_sz, | 5244 | eq->buf_list->buf = dma_alloc_coherent(dev, buf_chk_sz, |
| 5245 | &(eq->buf_list->map), | 5245 | &(eq->buf_list->map), |
| 5246 | GFP_KERNEL); | 5246 | GFP_KERNEL); |
| 5247 | if (!eq->buf_list->buf) { | 5247 | if (!eq->buf_list->buf) { |
| @@ -210,6 +210,7 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd, · 209 unmodified lines | |||
| 210 | struct ib_udata *udata) | 210 | struct ib_udata *udata) |
| 211 | { | 211 | { |
| 212 | struct hns_roce_dev *hr_dev = to_hr_dev(pd->device); | 212 | struct hns_roce_dev *hr_dev = to_hr_dev(pd->device); |
| 213 | struct hns_roce_ib_create_srq_resp resp = {}; | ||
| 213 | struct hns_roce_srq *srq; | 214 | struct hns_roce_srq *srq; |
| 214 | int srq_desc_size; | 215 | int srq_desc_size; |
| 215 | int srq_buf_size; | 216 | int srq_buf_size; |
| @@ -378,16 +379,21 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd, · 162 unmodified lines | |||
| 378 | 379 | ||
| 379 | srq->event = hns_roce_ib_srq_event; | 380 | srq->event = hns_roce_ib_srq_event; |
| 380 | srq->ibsrq.ext.xrc.srq_num = srq->srqn; | 381 | srq->ibsrq.ext.xrc.srq_num = srq->srqn; |
| 382 | resp.srqn = srq->srqn; | ||
| 381 | 383 | ||
| 382 | if (udata) { | 384 | if (udata) { |
| 383 | if (ib_copy_to_udata(udata, &srq->srqn, sizeof(__u32))) { | 385 | if (ib_copy_to_udata(udata, &resp, |
| 386 | min(udata->outlen, sizeof(resp)))) { | ||
| 384 | ret = -EFAULT; | 387 | ret = -EFAULT; |
| 385 | goto err_wrid; | 388 | goto err_srqc_alloc; |
| 386 | } | 389 | } |
| 387 | } | 390 | } |
| 388 | 391 | ||
| 389 | return &srq->ibsrq; | 392 | return &srq->ibsrq; |
| 390 | 393 | ||
| 394 | err_srqc_alloc: | ||
| 395 | hns_roce_srq_free(hr_dev, srq); | ||
| 396 | |||
| 391 | err_wrid: | 397 | err_wrid: |
| 392 | kvfree(srq->wrid); | 398 | kvfree(srq->wrid); |
| 393 | 399 | ||
| @@ -745,8 +745,8 @@ enum i40iw_status_code i40iw_allocate_dma_mem(struct i40iw_hw *hw, · 744 unmodified lines | |||
| 745 | if (!mem) | 745 | if (!mem) |
| 746 | return I40IW_ERR_PARAM; | 746 | return I40IW_ERR_PARAM; |
| 747 | mem->size = ALIGN(size, alignment); | 747 | mem->size = ALIGN(size, alignment); |
| 748 | mem->va = dma_zalloc_coherent(&pcidev->dev, mem->size, | 748 | mem->va = dma_alloc_coherent(&pcidev->dev, mem->size, |
| 749 | (dma_addr_t *)&mem->pa, GFP_KERNEL); | 749 | (dma_addr_t *)&mem->pa, GFP_KERNEL); |
| 750 | if (!mem->va) | 750 | if (!mem->va) |
| 751 | return I40IW_ERR_NO_MEMORY; | 751 | return I40IW_ERR_NO_MEMORY; |
| 752 | return 0; | 752 | return 0; |
| @@ -1411,7 +1411,7 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port, · 1410 unmodified lines | |||
| 1411 | 1411 | ||
| 1412 | sqp_mad = (struct mlx4_mad_snd_buf *) (sqp->tx_ring[wire_tx_ix].buf.addr); | 1412 | sqp_mad = (struct mlx4_mad_snd_buf *) (sqp->tx_ring[wire_tx_ix].buf.addr); |
| 1413 | if (sqp->tx_ring[wire_tx_ix].ah) | 1413 | if (sqp->tx_ring[wire_tx_ix].ah) |
| 1414 | rdma_destroy_ah(sqp->tx_ring[wire_tx_ix].ah, 0); | 1414 | mlx4_ib_destroy_ah(sqp->tx_ring[wire_tx_ix].ah, 0); |
| 1415 | sqp->tx_ring[wire_tx_ix].ah = ah; | 1415 | sqp->tx_ring[wire_tx_ix].ah = ah; |
| 1416 | ib_dma_sync_single_for_cpu(&dev->ib_dev, | 1416 | ib_dma_sync_single_for_cpu(&dev->ib_dev, |
| 1417 | sqp->tx_ring[wire_tx_ix].buf.map, | 1417 | sqp->tx_ring[wire_tx_ix].buf.map, |
| @@ -1902,7 +1902,7 @@ static void mlx4_ib_sqp_comp_worker(struct work_struct *work) · 484 unmodified lines | |||
| 1902 | if (wc.status == IB_WC_SUCCESS) { | 1902 | if (wc.status == IB_WC_SUCCESS) { |
| 1903 | switch (wc.opcode) { | 1903 | switch (wc.opcode) { |
| 1904 | case IB_WC_SEND: | 1904 | case IB_WC_SEND: |
| 1905 | rdma_destroy_ah(sqp->tx_ring[wc.wr_id & | 1905 | mlx4_ib_destroy_ah(sqp->tx_ring[wc.wr_id & |
| 1906 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); | 1906 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); |
| 1907 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah | 1907 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah |
| 1908 | = NULL; | 1908 | = NULL; |
| @@ -1931,7 +1931,7 @@ static void mlx4_ib_sqp_comp_worker(struct work_struct *work) · 22 unmodified lines | |||
| 1931 | " status = %d, wrid = 0x%llx\n", | 1931 | " status = %d, wrid = 0x%llx\n", |
| 1932 | ctx->slave, wc.status, wc.wr_id); | 1932 | ctx->slave, wc.status, wc.wr_id); |
| 1933 | if (!MLX4_TUN_IS_RECV(wc.wr_id)) { | 1933 | if (!MLX4_TUN_IS_RECV(wc.wr_id)) { |
| 1934 | rdma_destroy_ah(sqp->tx_ring[wc.wr_id & | 1934 | mlx4_ib_destroy_ah(sqp->tx_ring[wc.wr_id & |
| 1935 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); | 1935 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); |
| 1936 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah | 1936 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah |
| 1937 | = NULL; | 1937 | = NULL; |
| @@ -630,8 +630,7 @@ const struct uapi_definition mlx5_ib_flow_defs[] = { · 629 unmodified lines | |||
| 630 | UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), | 630 | UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), |
| 631 | UAPI_DEF_CHAIN_OBJ_TREE( | 631 | UAPI_DEF_CHAIN_OBJ_TREE( |
| 632 | UVERBS_OBJECT_FLOW, | 632 | UVERBS_OBJECT_FLOW, |
| 633 | &mlx5_ib_fs, | 633 | &mlx5_ib_fs), |
| 634 | UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), | ||
| 635 | UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_FLOW_ACTION, | 634 | UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_FLOW_ACTION, |
| 636 | &mlx5_ib_flow_actions), | 635 | &mlx5_ib_flow_actions), |
| 637 | {}, | 636 | {}, |
| @@ -1595,10 +1595,12 @@ static void mlx5_ib_prefetch_mr_work(struct work_struct *work) · 1594 unmodified lines | |||
| 1595 | struct prefetch_mr_work *w = | 1595 | struct prefetch_mr_work *w = |
| 1596 | container_of(work, struct prefetch_mr_work, work); | 1596 | container_of(work, struct prefetch_mr_work, work); |
| 1597 | 1597 | ||
| 1598 | if (w->dev->ib_dev.reg_state == IB_DEV_REGISTERED) | 1598 | if (ib_device_try_get(&w->dev->ib_dev)) { |
| 1599 | mlx5_ib_prefetch_sg_list(w->dev, w->pf_flags, w->sg_list, | 1599 | mlx5_ib_prefetch_sg_list(w->dev, w->pf_flags, w->sg_list, |
| 1600 | w->num_sge); | 1600 | w->num_sge); |
| 1601 | 1601 | ib_device_put(&w->dev->ib_dev); | |
| 1602 | } | ||
| 1603 | put_device(&w->dev->ib_dev.dev); | ||
| 1602 | kfree(w); | 1604 | kfree(w); |
| 1603 | } | 1605 | } |
| 1604 | 1606 | ||
| @@ -1617,15 +1619,13 @@ int mlx5_ib_advise_mr_prefetch(struct ib_pd *pd, · 12 unmodified lines | |||
| 1617 | return mlx5_ib_prefetch_sg_list(dev, pf_flags, sg_list, | 1619 | return mlx5_ib_prefetch_sg_list(dev, pf_flags, sg_list, |
| 1618 | num_sge); | 1620 | num_sge); |
| 1619 | 1621 | ||
| 1620 | if (dev->ib_dev.reg_state != IB_DEV_REGISTERED) | ||
| 1621 | return -ENODEV; | ||
| 1622 | |||
| 1623 | work = kvzalloc(struct_size(work, sg_list, num_sge), GFP_KERNEL); | 1622 | work = kvzalloc(struct_size(work, sg_list, num_sge), GFP_KERNEL); |
| 1624 | if (!work) | 1623 | if (!work) |
| 1625 | return -ENOMEM; | 1624 | return -ENOMEM; |
| 1626 | 1625 | ||
| 1627 | memcpy(work->sg_list, sg_list, num_sge * sizeof(struct ib_sge)); | 1626 | memcpy(work->sg_list, sg_list, num_sge * sizeof(struct ib_sge)); |
| 1628 | 1627 | ||
| 1628 | get_device(&dev->ib_dev.dev); | ||
| 1629 | work->dev = dev; | 1629 | work->dev = dev; |
| 1630 | work->pf_flags = pf_flags; | 1630 | work->pf_flags = pf_flags; |
| 1631 | work->num_sge = num_sge; | 1631 | work->num_sge = num_sge; |
| @@ -1912,14 +1912,16 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, · 1911 unmodified lines | |||
| 1912 | } | 1912 | } |
| 1913 | 1913 | ||
| 1914 | if (!check_flags_mask(ucmd.flags, | 1914 | if (!check_flags_mask(ucmd.flags, |
| 1915 | MLX5_QP_FLAG_ALLOW_SCATTER_CQE | | ||
| 1916 | MLX5_QP_FLAG_BFREG_INDEX | | ||
| 1917 | MLX5_QP_FLAG_PACKET_BASED_CREDIT_MODE | | ||
| 1918 | MLX5_QP_FLAG_SCATTER_CQE | | ||
| 1915 | MLX5_QP_FLAG_SIGNATURE | | 1919 | MLX5_QP_FLAG_SIGNATURE | |
| 1916 | MLX5_QP_FLAG_SCATTER_CQE | | 1920 | MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_MC | |
| 1917 | MLX5_QP_FLAG_TUNNEL_OFFLOADS | | 1921 | MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_UC | |
| 1918 | MLX5_QP_FLAG_BFREG_INDEX | | 1922 | MLX5_QP_FLAG_TUNNEL_OFFLOADS | |
| 1919 | MLX5_QP_FLAG_TYPE_DCT | | 1923 | MLX5_QP_FLAG_TYPE_DCI | |
| 1920 | MLX5_QP_FLAG_TYPE_DCI | | 1924 | MLX5_QP_FLAG_TYPE_DCT)) |
| 1921 | MLX5_QP_FLAG_ALLOW_SCATTER_CQE | | ||
| 1922 | MLX5_QP_FLAG_PACKET_BASED_CREDIT_MODE)) | ||
| 1923 | return -EINVAL; | 1925 | return -EINVAL; |
| 1924 | 1926 | ||
| 1925 | err = get_qp_user_index(to_mucontext(pd->uobject->context), | 1927 | err = get_qp_user_index(to_mucontext(pd->uobject->context), |
| @@ -623,8 +623,9 @@ int mthca_alloc_db(struct mthca_dev *dev, enum mthca_db_type type, · 622 unmodified lines | |||
| 623 | page = dev->db_tab->page + end; | 623 | page = dev->db_tab->page + end; |
| 624 | 624 | ||
| 625 | alloc: | 625 | alloc: |
| 626 | page->db_rec = dma_zalloc_coherent(&dev->pdev->dev, MTHCA_ICM_PAGE_SIZE, | 626 | page->db_rec = dma_alloc_coherent(&dev->pdev->dev, |
| 627 | &page->mapping, GFP_KERNEL); | 627 | MTHCA_ICM_PAGE_SIZE, &page->mapping, |
| 628 | GFP_KERNEL); | ||
| 628 | if (!page->db_rec) { | 629 | if (!page->db_rec) { |
| 629 | ret = -ENOMEM; | 630 | ret = -ENOMEM; |
| 630 | goto out; | 631 | goto out; |
| @@ -534,7 +534,7 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd, · 533 unmodified lines | |||
| 534 | { | 534 | { |
| 535 | struct mthca_ucontext *context; | 535 | struct mthca_ucontext *context; |
| 536 | 536 | ||
| 537 | qp = kmalloc(sizeof *qp, GFP_KERNEL); | 537 | qp = kzalloc(sizeof(*qp), GFP_KERNEL); |
| 538 | if (!qp) | 538 | if (!qp) |
| 539 | return ERR_PTR(-ENOMEM); | 539 | return ERR_PTR(-ENOMEM); |
| 540 | 540 | ||
| @@ -600,7 +600,7 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd, · 59 unmodified lines | |||
| 600 | if (udata) | 600 | if (udata) |
| 601 | return ERR_PTR(-EINVAL); | 601 | return ERR_PTR(-EINVAL); |
| 602 | 602 | ||
| 603 | qp = kmalloc(sizeof (struct mthca_sqp), GFP_KERNEL); | 603 | qp = kzalloc(sizeof(struct mthca_sqp), GFP_KERNEL); |
| 604 | if (!qp) | 604 | if (!qp) |
| 605 | return ERR_PTR(-ENOMEM); | 605 | return ERR_PTR(-ENOMEM); |
| 606 | 606 | ||
| @@ -380,8 +380,8 @@ static int ocrdma_alloc_q(struct ocrdma_dev *dev, · 379 unmodified lines | |||
| 380 | q->len = len; | 380 | q->len = len; |
| 381 | q->entry_size = entry_size; | 381 | q->entry_size = entry_size; |
| 382 | q->size = len * entry_size; | 382 | q->size = len * entry_size; |
| 383 | q->va = dma_zalloc_coherent(&dev->nic_info.pdev->dev, q->size, | 383 | q->va = dma_alloc_coherent(&dev->nic_info.pdev->dev, q->size, &q->dma, |
| 384 | &q->dma, GFP_KERNEL); | 384 | GFP_KERNEL); |
| 385 | if (!q->va) | 385 | if (!q->va) |
| 386 | return -ENOMEM; | 386 | return -ENOMEM; |
| 387 | return 0; | 387 | return 0; |
| @@ -1819,7 +1819,7 @@ int ocrdma_mbx_create_cq(struct ocrdma_dev *dev, struct ocrdma_cq *cq, · 1431 unmodified lines | |||
| 1819 | return -ENOMEM; | 1819 | return -ENOMEM; |
| 1820 | ocrdma_init_mch(&cmd->cmd.req, OCRDMA_CMD_CREATE_CQ, | 1820 | ocrdma_init_mch(&cmd->cmd.req, OCRDMA_CMD_CREATE_CQ, |
| 1821 | OCRDMA_SUBSYS_COMMON, sizeof(*cmd)); | 1821 | OCRDMA_SUBSYS_COMMON, sizeof(*cmd)); |
| 1822 | cq->va = dma_zalloc_coherent(&pdev->dev, cq->len, &cq->pa, GFP_KERNEL); | 1822 | cq->va = dma_alloc_coherent(&pdev->dev, cq->len, &cq->pa, GFP_KERNEL); |
| 1823 | if (!cq->va) { | 1823 | if (!cq->va) { |
| 1824 | status = -ENOMEM; | 1824 | status = -ENOMEM; |
| 1825 | goto mem_err; | 1825 | goto mem_err; |
| @@ -2209,7 +2209,7 @@ static int ocrdma_set_create_qp_sq_cmd(struct ocrdma_create_qp_req *cmd, · 383 unmodified lines | |||
| 2209 | qp->sq.max_cnt = max_wqe_allocated; | 2209 | qp->sq.max_cnt = max_wqe_allocated; |
| 2210 | len = (hw_pages * hw_page_size); | 2210 | len = (hw_pages * hw_page_size); |
| 2211 | 2211 | ||
| 2212 | qp->sq.va = dma_zalloc_coherent(&pdev->dev, len, &pa, GFP_KERNEL); | 2212 | qp->sq.va = dma_alloc_coherent(&pdev->dev, len, &pa, GFP_KERNEL); |
| 2213 | if (!qp->sq.va) | 2213 | if (!qp->sq.va) |
| 2214 | return -EINVAL; | 2214 | return -EINVAL; |
| 2215 | qp->sq.len = len; | 2215 | qp->sq.len = len; |
| @@ -2259,7 +2259,7 @@ static int ocrdma_set_create_qp_rq_cmd(struct ocrdma_create_qp_req *cmd, · 43 unmodified lines | |||
| 2259 | qp->rq.max_cnt = max_rqe_allocated; | 2259 | qp->rq.max_cnt = max_rqe_allocated; |
| 2260 | len = (hw_pages * hw_page_size); | 2260 | len = (hw_pages * hw_page_size); |
| 2261 | 2261 | ||
| 2262 | qp->rq.va = dma_zalloc_coherent(&pdev->dev, len, &pa, GFP_KERNEL); | 2262 | qp->rq.va = dma_alloc_coherent(&pdev->dev, len, &pa, GFP_KERNEL); |
| 2263 | if (!qp->rq.va) | 2263 | if (!qp->rq.va) |
| 2264 | return -ENOMEM; | 2264 | return -ENOMEM; |
| 2265 | qp->rq.pa = pa; | 2265 | qp->rq.pa = pa; |
| @@ -2315,8 +2315,8 @@ static int ocrdma_set_create_qp_ird_cmd(struct ocrdma_create_qp_req *cmd, · 49 unmodified lines | |||
| 2315 | if (dev->attr.ird == 0) | 2315 | if (dev->attr.ird == 0) |
| 2316 | return 0; | 2316 | return 0; |
| 2317 | 2317 | ||
| 2318 | qp->ird_q_va = dma_zalloc_coherent(&pdev->dev, ird_q_len, &pa, | 2318 | qp->ird_q_va = dma_alloc_coherent(&pdev->dev, ird_q_len, &pa, |
| 2319 | GFP_KERNEL); | 2319 | GFP_KERNEL); |
| 2320 | if (!qp->ird_q_va) | 2320 | if (!qp->ird_q_va) |
| 2321 | return -ENOMEM; | 2321 | return -ENOMEM; |
| 2322 | ocrdma_build_q_pages(&cmd->ird_addr[0], dev->attr.num_ird_pages, | 2322 | ocrdma_build_q_pages(&cmd->ird_addr[0], dev->attr.num_ird_pages, |
| @@ -73,8 +73,8 @@ bool ocrdma_alloc_stats_resources(struct ocrdma_dev *dev) · 72 unmodified lines | |||
| 73 | mem->size = max_t(u32, sizeof(struct ocrdma_rdma_stats_req), | 73 | mem->size = max_t(u32, sizeof(struct ocrdma_rdma_stats_req), |
| 74 | sizeof(struct ocrdma_rdma_stats_resp)); | 74 | sizeof(struct ocrdma_rdma_stats_resp)); |
| 75 | 75 | ||
| 76 | mem->va = dma_zalloc_coherent(&dev->nic_info.pdev->dev, mem->size, | 76 | mem->va = dma_alloc_coherent(&dev->nic_info.pdev->dev, mem->size, |
| 77 | &mem->pa, GFP_KERNEL); | 77 | &mem->pa, GFP_KERNEL); |
| 78 | if (!mem->va) { | 78 | if (!mem->va) { |
| 79 | pr_err("%s: stats mbox allocation failed\n", __func__); | 79 | pr_err("%s: stats mbox allocation failed\n", __func__); |
| 80 | return false; | 80 | return false; |
| @@ -504,8 +504,8 @@ struct ib_ucontext *ocrdma_alloc_ucontext(struct ib_device *ibdev, · 503 unmodified lines | |||
| 504 | INIT_LIST_HEAD(&ctx->mm_head); | 504 | INIT_LIST_HEAD(&ctx->mm_head); |
| 505 | mutex_init(&ctx->mm_list_lock); | 505 | mutex_init(&ctx->mm_list_lock); |
| 506 | 506 | ||
| 507 | ctx->ah_tbl.va = dma_zalloc_coherent(&pdev->dev, map_len, | 507 | ctx->ah_tbl.va = dma_alloc_coherent(&pdev->dev, map_len, |
| 508 | &ctx->ah_tbl.pa, GFP_KERNEL); | 508 | &ctx->ah_tbl.pa, GFP_KERNEL); |
| 509 | if (!ctx->ah_tbl.va) { | 509 | if (!ctx->ah_tbl.va) { |
| 510 | kfree(ctx); | 510 | kfree(ctx); |
| 511 | return ERR_PTR(-ENOMEM); | 511 | return ERR_PTR(-ENOMEM); |
| @@ -838,7 +838,7 @@ static int ocrdma_build_pbl_tbl(struct ocrdma_dev *dev, struct ocrdma_hw_mr *mr) · 326 unmodified lines | |||
| 838 | return -ENOMEM; | 838 | return -ENOMEM; |
| 839 | 839 | ||
| 840 | for (i = 0; i < mr->num_pbls; i++) { | 840 | for (i = 0; i < mr->num_pbls; i++) { |
| 841 | va = dma_zalloc_coherent(&pdev->dev, dma_len, &pa, GFP_KERNEL); | 841 | va = dma_alloc_coherent(&pdev->dev, dma_len, &pa, GFP_KERNEL); |
| 842 | if (!va) { | 842 | if (!va) { |
| 843 | ocrdma_free_mr_pbl_tbl(dev, mr); | 843 | ocrdma_free_mr_pbl_tbl(dev, mr); |
| 844 | status = -ENOMEM; | 844 | status = -ENOMEM; |
| @@ -556,8 +556,8 @@ static struct qedr_pbl *qedr_alloc_pbl_tbl(struct qedr_dev *dev, · 555 unmodified lines | |||
| 556 | return ERR_PTR(-ENOMEM); | 556 | return ERR_PTR(-ENOMEM); |
| 557 | 557 | ||
| 558 | for (i = 0; i < pbl_info->num_pbls; i++) { | 558 | for (i = 0; i < pbl_info->num_pbls; i++) { |
| 559 | va = dma_zalloc_coherent(&pdev->dev, pbl_info->pbl_size, | 559 | va = dma_alloc_coherent(&pdev->dev, pbl_info->pbl_size, &pa, |
| 560 | &pa, flags); | 560 | flags); |
| 561 | if (!va) | 561 | if (!va) |
| 562 | goto err; | 562 | goto err; |
| 563 | 563 | ||
| @@ -512,7 +512,6 @@ void qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr, · 511 unmodified lines | |||
| 512 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { | 512 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { |
| 513 | wc.ex.imm_data = ohdr->u.ud.imm_data; | 513 | wc.ex.imm_data = ohdr->u.ud.imm_data; |
| 514 | wc.wc_flags = IB_WC_WITH_IMM; | 514 | wc.wc_flags = IB_WC_WITH_IMM; |
| 515 | tlen -= sizeof(u32); | ||
| 516 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { | 515 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { |
| 517 | wc.ex.imm_data = 0; | 516 | wc.ex.imm_data = 0; |
| 518 | wc.wc_flags = 0; | 517 | wc.wc_flags = 0; |
| @@ -427,7 +427,40 @@ static inline enum ib_qp_state pvrdma_qp_state_to_ib(enum pvrdma_qp_state state) · 426 unmodified lines | |||
| 427 | 427 | ||
| 428 | static inline enum pvrdma_wr_opcode ib_wr_opcode_to_pvrdma(enum ib_wr_opcode op) | 428 | static inline enum pvrdma_wr_opcode ib_wr_opcode_to_pvrdma(enum ib_wr_opcode op) |
| 429 | { | 429 | { |
| 430 | return (enum pvrdma_wr_opcode)op; | 430 | switch (op) { |
| 431 | case IB_WR_RDMA_WRITE: | ||
| 432 | return PVRDMA_WR_RDMA_WRITE; | ||
| 433 | case IB_WR_RDMA_WRITE_WITH_IMM: | ||
| 434 | return PVRDMA_WR_RDMA_WRITE_WITH_IMM; | ||
| 435 | case IB_WR_SEND: | ||
| 436 | return PVRDMA_WR_SEND; | ||
| 437 | case IB_WR_SEND_WITH_IMM: | ||
| 438 | return PVRDMA_WR_SEND_WITH_IMM; | ||
| 439 | case IB_WR_RDMA_READ: | ||
| 440 | return PVRDMA_WR_RDMA_READ; | ||
| 441 | case IB_WR_ATOMIC_CMP_AND_SWP: | ||
| 442 | return PVRDMA_WR_ATOMIC_CMP_AND_SWP; | ||
| 443 | case IB_WR_ATOMIC_FETCH_AND_ADD: | ||
| 444 | return PVRDMA_WR_ATOMIC_FETCH_AND_ADD; | ||
| 445 | case IB_WR_LSO: | ||
| 446 | return PVRDMA_WR_LSO; | ||
| 447 | case IB_WR_SEND_WITH_INV: | ||
| 448 | return PVRDMA_WR_SEND_WITH_INV; | ||
| 449 | case IB_WR_RDMA_READ_WITH_INV: | ||
| 450 | return PVRDMA_WR_RDMA_READ_WITH_INV; | ||
| 451 | case IB_WR_LOCAL_INV: | ||
| 452 | return PVRDMA_WR_LOCAL_INV; | ||
| 453 | case IB_WR_REG_MR: | ||
| 454 | return PVRDMA_WR_FAST_REG_MR; | ||
| 455 | case IB_WR_MASKED_ATOMIC_CMP_AND_SWP: | ||
| 456 | return PVRDMA_WR_MASKED_ATOMIC_CMP_AND_SWP; | ||
| 457 | case IB_WR_MASKED_ATOMIC_FETCH_AND_ADD: | ||
| 458 | return PVRDMA_WR_MASKED_ATOMIC_FETCH_AND_ADD; | ||
| 459 | case IB_WR_REG_SIG_MR: | ||
| 460 | return PVRDMA_WR_REG_SIG_MR; | ||
| 461 | default: | ||
| 462 | return PVRDMA_WR_ERROR; | ||
| 463 | } | ||
| 431 | } | 464 | } |
| 432 | 465 | ||
| 433 | static inline enum ib_wc_status pvrdma_wc_status_to_ib( | 466 | static inline enum ib_wc_status pvrdma_wc_status_to_ib( |
| @@ -890,8 +890,8 @@ static int pvrdma_pci_probe(struct pci_dev *pdev, · 889 unmodified lines | |||
| 890 | dev_info(&pdev->dev, "device version %d, driver version %d\n", | 890 | dev_info(&pdev->dev, "device version %d, driver version %d\n", |
| 891 | dev->dsr_version, PVRDMA_VERSION); | 891 | dev->dsr_version, PVRDMA_VERSION); |
| 892 | 892 | ||
| 893 | dev->dsr = dma_zalloc_coherent(&pdev->dev, sizeof(*dev->dsr), | 893 | dev->dsr = dma_alloc_coherent(&pdev->dev, sizeof(*dev->dsr), |
| 894 | &dev->dsrbase, GFP_KERNEL); | 894 | &dev->dsrbase, GFP_KERNEL); |
| 895 | if (!dev->dsr) { | 895 | if (!dev->dsr) { |
| 896 | dev_err(&pdev->dev, "failed to allocate shared region\n"); | 896 | dev_err(&pdev->dev, "failed to allocate shared region\n"); |
| 897 | ret = -ENOMEM; | 897 | ret = -ENOMEM; |
| @@ -721,6 +721,12 @@ int pvrdma_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, · 720 unmodified lines | |||
| 721 | wr->opcode == IB_WR_RDMA_WRITE_WITH_IMM) | 721 | wr->opcode == IB_WR_RDMA_WRITE_WITH_IMM) |
| 722 | wqe_hdr->ex.imm_data = wr->ex.imm_data; | 722 | wqe_hdr->ex.imm_data = wr->ex.imm_data; |
| 723 | 723 | ||
| 724 | if (unlikely(wqe_hdr->opcode == PVRDMA_WR_ERROR)) { | ||
| 725 | *bad_wr = wr; | ||
| 726 | ret = -EINVAL; | ||
| 727 | goto out; | ||
| 728 | } | ||
| 729 | |||
| 724 | switch (qp->ibqp.qp_type) { | 730 | switch (qp->ibqp.qp_type) { |
| 725 | case IB_QPT_GSI: | 731 | case IB_QPT_GSI: |
| 726 | case IB_QPT_UD: | 732 | case IB_QPT_UD: |
| @@ -2910,6 +2910,8 @@ send: · 2909 unmodified lines | |||
| 2910 | goto op_err; | 2910 | goto op_err; |
| 2911 | if (!ret) | 2911 | if (!ret) |
| 2912 | goto rnr_nak; | 2912 | goto rnr_nak; |
| 2913 | if (wqe->length > qp->r_len) | ||
| 2914 | goto inv_err; | ||
| 2913 | break; | 2915 | break; |
| 2914 | 2916 | ||
| 2915 | case IB_WR_RDMA_WRITE_WITH_IMM: | 2917 | case IB_WR_RDMA_WRITE_WITH_IMM: |
| @@ -3078,7 +3080,10 @@ op_err: · 162 unmodified lines | |||
| 3078 | goto err; | 3080 | goto err; |
| 3079 | 3081 | ||
| 3080 | inv_err: | 3082 | inv_err: |
| 3081 | send_status = IB_WC_REM_INV_REQ_ERR; | 3083 | send_status = |
| 3084 | sqp->ibqp.qp_type == IB_QPT_RC ? | ||
| 3085 | IB_WC_REM_INV_REQ_ERR : | ||
| 3086 | IB_WC_SUCCESS; | ||
| 3082 | wc.status = IB_WC_LOC_QP_OP_ERR; | 3087 | wc.status = IB_WC_LOC_QP_OP_ERR; |
| 3083 | goto err; | 3088 | goto err; |
| 3084 | 3089 | ||
| @@ -248,7 +248,6 @@ struct ipoib_cm_tx { · 247 unmodified lines | |||
| 248 | struct list_head list; | 248 | struct list_head list; |
| 249 | struct net_device *dev; | 249 | struct net_device *dev; |
| 250 | struct ipoib_neigh *neigh; | 250 | struct ipoib_neigh *neigh; |
| 251 | struct ipoib_path *path; | ||
| 252 | struct ipoib_tx_buf *tx_ring; | 251 | struct ipoib_tx_buf *tx_ring; |
| 253 | unsigned int tx_head; | 252 | unsigned int tx_head; |
| 254 | unsigned int tx_tail; | 253 | unsigned int tx_tail; |
| @@ -1312,7 +1312,6 @@ struct ipoib_cm_tx *ipoib_cm_create_tx(struct net_device *dev, struct ipoib_path · 1311 unmodified lines | |||
| 1312 | 1312 | ||
| 1313 | neigh->cm = tx; | 1313 | neigh->cm = tx; |
| 1314 | tx->neigh = neigh; | 1314 | tx->neigh = neigh; |
| 1315 | tx->path = path; | ||
| 1316 | tx->dev = dev; | 1315 | tx->dev = dev; |
| 1317 | list_add(&tx->list, &priv->cm.start_list); | 1316 | list_add(&tx->list, &priv->cm.start_list); |
| 1318 | set_bit(IPOIB_FLAG_INITIALIZED, &tx->flags); | 1317 | set_bit(IPOIB_FLAG_INITIALIZED, &tx->flags); |
| @@ -1371,7 +1370,7 @@ static void ipoib_cm_tx_start(struct work_struct *work) · 52 unmodified lines | |||
| 1371 | neigh->daddr + QPN_AND_OPTIONS_OFFSET); | 1370 | neigh->daddr + QPN_AND_OPTIONS_OFFSET); |
| 1372 | goto free_neigh; | 1371 | goto free_neigh; |
| 1373 | } | 1372 | } |
| 1374 | memcpy(&pathrec, &p->path->pathrec, sizeof(pathrec)); | 1373 | memcpy(&pathrec, &path->pathrec, sizeof(pathrec)); |
| 1375 | 1374 | ||
| 1376 | spin_unlock_irqrestore(&priv->lock, flags); | 1375 | spin_unlock_irqrestore(&priv->lock, flags); |
| 1377 | netif_tx_unlock_bh(dev); | 1376 | netif_tx_unlock_bh(dev); |
| @@ -252,6 +252,8 @@ static const struct xpad_device { · 251 unmodified lines | |||
| 252 | { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, | 252 | { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, |
| 253 | { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, | 253 | { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, |
| 254 | { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX }, | 254 | { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX }, |
| 255 | { 0x1038, 0x1430, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 }, | ||
| 256 | { 0x1038, 0x1431, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 }, | ||
| 255 | { 0x11c9, 0x55f0, "Nacon GC-100XF", 0, XTYPE_XBOX360 }, | 257 | { 0x11c9, 0x55f0, "Nacon GC-100XF", 0, XTYPE_XBOX360 }, |
| 256 | { 0x12ab, 0x0004, "Honey Bee Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, | 258 | { 0x12ab, 0x0004, "Honey Bee Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, |
| 257 | { 0x12ab, 0x0301, "PDP AFTERGLOW AX.1", 0, XTYPE_XBOX360 }, | 259 | { 0x12ab, 0x0301, "PDP AFTERGLOW AX.1", 0, XTYPE_XBOX360 }, |
| @@ -428,6 +430,7 @@ static const struct usb_device_id xpad_table[] = { · 170 unmodified lines | |||
| 428 | XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ | 430 | XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ |
| 429 | XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ | 431 | XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ |
| 430 | XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ | 432 | XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ |
| 433 | XPAD_XBOX360_VENDOR(0x1038), /* SteelSeries Controllers */ | ||
| 431 | XPAD_XBOX360_VENDOR(0x11c9), /* Nacon GC100XF */ | 434 | XPAD_XBOX360_VENDOR(0x11c9), /* Nacon GC100XF */ |
| 432 | XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ | 435 | XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ |
| 433 | XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ | 436 | XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ |
| @@ -39,6 +39,7 @@ · 38 unmodified lines | |||
| 39 | #include <linux/init.h> | 39 | #include <linux/init.h> |
| 40 | #include <linux/fs.h> | 40 | #include <linux/fs.h> |
| 41 | #include <linux/miscdevice.h> | 41 | #include <linux/miscdevice.h> |
| 42 | #include <linux/overflow.h> | ||
| 42 | #include <linux/input/mt.h> | 43 | #include <linux/input/mt.h> |
| 43 | #include "../input-compat.h" | 44 | #include "../input-compat.h" |
| 44 | 45 | ||
| @@ -405,7 +406,7 @@ static int uinput_open(struct inode *inode, struct file *file) · 360 unmodified lines | |||
| 405 | static int uinput_validate_absinfo(struct input_dev *dev, unsigned int code, | 406 | static int uinput_validate_absinfo(struct input_dev *dev, unsigned int code, |
| 406 | const struct input_absinfo *abs) | 407 | const struct input_absinfo *abs) |
| 407 | { | 408 | { |
| 408 | int min, max; | 409 | int min, max, range; |
| 409 | 410 | ||
| 410 | min = abs->minimum; | 411 | min = abs->minimum; |
| 411 | max = abs->maximum; | 412 | max = abs->maximum; |
| @@ -417,7 +418,7 @@ static int uinput_validate_absinfo(struct input_dev *dev, unsigned int code, · 5 unmodified lines | |||
| 417 | return -EINVAL; | 418 | return -EINVAL; |
| 418 | } | 419 | } |
| 419 | 420 | ||
| 420 | if (abs->flat > max - min) { | 421 | if (!check_sub_overflow(max, min, &range) && abs->flat > range) { |
| 421 | printk(KERN_DEBUG | 422 | printk(KERN_DEBUG |
| 422 | "%s: abs_flat #%02x out of range: %d (min:%d/max:%d)\n", | 423 | "%s: abs_flat #%02x out of range: %d (min:%d/max:%d)\n", |
| 423 | UINPUT_NAME, code, abs->flat, min, max); | 424 | UINPUT_NAME, code, abs->flat, min, max); |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | |||
| 23 | #include <linux/of.h> | 23 | #include <linux/of.h> |
| 24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
| 26 | #include <linux/clk.h> | ||
| 27 | 26 | ||
| 28 | /* | 27 | /* |
| 29 | * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller. | 28 | * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller. |
| @@ -75,7 +74,6 @@ struct olpc_apsp { · 45 unmodified lines | |||
| 75 | struct serio *kbio; | 74 | struct serio *kbio; |
| 76 | struct serio *padio; | 75 | struct serio *padio; |
| 77 | void __iomem *base; | 76 | void __iomem *base; |
| 78 | struct clk *clk; | ||
| 79 | int open_count; | 77 | int open_count; |
| 80 | int irq; | 78 | int irq; |
| 81 | }; | 79 | }; |
| @@ -148,17 +146,11 @@ static int olpc_apsp_open(struct serio *port) · 66 unmodified lines | |||
| 148 | struct olpc_apsp *priv = port->port_data; | 146 | struct olpc_apsp *priv = port->port_data; |
| 149 | unsigned int tmp; | 147 | unsigned int tmp; |
| 150 | unsigned long l; | 148 | unsigned long l; |
| 151 | int error; | ||
| 152 | 149 | ||
| 153 | if (priv->open_count++ == 0) { | 150 | if (priv->open_count++ == 0) { |
| 154 | error = clk_prepare_enable(priv->clk); | ||
| 155 | if (error) | ||
| 156 | return error; | ||
| 157 | |||
| 158 | l = readl(priv->base + COMMAND_FIFO_STATUS); | 151 | l = readl(priv->base + COMMAND_FIFO_STATUS); |
| 159 | if (!(l & CMD_STS_MASK)) { | 152 | if (!(l & CMD_STS_MASK)) { |
| 160 | dev_err(priv->dev, "SP cannot accept commands.\n"); | 153 | dev_err(priv->dev, "SP cannot accept commands.\n"); |
| 161 | clk_disable_unprepare(priv->clk); | ||
| 162 | return -EIO; | 154 | return -EIO; |
| 163 | } | 155 | } |
| 164 | 156 | ||
| @@ -179,8 +171,6 @@ static void olpc_apsp_close(struct serio *port) · 14 unmodified lines | |||
| 179 | /* Disable interrupt 0 */ | 171 | /* Disable interrupt 0 */ |
| 180 | tmp = readl(priv->base + PJ_INTERRUPT_MASK); | 172 | tmp = readl(priv->base + PJ_INTERRUPT_MASK); |
| 181 | writel(tmp | INT_0, priv->base + PJ_INTERRUPT_MASK); | 173 | writel(tmp | INT_0, priv->base + PJ_INTERRUPT_MASK); |
| 182 | |||
| 183 | clk_disable_unprepare(priv->clk); | ||
| 184 | } | 174 | } |
| 185 | } | 175 | } |
| 186 | 176 | ||
| @@ -195,6 +185,8 @@ static int olpc_apsp_probe(struct platform_device *pdev) · 8 unmodified lines | |||
| 195 | if (!priv) | 185 | if (!priv) |
| 196 | return -ENOMEM; | 186 | return -ENOMEM; |
| 197 | 187 | ||
| 188 | priv->dev = &pdev->dev; | ||
| 189 | |||
| 198 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 190 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 199 | priv->base = devm_ioremap_resource(&pdev->dev, res); | 191 | priv->base = devm_ioremap_resource(&pdev->dev, res); |
| 200 | if (IS_ERR(priv->base)) { | 192 | if (IS_ERR(priv->base)) { |
| @@ -206,10 +198,6 @@ static int olpc_apsp_probe(struct platform_device *pdev) · 5 unmodified lines | |||
| 206 | if (priv->irq < 0) | 198 | if (priv->irq < 0) |
| 207 | return priv->irq; | 199 | return priv->irq; |
| 208 | 200 | ||
| 209 | priv->clk = devm_clk_get(&pdev->dev, "sp"); | ||
| 210 | if (IS_ERR(priv->clk)) | ||
| 211 | return PTR_ERR(priv->clk); | ||
| 212 | |||
| 213 | /* KEYBOARD */ | 201 | /* KEYBOARD */ |
| 214 | kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); | 202 | kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); |
| 215 | if (!kb_serio) | 203 | if (!kb_serio) |
| @@ -248,7 +236,6 @@ static int olpc_apsp_probe(struct platform_device *pdev) · 32 unmodified lines | |||
| 248 | goto err_irq; | 236 | goto err_irq; |
| 249 | } | 237 | } |
| 250 | 238 | ||
| 251 | priv->dev = &pdev->dev; | ||
| 252 | device_init_wakeup(priv->dev, 1); | 239 | device_init_wakeup(priv->dev, 1); |
| 253 | platform_set_drvdata(pdev, priv); | 240 | platform_set_drvdata(pdev, priv); |
| 254 | 241 | ||
| @@ -698,7 +698,7 @@ config TOUCHSCREEN_EDT_FT5X06 · 697 unmodified lines | |||
| 698 | 698 | ||
| 699 | config TOUCHSCREEN_RASPBERRYPI_FW | 699 | config TOUCHSCREEN_RASPBERRYPI_FW |
| 700 | tristate "Raspberry Pi's firmware base touch screen support" | 700 | tristate "Raspberry Pi's firmware base touch screen support" |
| 701 | depends on RASPBERRYPI_FIRMWARE || COMPILE_TEST | 701 | depends on RASPBERRYPI_FIRMWARE || (RASPBERRYPI_FIRMWARE=n && COMPILE_TEST) |
| 702 | help | 702 | help |
| 703 | Say Y here if you have the official Raspberry Pi 7 inch screen on | 703 | Say Y here if you have the official Raspberry Pi 7 inch screen on |
| 704 | your system. | 704 | your system. |
| @@ -147,8 +147,8 @@ static int rpi_ts_probe(struct platform_device *pdev) · 146 unmodified lines | |||
| 147 | return -ENOMEM; | 147 | return -ENOMEM; |
| 148 | ts->pdev = pdev; | 148 | ts->pdev = pdev; |
| 149 | 149 | ||
| 150 | ts->fw_regs_va = dma_zalloc_coherent(dev, PAGE_SIZE, &ts->fw_regs_phys, | 150 | ts->fw_regs_va = dma_alloc_coherent(dev, PAGE_SIZE, &ts->fw_regs_phys, |
| 151 | GFP_KERNEL); | 151 | GFP_KERNEL); |
| 152 | if (!ts->fw_regs_va) { | 152 | if (!ts->fw_regs_va) { |
| 153 | dev_err(dev, "failed to dma_alloc_coherent\n"); | 153 | dev_err(dev, "failed to dma_alloc_coherent\n"); |
| 154 | return -ENOMEM; | 154 | return -ENOMEM; |
| @@ -1991,16 +1991,13 @@ static void do_attach(struct iommu_dev_data *dev_data, · 1990 unmodified lines | |||
| 1991 | 1991 | ||
| 1992 | static void do_detach(struct iommu_dev_data *dev_data) | 1992 | static void do_detach(struct iommu_dev_data *dev_data) |
| 1993 | { | 1993 | { |
| 1994 | struct protection_domain *domain = dev_data->domain; | ||
| 1994 | struct amd_iommu *iommu; | 1995 | struct amd_iommu *iommu; |
| 1995 | u16 alias; | 1996 | u16 alias; |
| 1996 | 1997 | ||
| 1997 | iommu = amd_iommu_rlookup_table[dev_data->devid]; | 1998 | iommu = amd_iommu_rlookup_table[dev_data->devid]; |
| 1998 | alias = dev_data->alias; | 1999 | alias = dev_data->alias; |
| 1999 | 2000 | ||
| 2000 | /* decrease reference counters */ | ||
| 2001 | dev_data->domain->dev_iommu[iommu->index] -= 1; | ||
| 2002 | dev_data->domain->dev_cnt -= 1; | ||
| 2003 | |||
| 2004 | /* Update data structures */ | 2001 | /* Update data structures */ |
| 2005 | dev_data->domain = NULL; | 2002 | dev_data->domain = NULL; |
| 2006 | list_del(&dev_data->list); | 2003 | list_del(&dev_data->list); |
| @@ -2010,6 +2007,16 @@ static void do_detach(struct iommu_dev_data *dev_data) · 3 unmodified lines | |||
| 2010 | 2007 | ||
| 2011 | /* Flush the DTE entry */ | 2008 | /* Flush the DTE entry */ |
| 2012 | device_flush_dte(dev_data); | 2009 | device_flush_dte(dev_data); |
| 2010 | |||
| 2011 | /* Flush IOTLB */ | ||
| 2012 | domain_flush_tlb_pde(domain); | ||
| 2013 | |||
| 2014 | /* Wait for the flushes to finish */ | ||
| 2015 | domain_flush_complete(domain); | ||
| 2016 | |||
| 2017 | /* decrease reference counters - needs to happen after the flushes */ | ||
| 2018 | domain->dev_iommu[iommu->index] -= 1; | ||
| 2019 | domain->dev_cnt -= 1; | ||
| 2013 | } | 2020 | } |
| 2014 | 2021 | ||
| 2015 | /* | 2022 | /* |
| @@ -2617,13 +2624,13 @@ out_unmap: · 601 unmodified lines | |||
| 2617 | bus_addr = address + s->dma_address + (j << PAGE_SHIFT); | 2624 | bus_addr = address + s->dma_address + (j << PAGE_SHIFT); |
| 2618 | iommu_unmap_page(domain, bus_addr, PAGE_SIZE); | 2625 | iommu_unmap_page(domain, bus_addr, PAGE_SIZE); |
| 2619 | 2626 | ||
| 2620 | if (--mapped_pages) | 2627 | if (--mapped_pages == 0) |
| 2621 | goto out_free_iova; | 2628 | goto out_free_iova; |
| 2622 | } | 2629 | } |
| 2623 | } | 2630 | } |
| 2624 | 2631 | ||
| 2625 | out_free_iova: | 2632 | out_free_iova: |
| 2626 | free_iova_fast(&dma_dom->iovad, address, npages); | 2633 | free_iova_fast(&dma_dom->iovad, address >> PAGE_SHIFT, npages); |
| 2627 | 2634 | ||
| 2628 | out_err: | 2635 | out_err: |
| 2629 | return 0; | 2636 | return 0; |
| @@ -363,7 +363,7 @@ static int dmar_map_gfx = 1; · 362 unmodified lines | |||
| 363 | static int dmar_forcedac; | 363 | static int dmar_forcedac; |
| 364 | static int intel_iommu_strict; | 364 | static int intel_iommu_strict; |
| 365 | static int intel_iommu_superpage = 1; | 365 | static int intel_iommu_superpage = 1; |
| 366 | static int intel_iommu_sm = 1; | 366 | static int intel_iommu_sm; |
| 367 | static int iommu_identity_mapping; | 367 | static int iommu_identity_mapping; |
| 368 | 368 | ||
| 369 | #define IDENTMAP_ALL 1 | 369 | #define IDENTMAP_ALL 1 |
| @@ -456,9 +456,9 @@ static int __init intel_iommu_setup(char *str) · 86 unmodified lines | |||
| 456 | } else if (!strncmp(str, "sp_off", 6)) { | 456 | } else if (!strncmp(str, "sp_off", 6)) { |
| 457 | pr_info("Disable supported super page\n"); | 457 | pr_info("Disable supported super page\n"); |
| 458 | intel_iommu_superpage = 0; | 458 | intel_iommu_superpage = 0; |
| 459 | } else if (!strncmp(str, "sm_off", 6)) { | 459 | } else if (!strncmp(str, "sm_on", 5)) { |
| 460 | pr_info("Intel-IOMMU: disable scalable mode support\n"); | 460 | pr_info("Intel-IOMMU: scalable mode supported\n"); |
| 461 | intel_iommu_sm = 0; | 461 | intel_iommu_sm = 1; |
| 462 | } else if (!strncmp(str, "tboot_noforce", 13)) { | 462 | } else if (!strncmp(str, "tboot_noforce", 13)) { |
| 463 | printk(KERN_INFO | 463 | printk(KERN_INFO |
| 464 | "Intel-IOMMU: not forcing on after tboot. This could expose security risk for tboot\n"); | 464 | "Intel-IOMMU: not forcing on after tboot. This could expose security risk for tboot\n"); |
| @@ -5294,7 +5294,7 @@ static void intel_iommu_put_resv_regions(struct device *dev, · 4829 unmodified lines | |||
| 5294 | struct iommu_resv_region *entry, *next; | 5294 | struct iommu_resv_region *entry, *next; |
| 5295 | 5295 | ||
| 5296 | list_for_each_entry_safe(entry, next, head, list) { | 5296 | list_for_each_entry_safe(entry, next, head, list) { |
| 5297 | if (entry->type == IOMMU_RESV_RESERVED) | 5297 | if (entry->type == IOMMU_RESV_MSI) |
| 5298 | kfree(entry); | 5298 | kfree(entry); |
| 5299 | } | 5299 | } |
| 5300 | } | 5300 | } |
| @@ -232,9 +232,8 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_data *data) · 231 unmodified lines | |||
| 232 | 232 | ||
| 233 | spin_lock_init(&dom->pgtlock); | 233 | spin_lock_init(&dom->pgtlock); |
| 234 | 234 | ||
| 235 | dom->pgt_va = dma_zalloc_coherent(data->dev, | 235 | dom->pgt_va = dma_alloc_coherent(data->dev, M2701_IOMMU_PGT_SIZE, |
| 236 | M2701_IOMMU_PGT_SIZE, | 236 | &dom->pgt_pa, GFP_KERNEL); |
| 237 | &dom->pgt_pa, GFP_KERNEL); | ||
| 238 | if (!dom->pgt_va) | 237 | if (!dom->pgt_va) |
| 239 | return -ENOMEM; | 238 | return -ENOMEM; |
| 240 | 239 | ||
| @@ -442,6 +441,10 @@ static int mtk_iommu_add_device(struct device *dev) · 201 unmodified lines | |||
| 442 | iommu_spec.args_count = count; | 441 | iommu_spec.args_count = count; |
| 443 | 442 | ||
| 444 | mtk_iommu_create_mapping(dev, &iommu_spec); | 443 | mtk_iommu_create_mapping(dev, &iommu_spec); |
| 444 | |||
| 445 | /* dev->iommu_fwspec might have changed */ | ||
| 446 | fwspec = dev_iommu_fwspec_get(dev); | ||
| 447 | |||
| 445 | of_node_put(iommu_spec.np); | 448 | of_node_put(iommu_spec.np); |
| 446 | } | 449 | } |
| 447 | 450 | ||
| @@ -224,7 +224,7 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, · 223 unmodified lines | |||
| 224 | * If we have reason to believe the IOMMU driver missed the initial | 224 | * If we have reason to believe the IOMMU driver missed the initial |
| 225 | * probe for dev, replay it to get things in order. | 225 | * probe for dev, replay it to get things in order. |
| 226 | */ | 226 | */ |
| 227 | if (dev->bus && !device_iommu_mapped(dev)) | 227 | if (!err && dev->bus && !device_iommu_mapped(dev)) |
| 228 | err = iommu_probe_device(dev); | 228 | err = iommu_probe_device(dev); |
| 229 | 229 | ||
| 230 | /* Ignore all other errors apart from EPROBE_DEFER */ | 230 | /* Ignore all other errors apart from EPROBE_DEFER */ |
| @@ -95,7 +95,7 @@ static inline void setup_irq_channel(u32 magic, void __iomem *reg_addr) · 94 unmodified lines | |||
| 95 | 95 | ||
| 96 | /* Setup 64 channel slots */ | 96 | /* Setup 64 channel slots */ |
| 97 | for (i = 0; i < INTC_IRQS; i += 4) | 97 | for (i = 0; i < INTC_IRQS; i += 4) |
| 98 | writel_relaxed(build_channel_val(i, magic), reg_addr + i); | 98 | writel(build_channel_val(i, magic), reg_addr + i); |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | static int __init | 101 | static int __init |
| @@ -135,16 +135,10 @@ ck_intc_init_comm(struct device_node *node, struct device_node *parent) · 33 unmodified lines | |||
| 135 | static inline bool handle_irq_perbit(struct pt_regs *regs, u32 hwirq, | 135 | static inline bool handle_irq_perbit(struct pt_regs *regs, u32 hwirq, |
| 136 | u32 irq_base) | 136 | u32 irq_base) |
| 137 | { | 137 | { |
| 138 | u32 irq; | ||
| 139 | |||
| 140 | if (hwirq == 0) | 138 | if (hwirq == 0) |
| 141 | return 0; | 139 | return 0; |
| 142 | 140 | ||
| 143 | while (hwirq) { | 141 | handle_domain_irq(root_domain, irq_base + __fls(hwirq), regs); |
| 144 | irq = __ffs(hwirq); | ||
| 145 | hwirq &= ~BIT(irq); | ||
| 146 | handle_domain_irq(root_domain, irq_base + irq, regs); | ||
| 147 | } | ||
| 148 | 142 | ||
| 149 | return 1; | 143 | return 1; |
| 150 | } | 144 | } |
| @@ -154,12 +148,16 @@ static void gx_irq_handler(struct pt_regs *regs) · 3 unmodified lines | |||
| 154 | { | 148 | { |
| 155 | bool ret; | 149 | bool ret; |
| 156 | 150 | ||
| 157 | do { | 151 | retry: |
| 158 | ret = handle_irq_perbit(regs, | 152 | ret = handle_irq_perbit(regs, |
| 159 | readl_relaxed(reg_base + GX_INTC_PEN31_00), 0); | 153 | readl(reg_base + GX_INTC_PEN63_32), 32); |
| 160 | ret |= handle_irq_perbit(regs, | 154 | if (ret) |
| 161 | readl_relaxed(reg_base + GX_INTC_PEN63_32), 32); | 155 | goto retry; |
| 162 | } while (ret); | 156 | |
| 157 | ret = handle_irq_perbit(regs, | ||
| 158 | readl(reg_base + GX_INTC_PEN31_00), 0); | ||
| 159 | if (ret) | ||
| 160 | goto retry; | ||
| 163 | } | 161 | } |
| 164 | 162 | ||
| 165 | static int __init | 163 | static int __init |
| @@ -174,14 +172,14 @@ gx_intc_init(struct device_node *node, struct device_node *parent) · 8 unmodified lines | |||
| 174 | /* | 172 | /* |
| 175 | * Initial enable reg to disable all interrupts | 173 | * Initial enable reg to disable all interrupts |
| 176 | */ | 174 | */ |
| 177 | writel_relaxed(0x0, reg_base + GX_INTC_NEN31_00); | 175 | writel(0x0, reg_base + GX_INTC_NEN31_00); |
| 178 | writel_relaxed(0x0, reg_base + GX_INTC_NEN63_32); | 176 | writel(0x0, reg_base + GX_INTC_NEN63_32); |
| 179 | 177 | ||
| 180 | /* | 178 | /* |
| 181 | * Initial mask reg with all unmasked, because we only use enalbe reg | 179 | * Initial mask reg with all unmasked, because we only use enalbe reg |
| 182 | */ | 180 | */ |
| 183 | writel_relaxed(0x0, reg_base + GX_INTC_NMASK31_00); | 181 | writel(0x0, reg_base + GX_INTC_NMASK31_00); |
| 184 | writel_relaxed(0x0, reg_base + GX_INTC_NMASK63_32); | 182 | writel(0x0, reg_base + GX_INTC_NMASK63_32); |
| 185 | 183 | ||
| 186 | setup_irq_channel(0x03020100, reg_base + GX_INTC_SOURCE); | 184 | setup_irq_channel(0x03020100, reg_base + GX_INTC_SOURCE); |
| 187 | 185 | ||
| @@ -204,20 +202,29 @@ static void ck_irq_handler(struct pt_regs *regs) · 16 unmodified lines | |||
| 204 | void __iomem *reg_pen_lo = reg_base + CK_INTC_PEN31_00; | 202 | void __iomem *reg_pen_lo = reg_base + CK_INTC_PEN31_00; |
| 205 | void __iomem *reg_pen_hi = reg_base + CK_INTC_PEN63_32; | 203 | void __iomem *reg_pen_hi = reg_base + CK_INTC_PEN63_32; |
| 206 | 204 | ||
| 207 | do { | 205 | retry: |
| 208 | /* handle 0 - 31 irqs */ | 206 | /* handle 0 - 63 irqs */ |
| 209 | ret = handle_irq_perbit(regs, readl_relaxed(reg_pen_lo), 0); | 207 | ret = handle_irq_perbit(regs, readl(reg_pen_hi), 32); |
| 210 | ret |= handle_irq_perbit(regs, readl_relaxed(reg_pen_hi), 32); | 208 | if (ret) |
| 209 | goto retry; | ||
| 211 | 210 | ||
| 212 | if (nr_irq == INTC_IRQS) | 211 | ret = handle_irq_perbit(regs, readl(reg_pen_lo), 0); |
| 213 | continue; | 212 | if (ret) |
| 213 | goto retry; | ||
| 214 | |||
| 215 | if (nr_irq == INTC_IRQS) | ||
| 216 | return; | ||
| 214 | 217 | ||
| 215 | /* handle 64 - 127 irqs */ | 218 | /* handle 64 - 127 irqs */ |
| 216 | ret |= handle_irq_perbit(regs, | 219 | ret = handle_irq_perbit(regs, |
| 217 | readl_relaxed(reg_pen_lo + CK_INTC_DUAL_BASE), 64); | 220 | readl(reg_pen_hi + CK_INTC_DUAL_BASE), 96); |
| 218 | ret |= handle_irq_perbit(regs, | 221 | if (ret) |
| 219 | readl_relaxed(reg_pen_hi + CK_INTC_DUAL_BASE), 96); | 222 | goto retry; |
| 220 | } while (ret); | 223 | |
| 224 | ret = handle_irq_perbit(regs, | ||
| 225 | readl(reg_pen_lo + CK_INTC_DUAL_BASE), 64); | ||
| 226 | if (ret) | ||
| 227 | goto retry; | ||
| 221 | } | 228 | } |
| 222 | 229 | ||
| 223 | static int __init | 230 | static int __init |
| @@ -230,11 +237,11 @@ ck_intc_init(struct device_node *node, struct device_node *parent) · 6 unmodified lines | |||
| 230 | return ret; | 237 | return ret; |
| 231 | 238 | ||
| 232 | /* Initial enable reg to disable all interrupts */ | 239 | /* Initial enable reg to disable all interrupts */ |
| 233 | writel_relaxed(0, reg_base + CK_INTC_NEN31_00); | 240 | writel(0, reg_base + CK_INTC_NEN31_00); |
| 234 | writel_relaxed(0, reg_base + CK_INTC_NEN63_32); | 241 | writel(0, reg_base + CK_INTC_NEN63_32); |
| 235 | 242 | ||
| 236 | /* Enable irq intc */ | 243 | /* Enable irq intc */ |
| 237 | writel_relaxed(BIT(31), reg_base + CK_INTC_ICR); | 244 | writel(BIT(31), reg_base + CK_INTC_ICR); |
| 238 | 245 | ||
| 239 | ck_set_gc(node, reg_base, CK_INTC_NEN31_00, 0); | 246 | ck_set_gc(node, reg_base, CK_INTC_NEN31_00, 0); |
| 240 | ck_set_gc(node, reg_base, CK_INTC_NEN63_32, 32); | 247 | ck_set_gc(node, reg_base, CK_INTC_NEN63_32, 32); |
| @@ -260,8 +267,8 @@ ck_dual_intc_init(struct device_node *node, struct device_node *parent) · 19 unmodified lines | |||
| 260 | return ret; | 267 | return ret; |
| 261 | 268 | ||
| 262 | /* Initial enable reg to disable all interrupts */ | 269 | /* Initial enable reg to disable all interrupts */ |
| 263 | writel_relaxed(0, reg_base + CK_INTC_NEN31_00 + CK_INTC_DUAL_BASE); | 270 | writel(0, reg_base + CK_INTC_NEN31_00 + CK_INTC_DUAL_BASE); |
| 264 | writel_relaxed(0, reg_base + CK_INTC_NEN63_32 + CK_INTC_DUAL_BASE); | 271 | writel(0, reg_base + CK_INTC_NEN63_32 + CK_INTC_DUAL_BASE); |
| 265 | 272 | ||
| 266 | ck_set_gc(node, reg_base + CK_INTC_DUAL_BASE, CK_INTC_NEN31_00, 64); | 273 | ck_set_gc(node, reg_base + CK_INTC_DUAL_BASE, CK_INTC_NEN31_00, 64); |
| 267 | ck_set_gc(node, reg_base + CK_INTC_DUAL_BASE, CK_INTC_NEN63_32, 96); | 274 | ck_set_gc(node, reg_base + CK_INTC_DUAL_BASE, CK_INTC_NEN63_32, 96); |
| @@ -97,9 +97,14 @@ struct its_device; · 96 unmodified lines | |||
| 97 | * The ITS structure - contains most of the infrastructure, with the | 97 | * The ITS structure - contains most of the infrastructure, with the |
| 98 | * top-level MSI domain, the command queue, the collections, and the | 98 | * top-level MSI domain, the command queue, the collections, and the |
| 99 | * list of devices writing to it. | 99 | * list of devices writing to it. |
| 100 | * | ||
| 101 | * dev_alloc_lock has to be taken for device allocations, while the | ||
| 102 | * spinlock must be taken to parse data structures such as the device | ||
| 103 | * list. | ||
| 100 | */ | 104 | */ |
| 101 | struct its_node { | 105 | struct its_node { |
| 102 | raw_spinlock_t lock; | 106 | raw_spinlock_t lock; |
| 107 | struct mutex dev_alloc_lock; | ||
| 103 | struct list_head entry; | 108 | struct list_head entry; |
| 104 | void __iomem *base; | 109 | void __iomem *base; |
| 105 | phys_addr_t phys_base; | 110 | phys_addr_t phys_base; |
| @@ -156,6 +161,7 @@ struct its_device { · 50 unmodified lines | |||
| 156 | void *itt; | 161 | void *itt; |
| 157 | u32 nr_ites; | 162 | u32 nr_ites; |
| 158 | u32 device_id; | 163 | u32 device_id; |
| 164 | bool shared; | ||
| 159 | }; | 165 | }; |
| 160 | 166 | ||
| 161 | static struct { | 167 | static struct { |
| @@ -1580,6 +1586,9 @@ static unsigned long *its_lpi_alloc(int nr_irqs, u32 *base, int *nr_ids) · 1418 unmodified lines | |||
| 1580 | nr_irqs /= 2; | 1586 | nr_irqs /= 2; |
| 1581 | } while (nr_irqs > 0); | 1587 | } while (nr_irqs > 0); |
| 1582 | 1588 | ||
| 1589 | if (!nr_irqs) | ||
| 1590 | err = -ENOSPC; | ||
| 1591 | |||
| 1583 | if (err) | 1592 | if (err) |
| 1584 | goto out; | 1593 | goto out; |
| 1585 | 1594 | ||
| @@ -2059,6 +2068,29 @@ static int __init allocate_lpi_tables(void) · 473 unmodified lines | |||
| 2059 | return 0; | 2068 | return 0; |
| 2060 | } | 2069 | } |
| 2061 | 2070 | ||
| 2071 | static u64 its_clear_vpend_valid(void __iomem *vlpi_base) | ||
| 2072 | { | ||
| 2073 | u32 count = 1000000; /* 1s! */ | ||
| 2074 | bool clean; | ||
| 2075 | u64 val; | ||
| 2076 | |||
| 2077 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
| 2078 | val &= ~GICR_VPENDBASER_Valid; | ||
| 2079 | gits_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER); | ||
| 2080 | |||
| 2081 | do { | ||
| 2082 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
| 2083 | clean = !(val & GICR_VPENDBASER_Dirty); | ||
| 2084 | if (!clean) { | ||
| 2085 | count--; | ||
| 2086 | cpu_relax(); | ||
| 2087 | udelay(1); | ||
| 2088 | } | ||
| 2089 | } while (!clean && count); | ||
| 2090 | |||
| 2091 | return val; | ||
| 2092 | } | ||
| 2093 | |||
| 2062 | static void its_cpu_init_lpis(void) | 2094 | static void its_cpu_init_lpis(void) |
| 2063 | { | 2095 | { |
| 2064 | void __iomem *rbase = gic_data_rdist_rd_base(); | 2096 | void __iomem *rbase = gic_data_rdist_rd_base(); |
| @@ -2144,6 +2176,30 @@ static void its_cpu_init_lpis(void) · 79 unmodified lines | |||
| 2144 | val |= GICR_CTLR_ENABLE_LPIS; | 2176 | val |= GICR_CTLR_ENABLE_LPIS; |
| 2145 | writel_relaxed(val, rbase + GICR_CTLR); | 2177 | writel_relaxed(val, rbase + GICR_CTLR); |
| 2146 | 2178 | ||
| 2179 | if (gic_rdists->has_vlpis) { | ||
| 2180 | void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); | ||
| 2181 | |||
| 2182 | /* | ||
| 2183 | * It's possible for CPU to receive VLPIs before it is | ||
| 2184 | * sheduled as a vPE, especially for the first CPU, and the | ||
| 2185 | * VLPI with INTID larger than 2^(IDbits+1) will be considered | ||
| 2186 | * as out of range and dropped by GIC. | ||
| 2187 | * So we initialize IDbits to known value to avoid VLPI drop. | ||
| 2188 | */ | ||
| 2189 | val = (LPI_NRBITS - 1) & GICR_VPROPBASER_IDBITS_MASK; | ||
| 2190 | pr_debug("GICv4: CPU%d: Init IDbits to 0x%llx for GICR_VPROPBASER\n", | ||
| 2191 | smp_processor_id(), val); | ||
| 2192 | gits_write_vpropbaser(val, vlpi_base + GICR_VPROPBASER); | ||
| 2193 | |||
| 2194 | /* | ||
| 2195 | * Also clear Valid bit of GICR_VPENDBASER, in case some | ||
| 2196 | * ancient programming gets left in and has possibility of | ||
| 2197 | * corrupting memory. | ||
| 2198 | */ | ||
| 2199 | val = its_clear_vpend_valid(vlpi_base); | ||
| 2200 | WARN_ON(val & GICR_VPENDBASER_Dirty); | ||
| 2201 | } | ||
| 2202 | |||
| 2147 | /* Make sure the GIC has seen the above */ | 2203 | /* Make sure the GIC has seen the above */ |
| 2148 | dsb(sy); | 2204 | dsb(sy); |
| 2149 | out: | 2205 | out: |
| @@ -2399,13 +2455,14 @@ static void its_free_device(struct its_device *its_dev) · 249 unmodified lines | |||
| 2399 | kfree(its_dev); | 2455 | kfree(its_dev); |
| 2400 | } | 2456 | } |
| 2401 | 2457 | ||
| 2402 | static int its_alloc_device_irq(struct its_device *dev, irq_hw_number_t *hwirq) | 2458 | static int its_alloc_device_irq(struct its_device *dev, int nvecs, irq_hw_number_t *hwirq) |
| 2403 | { | 2459 | { |
| 2404 | int idx; | 2460 | int idx; |
| 2405 | 2461 | ||
| 2406 | idx = find_first_zero_bit(dev->event_map.lpi_map, | 2462 | idx = bitmap_find_free_region(dev->event_map.lpi_map, |
| 2407 | dev->event_map.nr_lpis); | 2463 | dev->event_map.nr_lpis, |
| 2408 | if (idx == dev->event_map.nr_lpis) | 2464 | get_count_order(nvecs)); |
| 2465 | if (idx < 0) | ||
| 2409 | return -ENOSPC; | 2466 | return -ENOSPC; |
| 2410 | 2467 | ||
| 2411 | *hwirq = dev->event_map.lpi_base + idx; | 2468 | *hwirq = dev->event_map.lpi_base + idx; |
| @@ -2421,6 +2478,7 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev, · 9 unmodified lines | |||
| 2421 | struct its_device *its_dev; | 2478 | struct its_device *its_dev; |
| 2422 | struct msi_domain_info *msi_info; | 2479 | struct msi_domain_info *msi_info; |
| 2423 | u32 dev_id; | 2480 | u32 dev_id; |
| 2481 | int err = 0; | ||
| 2424 | 2482 | ||
| 2425 | /* | 2483 | /* |
| 2426 | * We ignore "dev" entierely, and rely on the dev_id that has | 2484 | * We ignore "dev" entierely, and rely on the dev_id that has |
| @@ -2443,6 +2501,7 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev, · 16 unmodified lines | |||
| 2443 | return -EINVAL; | 2501 | return -EINVAL; |
| 2444 | } | 2502 | } |
| 2445 | 2503 | ||
| 2504 | mutex_lock(&its->dev_alloc_lock); | ||
| 2446 | its_dev = its_find_device(its, dev_id); | 2505 | its_dev = its_find_device(its, dev_id); |
| 2447 | if (its_dev) { | 2506 | if (its_dev) { |
| 2448 | /* | 2507 | /* |
| @@ -2450,18 +2509,22 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev, · 1 unmodified line | |||
| 2450 | * another alias (PCI bridge of some sort). No need to | 2509 | * another alias (PCI bridge of some sort). No need to |
| 2451 | * create the device. | 2510 | * create the device. |
| 2452 | */ | 2511 | */ |
| 2512 | its_dev->shared = true; | ||
| 2453 | pr_debug("Reusing ITT for devID %x\n", dev_id); | 2513 | pr_debug("Reusing ITT for devID %x\n", dev_id); |
| 2454 | goto out; | 2514 | goto out; |
| 2455 | } | 2515 | } |
| 2456 | 2516 | ||
| 2457 | its_dev = its_create_device(its, dev_id, nvec, true); | 2517 | its_dev = its_create_device(its, dev_id, nvec, true); |
| 2458 | if (!its_dev) | 2518 | if (!its_dev) { |
| 2459 | return -ENOMEM; | 2519 | err = -ENOMEM; |
| 2520 | goto out; | ||
| 2521 | } | ||
| 2460 | 2522 | ||
| 2461 | pr_debug("ITT %d entries, %d bits\n", nvec, ilog2(nvec)); | 2523 | pr_debug("ITT %d entries, %d bits\n", nvec, ilog2(nvec)); |
| 2462 | out: | 2524 | out: |
| 2525 | mutex_unlock(&its->dev_alloc_lock); | ||
| 2463 | info->scratchpad[0].ptr = its_dev; | 2526 | info->scratchpad[0].ptr = its_dev; |
| 2464 | return 0; | 2527 | return err; |
| 2465 | } | 2528 | } |
| 2466 | 2529 | ||
| 2467 | static struct msi_domain_ops its_msi_domain_ops = { | 2530 | static struct msi_domain_ops its_msi_domain_ops = { |
| @@ -2501,21 +2564,21 @@ static int its_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, · 33 unmodified lines | |||
| 2501 | int err; | 2564 | int err; |
| 2502 | int i; | 2565 | int i; |
| 2503 | 2566 | ||
| 2504 | for (i = 0; i < nr_irqs; i++) { | 2567 | err = its_alloc_device_irq(its_dev, nr_irqs, &hwirq); |
| 2505 | err = its_alloc_device_irq(its_dev, &hwirq); | 2568 | if (err) |
| 2506 | if (err) | 2569 | return err; |
| 2507 | return err; | ||
| 2508 | 2570 | ||
| 2509 | err = its_irq_gic_domain_alloc(domain, virq + i, hwirq); | 2571 | for (i = 0; i < nr_irqs; i++) { |
| 2572 | err = its_irq_gic_domain_alloc(domain, virq + i, hwirq + i); | ||
| 2510 | if (err) | 2573 | if (err) |
| 2511 | return err; | 2574 | return err; |
| 2512 | 2575 | ||
| 2513 | irq_domain_set_hwirq_and_chip(domain, virq + i, | 2576 | irq_domain_set_hwirq_and_chip(domain, virq + i, |
| 2514 | hwirq, &its_irq_chip, its_dev); | 2577 | hwirq + i, &its_irq_chip, its_dev); |
| 2515 | irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq + i))); | 2578 | irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq + i))); |
| 2516 | pr_debug("ID:%d pID:%d vID:%d\n", | 2579 | pr_debug("ID:%d pID:%d vID:%d\n", |
| 2517 | (int)(hwirq - its_dev->event_map.lpi_base), | 2580 | (int)(hwirq + i - its_dev->event_map.lpi_base), |
| 2518 | (int) hwirq, virq + i); | 2581 | (int)(hwirq + i), virq + i); |
| 2519 | } | 2582 | } |
| 2520 | 2583 | ||
| 2521 | return 0; | 2584 | return 0; |
| @@ -2565,6 +2628,7 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, · 43 unmodified lines | |||
| 2565 | { | 2628 | { |
| 2566 | struct irq_data *d = irq_domain_get_irq_data(domain, virq); | 2629 | struct irq_data *d = irq_domain_get_irq_data(domain, virq); |
| 2567 | struct its_device *its_dev = irq_data_get_irq_chip_data(d); | 2630 | struct its_device *its_dev = irq_data_get_irq_chip_data(d); |
| 2631 | struct its_node *its = its_dev->its; | ||
| 2568 | int i; | 2632 | int i; |
| 2569 | 2633 | ||
| 2570 | for (i = 0; i < nr_irqs; i++) { | 2634 | for (i = 0; i < nr_irqs; i++) { |
| @@ -2579,8 +2643,14 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, · 8 unmodified lines | |||
| 2579 | irq_domain_reset_irq_data(data); | 2643 | irq_domain_reset_irq_data(data); |
| 2580 | } | 2644 | } |
| 2581 | 2645 | ||
| 2582 | /* If all interrupts have been freed, start mopping the floor */ | 2646 | mutex_lock(&its->dev_alloc_lock); |
| 2583 | if (bitmap_empty(its_dev->event_map.lpi_map, | 2647 | |
| 2648 | /* | ||
| 2649 | * If all interrupts have been freed, start mopping the | ||
| 2650 | * floor. This is conditionned on the device not being shared. | ||
| 2651 | */ | ||
| 2652 | if (!its_dev->shared && | ||
| 2653 | bitmap_empty(its_dev->event_map.lpi_map, | ||
| 2584 | its_dev->event_map.nr_lpis)) { | 2654 | its_dev->event_map.nr_lpis)) { |
| 2585 | its_lpi_free(its_dev->event_map.lpi_map, | 2655 | its_lpi_free(its_dev->event_map.lpi_map, |
| 2586 | its_dev->event_map.lpi_base, | 2656 | its_dev->event_map.lpi_base, |
| @@ -2592,6 +2662,8 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, · 5 unmodified lines | |||
| 2592 | its_free_device(its_dev); | 2662 | its_free_device(its_dev); |
| 2593 | } | 2663 | } |
| 2594 | 2664 | ||
| 2665 | mutex_unlock(&its->dev_alloc_lock); | ||
| 2666 | |||
| 2595 | irq_domain_free_irqs_parent(domain, virq, nr_irqs); | 2667 | irq_domain_free_irqs_parent(domain, virq, nr_irqs); |
| 2596 | } | 2668 | } |
| 2597 | 2669 | ||
| @@ -2754,26 +2826,11 @@ static void its_vpe_schedule(struct its_vpe *vpe) · 156 unmodified lines | |||
| 2754 | static void its_vpe_deschedule(struct its_vpe *vpe) | 2826 | static void its_vpe_deschedule(struct its_vpe *vpe) |
| 2755 | { | 2827 | { |
| 2756 | void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); | 2828 | void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); |
| 2757 | u32 count = 1000000; /* 1s! */ | ||
| 2758 | bool clean; | ||
| 2759 | u64 val; | 2829 | u64 val; |
| 2760 | 2830 | ||
| 2761 | /* We're being scheduled out */ | 2831 | val = its_clear_vpend_valid(vlpi_base); |
| 2762 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
| 2763 | val &= ~GICR_VPENDBASER_Valid; | ||
| 2764 | gits_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER); | ||
| 2765 | |||
| 2766 | do { | ||
| 2767 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
| 2768 | clean = !(val & GICR_VPENDBASER_Dirty); | ||
| 2769 | if (!clean) { | ||
| 2770 | count--; | ||
| 2771 | cpu_relax(); | ||
| 2772 | udelay(1); | ||
| 2773 | } | ||
| 2774 | } while (!clean && count); | ||
| 2775 | 2832 | ||
| 2776 | if (unlikely(!clean && !count)) { | 2833 | if (unlikely(val & GICR_VPENDBASER_Dirty)) { |
| 2777 | pr_err_ratelimited("ITS virtual pending table not cleaning\n"); | 2834 | pr_err_ratelimited("ITS virtual pending table not cleaning\n"); |
| 2778 | vpe->idai = false; | 2835 | vpe->idai = false; |
| 2779 | vpe->pending_last = true; | 2836 | vpe->pending_last = true; |
| @@ -3516,6 +3573,7 @@ static int __init its_probe_one(struct resource *res, · 736 unmodified lines | |||
| 3516 | } | 3573 | } |
| 3517 | 3574 | ||
| 3518 | raw_spin_lock_init(&its->lock); | 3575 | raw_spin_lock_init(&its->lock); |
| 3576 | mutex_init(&its->dev_alloc_lock); | ||
| 3519 | INIT_LIST_HEAD(&its->entry); | 3577 | INIT_LIST_HEAD(&its->entry); |
| 3520 | INIT_LIST_HEAD(&its->its_device_list); | 3578 | INIT_LIST_HEAD(&its->its_device_list); |
| 3521 | typer = gic_read_typer(its_base + GITS_TYPER); | 3579 | typer = gic_read_typer(its_base + GITS_TYPER); |
| @@ -24,7 +24,7 @@ struct mbi_range { · 23 unmodified lines | |||
| 24 | unsigned long *bm; | 24 | unsigned long *bm; |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | static struct mutex mbi_lock; | 27 | static DEFINE_MUTEX(mbi_lock); |
| 28 | static phys_addr_t mbi_phys_base; | 28 | static phys_addr_t mbi_phys_base; |
| 29 | static struct mbi_range *mbi_ranges; | 29 | static struct mbi_range *mbi_ranges; |
| 30 | static unsigned int mbi_range_nr; | 30 | static unsigned int mbi_range_nr; |
| @@ -7,7 +7,6 @@ · 6 unmodified lines | |||
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
| 10 | #include <linux/gpio.h> | ||
| 11 | #include <linux/interrupt.h> | 10 | #include <linux/interrupt.h> |
| 12 | #include <linux/irq.h> | 11 | #include <linux/irq.h> |
| 13 | #include <linux/irqdomain.h> | 12 | #include <linux/irqdomain.h> |
| @@ -16,7 +15,6 @@ · 2 unmodified lines | |||
| 16 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
| 17 | #include <linux/of.h> | 16 | #include <linux/of.h> |
| 18 | #include <linux/of_device.h> | 17 | #include <linux/of_device.h> |
| 19 | #include <linux/of_gpio.h> | ||
| 20 | #include <linux/of_irq.h> | 18 | #include <linux/of_irq.h> |
| 21 | #include <linux/irqchip/irq-madera.h> | 19 | #include <linux/irqchip/irq-madera.h> |
| 22 | #include <linux/mfd/madera/core.h> | 20 | #include <linux/mfd/madera/core.h> |
| @@ -34,6 +34,9 @@ · 33 unmodified lines | |||
| 34 | #define SEL_INT_PENDING (1 << 6) | 34 | #define SEL_INT_PENDING (1 << 6) |
| 35 | #define SEL_INT_NUM_MASK 0x3f | 35 | #define SEL_INT_NUM_MASK 0x3f |
| 36 | 36 | ||
| 37 | #define MMP2_ICU_INT_ROUTE_PJ4_IRQ (1 << 5) | ||
| 38 | #define MMP2_ICU_INT_ROUTE_PJ4_FIQ (1 << 6) | ||
| 39 | |||
| 37 | struct icu_chip_data { | 40 | struct icu_chip_data { |
| 38 | int nr_irqs; | 41 | int nr_irqs; |
| 39 | unsigned int virq_base; | 42 | unsigned int virq_base; |
| @@ -190,7 +193,8 @@ static const struct mmp_intc_conf mmp_conf = { · 150 unmodified lines | |||
| 190 | static const struct mmp_intc_conf mmp2_conf = { | 193 | static const struct mmp_intc_conf mmp2_conf = { |
| 191 | .conf_enable = 0x20, | 194 | .conf_enable = 0x20, |
| 192 | .conf_disable = 0x0, | 195 | .conf_disable = 0x0, |
| 193 | .conf_mask = 0x7f, | 196 | .conf_mask = MMP2_ICU_INT_ROUTE_PJ4_IRQ | |
| 197 | MMP2_ICU_INT_ROUTE_PJ4_FIQ, | ||
| 194 | }; | 198 | }; |
| 195 | 199 | ||
| 196 | static void __exception_irq_entry mmp_handle_irq(struct pt_regs *regs) | 200 | static void __exception_irq_entry mmp_handle_irq(struct pt_regs *regs) |
| @@ -822,6 +822,7 @@ out_unmap: · 821 unmodified lines | |||
| 822 | static const struct irq_domain_ops stm32_exti_h_domain_ops = { | 822 | static const struct irq_domain_ops stm32_exti_h_domain_ops = { |
| 823 | .alloc = stm32_exti_h_domain_alloc, | 823 | .alloc = stm32_exti_h_domain_alloc, |
| 824 | .free = irq_domain_free_irqs_common, | 824 | .free = irq_domain_free_irqs_common, |
| 825 | .xlate = irq_domain_xlate_twocell, | ||
| 825 | }; | 826 | }; |
| 826 | 827 | ||
| 827 | static int | 828 | static int |
| @@ -71,14 +71,17 @@ static void xtensa_mx_irq_mask(struct irq_data *d) · 70 unmodified lines | |||
| 71 | unsigned int mask = 1u << d->hwirq; | 71 | unsigned int mask = 1u << d->hwirq; |
| 72 | 72 | ||
| 73 | if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE | | 73 | if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE | |
| 74 | XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { | 74 | XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { |
| 75 | set_er(1u << (xtensa_get_ext_irq_no(d->hwirq) - | 75 | unsigned int ext_irq = xtensa_get_ext_irq_no(d->hwirq); |
| 76 | HW_IRQ_MX_BASE), MIENG); | 76 | |
| 77 | } else { | 77 | if (ext_irq >= HW_IRQ_MX_BASE) { |
| 78 | mask = __this_cpu_read(cached_irq_mask) & ~mask; | 78 | set_er(1u << (ext_irq - HW_IRQ_MX_BASE), MIENG); |
| 79 | __this_cpu_write(cached_irq_mask, mask); | 79 | return; |
| 80 | xtensa_set_sr(mask, intenable); | 80 | } |
| 81 | } | 81 | } |
| 82 | mask = __this_cpu_read(cached_irq_mask) & ~mask; | ||
| 83 | __this_cpu_write(cached_irq_mask, mask); | ||
| 84 | xtensa_set_sr(mask, intenable); | ||
| 82 | } | 85 | } |
| 83 | 86 | ||
| 84 | static void xtensa_mx_irq_unmask(struct irq_data *d) | 87 | static void xtensa_mx_irq_unmask(struct irq_data *d) |
| @@ -86,14 +89,17 @@ static void xtensa_mx_irq_unmask(struct irq_data *d) · 1 unmodified line | |||
| 86 | unsigned int mask = 1u << d->hwirq; | 89 | unsigned int mask = 1u << d->hwirq; |
| 87 | 90 | ||
| 88 | if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE | | 91 | if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE | |
| 89 | XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { | 92 | XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { |
| 90 | set_er(1u << (xtensa_get_ext_irq_no(d->hwirq) - | 93 | unsigned int ext_irq = xtensa_get_ext_irq_no(d->hwirq); |
| 91 | HW_IRQ_MX_BASE), MIENGSET); | 94 | |
| 92 | } else { | 95 | if (ext_irq >= HW_IRQ_MX_BASE) { |
| 93 | mask |= __this_cpu_read(cached_irq_mask); | 96 | set_er(1u << (ext_irq - HW_IRQ_MX_BASE), MIENGSET); |
| 94 | __this_cpu_write(cached_irq_mask, mask); | 97 | return; |
| 95 | xtensa_set_sr(mask, intenable); | 98 | } |
| 96 | } | 99 | } |
| 100 | mask |= __this_cpu_read(cached_irq_mask); | ||
| 101 | __this_cpu_write(cached_irq_mask, mask); | ||
| 102 | xtensa_set_sr(mask, intenable); | ||
| 97 | } | 103 | } |
| 98 | 104 | ||
| 99 | static void xtensa_mx_irq_enable(struct irq_data *d) | 105 | static void xtensa_mx_irq_enable(struct irq_data *d) |
| @@ -113,7 +119,11 @@ static void xtensa_mx_irq_ack(struct irq_data *d) · 13 unmodified lines | |||
| 113 | 119 | ||
| 114 | static int xtensa_mx_irq_retrigger(struct irq_data *d) | 120 | static int xtensa_mx_irq_retrigger(struct irq_data *d) |
| 115 | { | 121 | { |
| 116 | xtensa_set_sr(1 << d->hwirq, intset); | 122 | unsigned int mask = 1u << d->hwirq; |
| 123 | |||
| 124 | if (WARN_ON(mask & ~XCHAL_INTTYPE_MASK_SOFTWARE)) | ||
| 125 | return 0; | ||
| 126 | xtensa_set_sr(mask, intset); | ||
| 117 | return 1; | 127 | return 1; |
| 118 | } | 128 | } |
| 119 | 129 | ||
| @@ -70,7 +70,11 @@ static void xtensa_irq_ack(struct irq_data *d) · 69 unmodified lines | |||
| 70 | 70 | ||
| 71 | static int xtensa_irq_retrigger(struct irq_data *d) | 71 | static int xtensa_irq_retrigger(struct irq_data *d) |
| 72 | { | 72 | { |
| 73 | xtensa_set_sr(1 << d->hwirq, intset); | 73 | unsigned int mask = 1u << d->hwirq; |
| 74 | |||
| 75 | if (WARN_ON(mask & ~XCHAL_INTTYPE_MASK_SOFTWARE)) | ||
| 76 | return 0; | ||
| 77 | xtensa_set_sr(mask, intset); | ||
| 74 | return 1; | 78 | return 1; |
| 75 | } | 79 | } |
| 76 | 80 | ||
| @@ -423,7 +423,7 @@ void b1_parse_version(avmctrl_info *cinfo) · 422 unmodified lines | |||
| 423 | int i, j; | 423 | int i, j; |
| 424 | 424 | ||
| 425 | for (j = 0; j < AVM_MAXVERSION; j++) | 425 | for (j = 0; j < AVM_MAXVERSION; j++) |
| 426 | cinfo->version[j] = "\0\0" + 1; | 426 | cinfo->version[j] = ""; |
| 427 | for (i = 0, j = 0; | 427 | for (i = 0, j = 0; |
| 428 | j < AVM_MAXVERSION && i < cinfo->versionlen; | 428 | j < AVM_MAXVERSION && i < cinfo->versionlen; |
| 429 | j++, i += cinfo->versionbuf[i] + 1) | 429 | j++, i += cinfo->versionbuf[i] + 1) |
| @@ -262,8 +262,7 @@ hfcsusb_ph_info(struct hfcsusb *hw) · 261 unmodified lines | |||
| 262 | struct dchannel *dch = &hw->dch; | 262 | struct dchannel *dch = &hw->dch; |
| 263 | int i; | 263 | int i; |
| 264 | 264 | ||
| 265 | phi = kzalloc(sizeof(struct ph_info) + | 265 | phi = kzalloc(struct_size(phi, bch, dch->dev.nrbchan), GFP_ATOMIC); |
| 266 | dch->dev.nrbchan * sizeof(struct ph_info_ch), GFP_ATOMIC); | ||
| 267 | phi->dch.ch.protocol = hw->protocol; | 266 | phi->dch.ch.protocol = hw->protocol; |
| 268 | phi->dch.ch.Flags = dch->Flags; | 267 | phi->dch.ch.Flags = dch->Flags; |
| 269 | phi->dch.state = dch->state; | 268 | phi->dch.state = dch->state; |
| @@ -1437,15 +1437,19 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios) · 1436 unmodified lines | |||
| 1437 | { | 1437 | { |
| 1438 | modem_info *info = (modem_info *) tty->driver_data; | 1438 | modem_info *info = (modem_info *) tty->driver_data; |
| 1439 | 1439 | ||
| 1440 | mutex_lock(&modem_info_mutex); | ||
| 1440 | if (!old_termios) | 1441 | if (!old_termios) |
| 1441 | isdn_tty_change_speed(info); | 1442 | isdn_tty_change_speed(info); |
| 1442 | else { | 1443 | else { |
| 1443 | if (tty->termios.c_cflag == old_termios->c_cflag && | 1444 | if (tty->termios.c_cflag == old_termios->c_cflag && |
| 1444 | tty->termios.c_ispeed == old_termios->c_ispeed && | 1445 | tty->termios.c_ispeed == old_termios->c_ispeed && |
| 1445 | tty->termios.c_ospeed == old_termios->c_ospeed) | 1446 | tty->termios.c_ospeed == old_termios->c_ospeed) { |
| 1447 | mutex_unlock(&modem_info_mutex); | ||
| 1446 | return; | 1448 | return; |
| 1449 | } | ||
| 1447 | isdn_tty_change_speed(info); | 1450 | isdn_tty_change_speed(info); |
| 1448 | } | 1451 | } |
| 1452 | mutex_unlock(&modem_info_mutex); | ||
| 1449 | } | 1453 | } |
| 1450 | 1454 | ||
| 1451 | /* | 1455 | /* |
| @@ -170,8 +170,8 @@ dev_expire_timer(struct timer_list *t) · 169 unmodified lines | |||
| 170 | spin_lock_irqsave(&timer->dev->lock, flags); | 170 | spin_lock_irqsave(&timer->dev->lock, flags); |
| 171 | if (timer->id >= 0) | 171 | if (timer->id >= 0) |
| 172 | list_move_tail(&timer->list, &timer->dev->expired); | 172 | list_move_tail(&timer->list, &timer->dev->expired); |
| 173 | spin_unlock_irqrestore(&timer->dev->lock, flags); | ||
| 174 | wake_up_interruptible(&timer->dev->wait); | 173 | wake_up_interruptible(&timer->dev->wait); |
| 174 | spin_unlock_irqrestore(&timer->dev->lock, flags); | ||
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | static int | 177 | static int |
| @@ -318,7 +318,9 @@ static int lp5523_init_program_engine(struct lp55xx_chip *chip) · 317 unmodified lines | |||
| 318 | 318 | ||
| 319 | /* Let the programs run for couple of ms and check the engine status */ | 319 | /* Let the programs run for couple of ms and check the engine status */ |
| 320 | usleep_range(3000, 6000); | 320 | usleep_range(3000, 6000); |
| 321 | lp55xx_read(chip, LP5523_REG_STATUS, &status); | 321 | ret = lp55xx_read(chip, LP5523_REG_STATUS, &status); |
| 322 | if (ret) | ||
| 323 | return ret; | ||
| 322 | status &= LP5523_ENG_STATUS_MASK; | 324 | status &= LP5523_ENG_STATUS_MASK; |
| 323 | 325 | ||
| 324 | if (status != LP5523_ENG_STATUS_MASK) { | 326 | if (status != LP5523_ENG_STATUS_MASK) { |
| @@ -2414,9 +2414,21 @@ static int crypt_ctr_cipher_new(struct dm_target *ti, char *cipher_in, char *key · 2413 unmodified lines | |||
| 2414 | * capi:cipher_api_spec-iv:ivopts | 2414 | * capi:cipher_api_spec-iv:ivopts |
| 2415 | */ | 2415 | */ |
| 2416 | tmp = &cipher_in[strlen("capi:")]; | 2416 | tmp = &cipher_in[strlen("capi:")]; |
| 2417 | cipher_api = strsep(&tmp, "-"); | 2417 | |
| 2418 | *ivmode = strsep(&tmp, ":"); | 2418 | /* Separate IV options if present, it can contain another '-' in hash name */ |
| 2419 | *ivopts = tmp; | 2419 | *ivopts = strrchr(tmp, ':'); |
| 2420 | if (*ivopts) { | ||
| 2421 | **ivopts = '\0'; | ||
| 2422 | (*ivopts)++; | ||
| 2423 | } | ||
| 2424 | /* Parse IV mode */ | ||
| 2425 | *ivmode = strrchr(tmp, '-'); | ||
| 2426 | if (*ivmode) { | ||
| 2427 | **ivmode = '\0'; | ||
| 2428 | (*ivmode)++; | ||
| 2429 | } | ||
| 2430 | /* The rest is crypto API spec */ | ||
| 2431 | cipher_api = tmp; | ||
| 2420 | 2432 | ||
| 2421 | if (*ivmode && !strcmp(*ivmode, "lmk")) | 2433 | if (*ivmode && !strcmp(*ivmode, "lmk")) |
| 2422 | cc->tfms_count = 64; | 2434 | cc->tfms_count = 64; |
| @@ -2486,11 +2498,8 @@ static int crypt_ctr_cipher_old(struct dm_target *ti, char *cipher_in, char *key · 63 unmodified lines | |||
| 2486 | goto bad_mem; | 2498 | goto bad_mem; |
| 2487 | 2499 | ||
| 2488 | chainmode = strsep(&tmp, "-"); | 2500 | chainmode = strsep(&tmp, "-"); |
| 2489 | *ivopts = strsep(&tmp, "-"); | 2501 | *ivmode = strsep(&tmp, ":"); |
| 2490 | *ivmode = strsep(&*ivopts, ":"); | 2502 | *ivopts = tmp; |
| 2491 | |||
| 2492 | if (tmp) | ||
| 2493 | DMWARN("Ignoring unexpected additional cipher options"); | ||
| 2494 | 2503 | ||
| 2495 | /* | 2504 | /* |
| 2496 | * For compatibility with the original dm-crypt mapping format, if | 2505 | * For compatibility with the original dm-crypt mapping format, if |
| @@ -131,7 +131,7 @@ static void rq_end_stats(struct mapped_device *md, struct request *orig) · 130 unmodified lines | |||
| 131 | static void rq_completed(struct mapped_device *md) | 131 | static void rq_completed(struct mapped_device *md) |
| 132 | { | 132 | { |
| 133 | /* nudge anyone waiting on suspend queue */ | 133 | /* nudge anyone waiting on suspend queue */ |
| 134 | if (unlikely(waitqueue_active(&md->wait))) | 134 | if (unlikely(wq_has_sleeper(&md->wait))) |
| 135 | wake_up(&md->wait); | 135 | wake_up(&md->wait); |
| 136 | 136 | ||
| 137 | /* | 137 | /* |
| @@ -1678,7 +1678,7 @@ int dm_thin_remove_range(struct dm_thin_device *td, · 1677 unmodified lines | |||
| 1678 | return r; | 1678 | return r; |
| 1679 | } | 1679 | } |
| 1680 | 1680 | ||
| 1681 | int dm_pool_block_is_used(struct dm_pool_metadata *pmd, dm_block_t b, bool *result) | 1681 | int dm_pool_block_is_shared(struct dm_pool_metadata *pmd, dm_block_t b, bool *result) |
| 1682 | { | 1682 | { |
| 1683 | int r; | 1683 | int r; |
| 1684 | uint32_t ref_count; | 1684 | uint32_t ref_count; |
| @@ -1686,7 +1686,7 @@ int dm_pool_block_is_used(struct dm_pool_metadata *pmd, dm_block_t b, bool *resu · 1 unmodified line | |||
| 1686 | down_read(&pmd->root_lock); | 1686 | down_read(&pmd->root_lock); |
| 1687 | r = dm_sm_get_count(pmd->data_sm, b, &ref_count); | 1687 | r = dm_sm_get_count(pmd->data_sm, b, &ref_count); |
| 1688 | if (!r) | 1688 | if (!r) |
| 1689 | *result = (ref_count != 0); | 1689 | *result = (ref_count > 1); |
| 1690 | up_read(&pmd->root_lock); | 1690 | up_read(&pmd->root_lock); |
| 1691 | 1691 | ||
| 1692 | return r; | 1692 | return r; |
| @@ -195,7 +195,7 @@ int dm_pool_get_metadata_dev_size(struct dm_pool_metadata *pmd, · 194 unmodified lines | |||
| 195 | 195 | ||
| 196 | int dm_pool_get_data_dev_size(struct dm_pool_metadata *pmd, dm_block_t *result); | 196 | int dm_pool_get_data_dev_size(struct dm_pool_metadata *pmd, dm_block_t *result); |
| 197 | 197 | ||
| 198 | int dm_pool_block_is_used(struct dm_pool_metadata *pmd, dm_block_t b, bool *result); | 198 | int dm_pool_block_is_shared(struct dm_pool_metadata *pmd, dm_block_t b, bool *result); |
| 199 | 199 | ||
| 200 | int dm_pool_inc_data_range(struct dm_pool_metadata *pmd, dm_block_t b, dm_block_t e); | 200 | int dm_pool_inc_data_range(struct dm_pool_metadata *pmd, dm_block_t b, dm_block_t e); |
| 201 | int dm_pool_dec_data_range(struct dm_pool_metadata *pmd, dm_block_t b, dm_block_t e); | 201 | int dm_pool_dec_data_range(struct dm_pool_metadata *pmd, dm_block_t b, dm_block_t e); |
| @@ -1048,7 +1048,7 @@ static void passdown_double_checking_shared_status(struct dm_thin_new_mapping *m · 1047 unmodified lines | |||
| 1048 | * passdown we have to check that these blocks are now unused. | 1048 | * passdown we have to check that these blocks are now unused. |
| 1049 | */ | 1049 | */ |
| 1050 | int r = 0; | 1050 | int r = 0; |
| 1051 | bool used = true; | 1051 | bool shared = true; |
| 1052 | struct thin_c *tc = m->tc; | 1052 | struct thin_c *tc = m->tc; |
| 1053 | struct pool *pool = tc->pool; | 1053 | struct pool *pool = tc->pool; |
| 1054 | dm_block_t b = m->data_block, e, end = m->data_block + m->virt_end - m->virt_begin; | 1054 | dm_block_t b = m->data_block, e, end = m->data_block + m->virt_end - m->virt_begin; |
| @@ -1058,11 +1058,11 @@ static void passdown_double_checking_shared_status(struct dm_thin_new_mapping *m · 3 unmodified lines | |||
| 1058 | while (b != end) { | 1058 | while (b != end) { |
| 1059 | /* find start of unmapped run */ | 1059 | /* find start of unmapped run */ |
| 1060 | for (; b < end; b++) { | 1060 | for (; b < end; b++) { |
| 1061 | r = dm_pool_block_is_used(pool->pmd, b, &used); | 1061 | r = dm_pool_block_is_shared(pool->pmd, b, &shared); |
| 1062 | if (r) | 1062 | if (r) |
| 1063 | goto out; | 1063 | goto out; |
| 1064 | 1064 | ||
| 1065 | if (!used) | 1065 | if (!shared) |
| 1066 | break; | 1066 | break; |
| 1067 | } | 1067 | } |
| 1068 | 1068 | ||
| @@ -1071,11 +1071,11 @@ static void passdown_double_checking_shared_status(struct dm_thin_new_mapping *m · 2 unmodified lines | |||
| 1071 | 1071 | ||
| 1072 | /* find end of run */ | 1072 | /* find end of run */ |
| 1073 | for (e = b + 1; e != end; e++) { | 1073 | for (e = b + 1; e != end; e++) { |
| 1074 | r = dm_pool_block_is_used(pool->pmd, e, &used); | 1074 | r = dm_pool_block_is_shared(pool->pmd, e, &shared); |
| 1075 | if (r) | 1075 | if (r) |
| 1076 | goto out; | 1076 | goto out; |
| 1077 | 1077 | ||
| 1078 | if (used) | 1078 | if (shared) |
| 1079 | break; | 1079 | break; |
| 1080 | } | 1080 | } |
| 1081 | 1081 | ||
| @@ -699,7 +699,7 @@ static void end_io_acct(struct dm_io *io) · 698 unmodified lines | |||
| 699 | true, duration, &io->stats_aux); | 699 | true, duration, &io->stats_aux); |
| 700 | 700 | ||
| 701 | /* nudge anyone waiting on suspend queue */ | 701 | /* nudge anyone waiting on suspend queue */ |
| 702 | if (unlikely(waitqueue_active(&md->wait))) | 702 | if (unlikely(wq_has_sleeper(&md->wait))) |
| 703 | wake_up(&md->wait); | 703 | wake_up(&md->wait); |
| 704 | } | 704 | } |
| 705 | 705 | ||
| @@ -1320,7 +1320,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, · 614 unmodified lines | |||
| 1320 | 1320 | ||
| 1321 | __bio_clone_fast(clone, bio); | 1321 | __bio_clone_fast(clone, bio); |
| 1322 | 1322 | ||
| 1323 | if (unlikely(bio_integrity(bio) != NULL)) { | 1323 | if (bio_integrity(bio)) { |
| 1324 | int r; | 1324 | int r; |
| 1325 | 1325 | ||
| 1326 | if (unlikely(!dm_target_has_integrity(tio->ti->type) && | 1326 | if (unlikely(!dm_target_has_integrity(tio->ti->type) && |
| @@ -1339,7 +1339,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, · 12 unmodified lines | |||
| 1339 | bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector)); | 1339 | bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector)); |
| 1340 | clone->bi_iter.bi_size = to_bytes(len); | 1340 | clone->bi_iter.bi_size = to_bytes(len); |
| 1341 | 1341 | ||
| 1342 | if (unlikely(bio_integrity(bio) != NULL)) | 1342 | if (bio_integrity(bio)) |
| 1343 | bio_integrity_trim(clone); | 1343 | bio_integrity_trim(clone); |
| 1344 | 1344 | ||
| 1345 | return 0; | 1345 | return 0; |
| @@ -1588,6 +1588,9 @@ static void init_clone_info(struct clone_info *ci, struct mapped_device *md, · 242 unmodified lines | |||
| 1588 | ci->sector = bio->bi_iter.bi_sector; | 1588 | ci->sector = bio->bi_iter.bi_sector; |
| 1589 | } | 1589 | } |
| 1590 | 1590 | ||
| 1591 | #define __dm_part_stat_sub(part, field, subnd) \ | ||
| 1592 | (part_stat_get(part, field) -= (subnd)) | ||
| 1593 | |||
| 1591 | /* | 1594 | /* |
| 1592 | * Entry point to split a bio into clones and submit them to the targets. | 1595 | * Entry point to split a bio into clones and submit them to the targets. |
| 1593 | */ | 1596 | */ |
| @@ -1642,7 +1645,21 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md, · 48 unmodified lines | |||
| 1642 | struct bio *b = bio_split(bio, bio_sectors(bio) - ci.sector_count, | 1645 | struct bio *b = bio_split(bio, bio_sectors(bio) - ci.sector_count, |
| 1643 | GFP_NOIO, &md->queue->bio_split); | 1646 | GFP_NOIO, &md->queue->bio_split); |
| 1644 | ci.io->orig_bio = b; | 1647 | ci.io->orig_bio = b; |
| 1648 | |||
| 1649 | /* | ||
| 1650 | * Adjust IO stats for each split, otherwise upon queue | ||
| 1651 | * reentry there will be redundant IO accounting. | ||
| 1652 | * NOTE: this is a stop-gap fix, a proper fix involves | ||
| 1653 | * significant refactoring of DM core's bio splitting | ||
| 1654 | * (by eliminating DM's splitting and just using bio_split) | ||
| 1655 | */ | ||
| 1656 | part_stat_lock(); | ||
| 1657 | __dm_part_stat_sub(&dm_disk(md)->part0, | ||
| 1658 | sectors[op_stat_group(bio_op(bio))], ci.sector_count); | ||
| 1659 | part_stat_unlock(); | ||
| 1660 | |||
| 1645 | bio_chain(b, bio); | 1661 | bio_chain(b, bio); |
| 1662 | trace_block_split(md->queue, b, bio->bi_iter.bi_sector); | ||
| 1646 | ret = generic_make_request(bio); | 1663 | ret = generic_make_request(bio); |
| 1647 | break; | 1664 | break; |
| 1648 | } | 1665 | } |
| @@ -1713,6 +1730,15 @@ out: · 64 unmodified lines | |||
| 1713 | return ret; | 1730 | return ret; |
| 1714 | } | 1731 | } |
| 1715 | 1732 | ||
| 1733 | static blk_qc_t dm_process_bio(struct mapped_device *md, | ||
| 1734 | struct dm_table *map, struct bio *bio) | ||
| 1735 | { | ||
| 1736 | if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED) | ||
| 1737 | return __process_bio(md, map, bio); | ||
| 1738 | else | ||
| 1739 | return __split_and_process_bio(md, map, bio); | ||
| 1740 | } | ||
| 1741 | |||
| 1716 | static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio) | 1742 | static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio) |
| 1717 | { | 1743 | { |
| 1718 | struct mapped_device *md = q->queuedata; | 1744 | struct mapped_device *md = q->queuedata; |
| @@ -1733,10 +1759,7 @@ static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio) · 14 unmodified lines | |||
| 1733 | return ret; | 1759 | return ret; |
| 1734 | } | 1760 | } |
| 1735 | 1761 | ||
| 1736 | if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED) | 1762 | ret = dm_process_bio(md, map, bio); |
| 1737 | ret = __process_bio(md, map, bio); | ||
| 1738 | else | ||
| 1739 | ret = __split_and_process_bio(md, map, bio); | ||
| 1740 | 1763 | ||
| 1741 | dm_put_live_table(md, srcu_idx); | 1764 | dm_put_live_table(md, srcu_idx); |
| 1742 | return ret; | 1765 | return ret; |
| @@ -2415,9 +2438,9 @@ static void dm_wq_work(struct work_struct *work) · 672 unmodified lines | |||
| 2415 | break; | 2438 | break; |
| 2416 | 2439 | ||
| 2417 | if (dm_request_based(md)) | 2440 | if (dm_request_based(md)) |
| 2418 | generic_make_request(c); | 2441 | (void) generic_make_request(c); |
| 2419 | else | 2442 | else |
| 2420 | __split_and_process_bio(md, map, c); | 2443 | (void) dm_process_bio(md, map, c); |
| 2421 | } | 2444 | } |
| 2422 | 2445 | ||
| 2423 | dm_put_live_table(md, srcu_idx); | 2446 | dm_put_live_table(md, srcu_idx); |
| @@ -207,15 +207,10 @@ static bool create_on_open = true; · 206 unmodified lines | |||
| 207 | struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, | 207 | struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, |
| 208 | struct mddev *mddev) | 208 | struct mddev *mddev) |
| 209 | { | 209 | { |
| 210 | struct bio *b; | ||
| 211 | |||
| 212 | if (!mddev || !bioset_initialized(&mddev->bio_set)) | 210 | if (!mddev || !bioset_initialized(&mddev->bio_set)) |
| 213 | return bio_alloc(gfp_mask, nr_iovecs); | 211 | return bio_alloc(gfp_mask, nr_iovecs); |
| 214 | 212 | ||
| 215 | b = bio_alloc_bioset(gfp_mask, nr_iovecs, &mddev->bio_set); | 213 | return bio_alloc_bioset(gfp_mask, nr_iovecs, &mddev->bio_set); |
| 216 | if (!b) | ||
| 217 | return NULL; | ||
| 218 | return b; | ||
| 219 | } | 214 | } |
| 220 | EXPORT_SYMBOL_GPL(bio_alloc_mddev); | 215 | EXPORT_SYMBOL_GPL(bio_alloc_mddev); |
| 221 | 216 | ||
| @@ -1935,12 +1935,14 @@ out: · 1934 unmodified lines | |||
| 1935 | } | 1935 | } |
| 1936 | 1936 | ||
| 1937 | static struct stripe_head * | 1937 | static struct stripe_head * |
| 1938 | r5c_recovery_alloc_stripe(struct r5conf *conf, | 1938 | r5c_recovery_alloc_stripe( |
| 1939 | sector_t stripe_sect) | 1939 | struct r5conf *conf, |
| 1940 | sector_t stripe_sect, | ||
| 1941 | int noblock) | ||
| 1940 | { | 1942 | { |
| 1941 | struct stripe_head *sh; | 1943 | struct stripe_head *sh; |
| 1942 | 1944 | ||
| 1943 | sh = raid5_get_active_stripe(conf, stripe_sect, 0, 1, 0); | 1945 | sh = raid5_get_active_stripe(conf, stripe_sect, 0, noblock, 0); |
| 1944 | if (!sh) | 1946 | if (!sh) |
| 1945 | return NULL; /* no more stripe available */ | 1947 | return NULL; /* no more stripe available */ |
| 1946 | 1948 | ||
| @@ -2150,7 +2152,7 @@ r5c_recovery_analyze_meta_block(struct r5l_log *log, · 203 unmodified lines | |||
| 2150 | stripe_sect); | 2152 | stripe_sect); |
| 2151 | 2153 | ||
| 2152 | if (!sh) { | 2154 | if (!sh) { |
| 2153 | sh = r5c_recovery_alloc_stripe(conf, stripe_sect); | 2155 | sh = r5c_recovery_alloc_stripe(conf, stripe_sect, 1); |
| 2154 | /* | 2156 | /* |
| 2155 | * cannot get stripe from raid5_get_active_stripe | 2157 | * cannot get stripe from raid5_get_active_stripe |
| 2156 | * try replay some stripes | 2158 | * try replay some stripes |
| @@ -2159,20 +2161,29 @@ r5c_recovery_analyze_meta_block(struct r5l_log *log, · 2 unmodified lines | |||
| 2159 | r5c_recovery_replay_stripes( | 2161 | r5c_recovery_replay_stripes( |
| 2160 | cached_stripe_list, ctx); | 2162 | cached_stripe_list, ctx); |
| 2161 | sh = r5c_recovery_alloc_stripe( | 2163 | sh = r5c_recovery_alloc_stripe( |
| 2162 | conf, stripe_sect); | 2164 | conf, stripe_sect, 1); |
| 2163 | } | 2165 | } |
| 2164 | if (!sh) { | 2166 | if (!sh) { |
| 2167 | int new_size = conf->min_nr_stripes * 2; | ||
| 2165 | pr_debug("md/raid:%s: Increasing stripe cache size to %d to recovery data on journal.\n", | 2168 | pr_debug("md/raid:%s: Increasing stripe cache size to %d to recovery data on journal.\n", |
| 2166 | mdname(mddev), | 2169 | mdname(mddev), |
| 2167 | conf->min_nr_stripes * 2); | 2170 | new_size); |
| 2168 | raid5_set_cache_size(mddev, | 2171 | ret = raid5_set_cache_size(mddev, new_size); |
| 2169 | conf->min_nr_stripes * 2); | 2172 | if (conf->min_nr_stripes <= new_size / 2) { |
| 2170 | sh = r5c_recovery_alloc_stripe(conf, | 2173 | pr_err("md/raid:%s: Cannot increase cache size, ret=%d, new_size=%d, min_nr_stripes=%d, max_nr_stripes=%d\n", |
| 2171 | stripe_sect); | 2174 | mdname(mddev), |
| 2175 | ret, | ||
| 2176 | new_size, | ||
| 2177 | conf->min_nr_stripes, | ||
| 2178 | conf->max_nr_stripes); | ||
| 2179 | return -ENOMEM; | ||
| 2180 | } | ||
| 2181 | sh = r5c_recovery_alloc_stripe( | ||
| 2182 | conf, stripe_sect, 0); | ||
| 2172 | } | 2183 | } |
| 2173 | if (!sh) { | 2184 | if (!sh) { |
| 2174 | pr_err("md/raid:%s: Cannot get enough stripes due to memory pressure. Recovery failed.\n", | 2185 | pr_err("md/raid:%s: Cannot get enough stripes due to memory pressure. Recovery failed.\n", |
| 2175 | mdname(mddev)); | 2186 | mdname(mddev)); |
| 2176 | return -ENOMEM; | 2187 | return -ENOMEM; |
| 2177 | } | 2188 | } |
| 2178 | list_add_tail(&sh->lru, cached_stripe_list); | 2189 | list_add_tail(&sh->lru, cached_stripe_list); |
| @@ -6369,6 +6369,7 @@ raid5_show_stripe_cache_size(struct mddev *mddev, char *page) · 6368 unmodified lines | |||
| 6369 | int | 6369 | int |
| 6370 | raid5_set_cache_size(struct mddev *mddev, int size) | 6370 | raid5_set_cache_size(struct mddev *mddev, int size) |
| 6371 | { | 6371 | { |
| 6372 | int result = 0; | ||
| 6372 | struct r5conf *conf = mddev->private; | 6373 | struct r5conf *conf = mddev->private; |
| 6373 | 6374 | ||
| 6374 | if (size <= 16 || size > 32768) | 6375 | if (size <= 16 || size > 32768) |
| @@ -6385,11 +6386,14 @@ raid5_set_cache_size(struct mddev *mddev, int size) · 10 unmodified lines | |||
| 6385 | 6386 | ||
| 6386 | mutex_lock(&conf->cache_size_mutex); | 6387 | mutex_lock(&conf->cache_size_mutex); |
| 6387 | while (size > conf->max_nr_stripes) | 6388 | while (size > conf->max_nr_stripes) |
| 6388 | if (!grow_one_stripe(conf, GFP_KERNEL)) | 6389 | if (!grow_one_stripe(conf, GFP_KERNEL)) { |
| 6390 | conf->min_nr_stripes = conf->max_nr_stripes; | ||
| 6391 | result = -ENOMEM; | ||
| 6389 | break; | 6392 | break; |
| 6393 | } | ||
| 6390 | mutex_unlock(&conf->cache_size_mutex); | 6394 | mutex_unlock(&conf->cache_size_mutex); |
| 6391 | 6395 | ||
| 6392 | return 0; | 6396 | return result; |
| 6393 | } | 6397 | } |
| 6394 | EXPORT_SYMBOL(raid5_set_cache_size); | 6398 | EXPORT_SYMBOL(raid5_set_cache_size); |
| 6395 | 6399 | ||
| @@ -218,8 +218,8 @@ static int cio2_fbpt_init(struct cio2_device *cio2, struct cio2_queue *q) · 217 unmodified lines | |||
| 218 | { | 218 | { |
| 219 | struct device *dev = &cio2->pci_dev->dev; | 219 | struct device *dev = &cio2->pci_dev->dev; |
| 220 | 220 | ||
| 221 | q->fbpt = dma_zalloc_coherent(dev, CIO2_FBPT_SIZE, &q->fbpt_bus_addr, | 221 | q->fbpt = dma_alloc_coherent(dev, CIO2_FBPT_SIZE, &q->fbpt_bus_addr, |
| 222 | GFP_KERNEL); | 222 | GFP_KERNEL); |
| 223 | if (!q->fbpt) | 223 | if (!q->fbpt) |
| 224 | return -ENOMEM; | 224 | return -ENOMEM; |
| 225 | 225 | ||
| @@ -49,7 +49,7 @@ int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx *data, · 48 unmodified lines | |||
| 49 | struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; | 49 | struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; |
| 50 | struct device *dev = &ctx->dev->plat_dev->dev; | 50 | struct device *dev = &ctx->dev->plat_dev->dev; |
| 51 | 51 | ||
| 52 | mem->va = dma_zalloc_coherent(dev, size, &mem->dma_addr, GFP_KERNEL); | 52 | mem->va = dma_alloc_coherent(dev, size, &mem->dma_addr, GFP_KERNEL); |
| 53 | if (!mem->va) { | 53 | if (!mem->va) { |
| 54 | mtk_v4l2_err("%s dma_alloc size=%ld failed!", dev_name(dev), | 54 | mtk_v4l2_err("%s dma_alloc size=%ld failed!", dev_name(dev), |
| 55 | size); | 55 | size); |
| @@ -807,7 +807,9 @@ static void vim2m_stop_streaming(struct vb2_queue *q) · 806 unmodified lines | |||
| 807 | struct vb2_v4l2_buffer *vbuf; | 807 | struct vb2_v4l2_buffer *vbuf; |
| 808 | unsigned long flags; | 808 | unsigned long flags; |
| 809 | 809 | ||
| 810 | cancel_delayed_work_sync(&dev->work_run); | 810 | if (v4l2_m2m_get_curr_priv(dev->m2m_dev) == ctx) |
| 811 | cancel_delayed_work_sync(&dev->work_run); | ||
| 812 | |||
| 811 | for (;;) { | 813 | for (;;) { |
| 812 | if (V4L2_TYPE_IS_OUTPUT(q->type)) | 814 | if (V4L2_TYPE_IS_OUTPUT(q->type)) |
| 813 | vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); | 815 | vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); |
| @@ -287,6 +287,7 @@ static void v4l_print_format(const void *arg, bool write_only) · 286 unmodified lines | |||
| 287 | const struct v4l2_window *win; | 287 | const struct v4l2_window *win; |
| 288 | const struct v4l2_sdr_format *sdr; | 288 | const struct v4l2_sdr_format *sdr; |
| 289 | const struct v4l2_meta_format *meta; | 289 | const struct v4l2_meta_format *meta; |
| 290 | u32 planes; | ||
| 290 | unsigned i; | 291 | unsigned i; |
| 291 | 292 | ||
| 292 | pr_cont("type=%s", prt_names(p->type, v4l2_type_names)); | 293 | pr_cont("type=%s", prt_names(p->type, v4l2_type_names)); |
| @@ -317,7 +318,8 @@ static void v4l_print_format(const void *arg, bool write_only) · 24 unmodified lines | |||
| 317 | prt_names(mp->field, v4l2_field_names), | 318 | prt_names(mp->field, v4l2_field_names), |
| 318 | mp->colorspace, mp->num_planes, mp->flags, | 319 | mp->colorspace, mp->num_planes, mp->flags, |
| 319 | mp->ycbcr_enc, mp->quantization, mp->xfer_func); | 320 | mp->ycbcr_enc, mp->quantization, mp->xfer_func); |
| 320 | for (i = 0; i < mp->num_planes; i++) | 321 | planes = min_t(u32, mp->num_planes, VIDEO_MAX_PLANES); |
| 322 | for (i = 0; i < planes; i++) | ||
| 321 | printk(KERN_DEBUG "plane %u: bytesperline=%u sizeimage=%u\n", i, | 323 | printk(KERN_DEBUG "plane %u: bytesperline=%u sizeimage=%u\n", i, |
| 322 | mp->plane_fmt[i].bytesperline, | 324 | mp->plane_fmt[i].bytesperline, |
| 323 | mp->plane_fmt[i].sizeimage); | 325 | mp->plane_fmt[i].sizeimage); |
| @@ -1551,8 +1553,11 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, · 1227 unmodified lines | |||
| 1551 | if (unlikely(!ops->vidioc_s_fmt_vid_cap_mplane)) | 1553 | if (unlikely(!ops->vidioc_s_fmt_vid_cap_mplane)) |
| 1552 | break; | 1554 | break; |
| 1553 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); | 1555 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); |
| 1556 | if (p->fmt.pix_mp.num_planes > VIDEO_MAX_PLANES) | ||
| 1557 | break; | ||
| 1554 | for (i = 0; i < p->fmt.pix_mp.num_planes; i++) | 1558 | for (i = 0; i < p->fmt.pix_mp.num_planes; i++) |
| 1555 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline); | 1559 | CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i], |
| 1560 | bytesperline); | ||
| 1556 | return ops->vidioc_s_fmt_vid_cap_mplane(file, fh, arg); | 1561 | return ops->vidioc_s_fmt_vid_cap_mplane(file, fh, arg); |
| 1557 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: | 1562 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: |
| 1558 | if (unlikely(!ops->vidioc_s_fmt_vid_overlay)) | 1563 | if (unlikely(!ops->vidioc_s_fmt_vid_overlay)) |
| @@ -1581,8 +1586,11 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, · 22 unmodified lines | |||
| 1581 | if (unlikely(!ops->vidioc_s_fmt_vid_out_mplane)) | 1586 | if (unlikely(!ops->vidioc_s_fmt_vid_out_mplane)) |
| 1582 | break; | 1587 | break; |
| 1583 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); | 1588 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); |
| 1589 | if (p->fmt.pix_mp.num_planes > VIDEO_MAX_PLANES) | ||
| 1590 | break; | ||
| 1584 | for (i = 0; i < p->fmt.pix_mp.num_planes; i++) | 1591 | for (i = 0; i < p->fmt.pix_mp.num_planes; i++) |
| 1585 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline); | 1592 | CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i], |
| 1593 | bytesperline); | ||
| 1586 | return ops->vidioc_s_fmt_vid_out_mplane(file, fh, arg); | 1594 | return ops->vidioc_s_fmt_vid_out_mplane(file, fh, arg); |
| 1587 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: | 1595 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: |
| 1588 | if (unlikely(!ops->vidioc_s_fmt_vid_out_overlay)) | 1596 | if (unlikely(!ops->vidioc_s_fmt_vid_out_overlay)) |
| @@ -1648,8 +1656,11 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, · 59 unmodified lines | |||
| 1648 | if (unlikely(!ops->vidioc_try_fmt_vid_cap_mplane)) | 1656 | if (unlikely(!ops->vidioc_try_fmt_vid_cap_mplane)) |
| 1649 | break; | 1657 | break; |
| 1650 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); | 1658 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); |
| 1659 | if (p->fmt.pix_mp.num_planes > VIDEO_MAX_PLANES) | ||
| 1660 | break; | ||
| 1651 | for (i = 0; i < p->fmt.pix_mp.num_planes; i++) | 1661 | for (i = 0; i < p->fmt.pix_mp.num_planes; i++) |
| 1652 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline); | 1662 | CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i], |
| 1663 | bytesperline); | ||
| 1653 | return ops->vidioc_try_fmt_vid_cap_mplane(file, fh, arg); | 1664 | return ops->vidioc_try_fmt_vid_cap_mplane(file, fh, arg); |
| 1654 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: | 1665 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: |
| 1655 | if (unlikely(!ops->vidioc_try_fmt_vid_overlay)) | 1666 | if (unlikely(!ops->vidioc_try_fmt_vid_overlay)) |
| @@ -1678,8 +1689,11 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, · 22 unmodified lines | |||
| 1678 | if (unlikely(!ops->vidioc_try_fmt_vid_out_mplane)) | 1689 | if (unlikely(!ops->vidioc_try_fmt_vid_out_mplane)) |
| 1679 | break; | 1690 | break; |
| 1680 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); | 1691 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); |
| 1692 | if (p->fmt.pix_mp.num_planes > VIDEO_MAX_PLANES) | ||
| 1693 | break; | ||
| 1681 | for (i = 0; i < p->fmt.pix_mp.num_planes; i++) | 1694 | for (i = 0; i < p->fmt.pix_mp.num_planes; i++) |
| 1682 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline); | 1695 | CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i], |
| 1696 | bytesperline); | ||
| 1683 | return ops->vidioc_try_fmt_vid_out_mplane(file, fh, arg); | 1697 | return ops->vidioc_try_fmt_vid_out_mplane(file, fh, arg); |
| 1684 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: | 1698 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: |
| 1685 | if (unlikely(!ops->vidioc_try_fmt_vid_out_overlay)) | 1699 | if (unlikely(!ops->vidioc_try_fmt_vid_out_overlay)) |
| @@ -102,6 +102,7 @@ config MFD_AAT2870_CORE · 101 unmodified lines | |||
| 102 | config MFD_AT91_USART | 102 | config MFD_AT91_USART |
| 103 | tristate "AT91 USART Driver" | 103 | tristate "AT91 USART Driver" |
| 104 | select MFD_CORE | 104 | select MFD_CORE |
| 105 | depends on ARCH_AT91 || COMPILE_TEST | ||
| 105 | help | 106 | help |
| 106 | Select this to get support for AT91 USART IP. This is a wrapper | 107 | Select this to get support for AT91 USART IP. This is a wrapper |
| 107 | over at91-usart-serial driver and usart-spi-driver. Only one function | 108 | over at91-usart-serial driver and usart-spi-driver. Only one function |
| @@ -1418,7 +1419,7 @@ config MFD_TPS65217 · 1310 unmodified lines | |||
| 1418 | 1419 | ||
| 1419 | config MFD_TPS68470 | 1420 | config MFD_TPS68470 |
| 1420 | bool "TI TPS68470 Power Management / LED chips" | 1421 | bool "TI TPS68470 Power Management / LED chips" |
| 1421 | depends on ACPI && I2C=y | 1422 | depends on ACPI && PCI && I2C=y |
| 1422 | select MFD_CORE | 1423 | select MFD_CORE |
| 1423 | select REGMAP_I2C | 1424 | select REGMAP_I2C |
| 1424 | select I2C_DESIGNWARE_PLATFORM | 1425 | select I2C_DESIGNWARE_PLATFORM |
| @@ -261,7 +261,7 @@ static int get_register_interruptible(struct ab8500 *ab8500, u8 bank, · 260 unmodified lines | |||
| 261 | mutex_unlock(&ab8500->lock); | 261 | mutex_unlock(&ab8500->lock); |
| 262 | dev_vdbg(ab8500->dev, "rd: addr %#x => data %#x\n", addr, ret); | 262 | dev_vdbg(ab8500->dev, "rd: addr %#x => data %#x\n", addr, ret); |
| 263 | 263 | ||
| 264 | return ret; | 264 | return (ret < 0) ? ret : 0; |
| 265 | } | 265 | } |
| 266 | 266 | ||
| 267 | static int ab8500_get_register(struct device *dev, u8 bank, | 267 | static int ab8500_get_register(struct device *dev, u8 bank, |
| @@ -641,9 +641,9 @@ static const struct mfd_cell axp221_cells[] = { · 640 unmodified lines | |||
| 641 | 641 | ||
| 642 | static const struct mfd_cell axp223_cells[] = { | 642 | static const struct mfd_cell axp223_cells[] = { |
| 643 | { | 643 | { |
| 644 | .name = "axp221-pek", | 644 | .name = "axp221-pek", |
| 645 | .num_resources = ARRAY_SIZE(axp22x_pek_resources), | 645 | .num_resources = ARRAY_SIZE(axp22x_pek_resources), |
| 646 | .resources = axp22x_pek_resources, | 646 | .resources = axp22x_pek_resources, |
| 647 | }, { | 647 | }, { |
| 648 | .name = "axp22x-adc", | 648 | .name = "axp22x-adc", |
| 649 | .of_compatible = "x-powers,axp221-adc", | 649 | .of_compatible = "x-powers,axp221-adc", |
| @@ -651,7 +651,7 @@ static const struct mfd_cell axp223_cells[] = { · 1 unmodified line | |||
| 651 | .name = "axp20x-battery-power-supply", | 651 | .name = "axp20x-battery-power-supply", |
| 652 | .of_compatible = "x-powers,axp221-battery-power-supply", | 652 | .of_compatible = "x-powers,axp221-battery-power-supply", |
| 653 | }, { | 653 | }, { |
| 654 | .name = "axp20x-regulator", | 654 | .name = "axp20x-regulator", |
| 655 | }, { | 655 | }, { |
| 656 | .name = "axp20x-ac-power-supply", | 656 | .name = "axp20x-ac-power-supply", |
| 657 | .of_compatible = "x-powers,axp221-ac-power-supply", | 657 | .of_compatible = "x-powers,axp221-ac-power-supply", |
| @@ -667,9 +667,9 @@ static const struct mfd_cell axp223_cells[] = { · 9 unmodified lines | |||
| 667 | 667 | ||
| 668 | static const struct mfd_cell axp152_cells[] = { | 668 | static const struct mfd_cell axp152_cells[] = { |
| 669 | { | 669 | { |
| 670 | .name = "axp20x-pek", | 670 | .name = "axp20x-pek", |
| 671 | .num_resources = ARRAY_SIZE(axp152_pek_resources), | 671 | .num_resources = ARRAY_SIZE(axp152_pek_resources), |
| 672 | .resources = axp152_pek_resources, | 672 | .resources = axp152_pek_resources, |
| 673 | }, | 673 | }, |
| 674 | }; | 674 | }; |
| 675 | 675 | ||
| @@ -698,87 +698,101 @@ static const struct resource axp288_charger_resources[] = { · 22 unmodified lines | |||
| 698 | 698 | ||
| 699 | static const struct mfd_cell axp288_cells[] = { | 699 | static const struct mfd_cell axp288_cells[] = { |
| 700 | { | 700 | { |
| 701 | .name = "axp288_adc", | 701 | .name = "axp288_adc", |
| 702 | .num_resources = ARRAY_SIZE(axp288_adc_resources), | 702 | .num_resources = ARRAY_SIZE(axp288_adc_resources), |
| 703 | .resources = axp288_adc_resources, | 703 | .resources = axp288_adc_resources, |
| 704 | }, | 704 | }, { |
| 705 | { | 705 | .name = "axp288_extcon", |
| 706 | .name = "axp288_extcon", | 706 | .num_resources = ARRAY_SIZE(axp288_extcon_resources), |
| 707 | .num_resources = ARRAY_SIZE(axp288_extcon_resources), | 707 | .resources = axp288_extcon_resources, |
| 708 | .resources = axp288_extcon_resources, | 708 | }, { |
| 709 | }, | 709 | .name = "axp288_charger", |
| 710 | { | 710 | .num_resources = ARRAY_SIZE(axp288_charger_resources), |
| 711 | .name = "axp288_charger", | 711 | .resources = axp288_charger_resources, |
| 712 | .num_resources = ARRAY_SIZE(axp288_charger_resources), | 712 | }, { |
| 713 | .resources = axp288_charger_resources, | 713 | .name = "axp288_fuel_gauge", |
| 714 | }, | 714 | .num_resources = ARRAY_SIZE(axp288_fuel_gauge_resources), |
| 715 | { | 715 | .resources = axp288_fuel_gauge_resources, |
| 716 | .name = "axp288_fuel_gauge", | 716 | }, { |
| 717 | .num_resources = ARRAY_SIZE(axp288_fuel_gauge_resources), | 717 | .name = "axp221-pek", |
| 718 | .resources = axp288_fuel_gauge_resources, | 718 | .num_resources = ARRAY_SIZE(axp288_power_button_resources), |
| 719 | }, | 719 | .resources = axp288_power_button_resources, |
| 720 | { | 720 | }, { |
| 721 | .name = "axp221-pek", | 721 | .name = "axp288_pmic_acpi", |
| 722 | .num_resources = ARRAY_SIZE(axp288_power_button_resources), | ||
| 723 | .resources = axp288_power_button_resources, | ||
| 724 | }, | ||
| 725 | { | ||
| 726 | .name = "axp288_pmic_acpi", | ||
| 727 | }, | 722 | }, |
| 728 | }; | 723 | }; |
| 729 | 724 | ||
| 730 | static const struct mfd_cell axp803_cells[] = { | 725 | static const struct mfd_cell axp803_cells[] = { |
| 731 | { | 726 | { |
| 732 | .name = "axp221-pek", | 727 | .name = "axp221-pek", |
| 733 | .num_resources = ARRAY_SIZE(axp803_pek_resources), | 728 | .num_resources = ARRAY_SIZE(axp803_pek_resources), |
| 734 | .resources = axp803_pek_resources, | 729 | .resources = axp803_pek_resources, |
| 730 | }, { | ||
| 731 | .name = "axp20x-gpio", | ||
| 732 | .of_compatible = "x-powers,axp813-gpio", | ||
| 733 | }, { | ||
| 734 | .name = "axp813-adc", | ||
| 735 | .of_compatible = "x-powers,axp813-adc", | ||
| 736 | }, { | ||
| 737 | .name = "axp20x-battery-power-supply", | ||
| 738 | .of_compatible = "x-powers,axp813-battery-power-supply", | ||
| 739 | }, { | ||
| 740 | .name = "axp20x-ac-power-supply", | ||
| 741 | .of_compatible = "x-powers,axp813-ac-power-supply", | ||
| 742 | .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources), | ||
| 743 | .resources = axp20x_ac_power_supply_resources, | ||
| 735 | }, | 744 | }, |
| 736 | { .name = "axp20x-regulator" }, | 745 | { .name = "axp20x-regulator" }, |
| 737 | }; | 746 | }; |
| 738 | 747 | ||
| 739 | static const struct mfd_cell axp806_self_working_cells[] = { | 748 | static const struct mfd_cell axp806_self_working_cells[] = { |
| 740 | { | 749 | { |
| 741 | .name = "axp221-pek", | 750 | .name = "axp221-pek", |
| 742 | .num_resources = ARRAY_SIZE(axp806_pek_resources), | 751 | .num_resources = ARRAY_SIZE(axp806_pek_resources), |
| 743 | .resources = axp806_pek_resources, | 752 | .resources = axp806_pek_resources, |
| 744 | }, | 753 | }, |
| 745 | { .name = "axp20x-regulator" }, | 754 | { .name = "axp20x-regulator" }, |
| 746 | }; | 755 | }; |
| 747 | 756 | ||
| 748 | static const struct mfd_cell axp806_cells[] = { | 757 | static const struct mfd_cell axp806_cells[] = { |
| 749 | { | 758 | { |
| 750 | .id = 2, | 759 | .id = 2, |
| 751 | .name = "axp20x-regulator", | 760 | .name = "axp20x-regulator", |
| 752 | }, | 761 | }, |
| 753 | }; | 762 | }; |
| 754 | 763 | ||
| 755 | static const struct mfd_cell axp809_cells[] = { | 764 | static const struct mfd_cell axp809_cells[] = { |
| 756 | { | 765 | { |
| 757 | .name = "axp221-pek", | 766 | .name = "axp221-pek", |
| 758 | .num_resources = ARRAY_SIZE(axp809_pek_resources), | 767 | .num_resources = ARRAY_SIZE(axp809_pek_resources), |
| 759 | .resources = axp809_pek_resources, | 768 | .resources = axp809_pek_resources, |
| 760 | }, { | 769 | }, { |
| 761 | .id = 1, | 770 | .id = 1, |
| 762 | .name = "axp20x-regulator", | 771 | .name = "axp20x-regulator", |
| 763 | }, | 772 | }, |
| 764 | }; | 773 | }; |
| 765 | 774 | ||
| 766 | static const struct mfd_cell axp813_cells[] = { | 775 | static const struct mfd_cell axp813_cells[] = { |
| 767 | { | 776 | { |
| 768 | .name = "axp221-pek", | 777 | .name = "axp221-pek", |
| 769 | .num_resources = ARRAY_SIZE(axp803_pek_resources), | 778 | .num_resources = ARRAY_SIZE(axp803_pek_resources), |
| 770 | .resources = axp803_pek_resources, | 779 | .resources = axp803_pek_resources, |
| 771 | }, { | 780 | }, { |
| 772 | .name = "axp20x-regulator", | 781 | .name = "axp20x-regulator", |
| 773 | }, { | 782 | }, { |
| 774 | .name = "axp20x-gpio", | 783 | .name = "axp20x-gpio", |
| 775 | .of_compatible = "x-powers,axp813-gpio", | 784 | .of_compatible = "x-powers,axp813-gpio", |
| 776 | }, { | 785 | }, { |
| 777 | .name = "axp813-adc", | 786 | .name = "axp813-adc", |
| 778 | .of_compatible = "x-powers,axp813-adc", | 787 | .of_compatible = "x-powers,axp813-adc", |
| 779 | }, { | 788 | }, { |
| 780 | .name = "axp20x-battery-power-supply", | 789 | .name = "axp20x-battery-power-supply", |
| 781 | .of_compatible = "x-powers,axp813-battery-power-supply", | 790 | .of_compatible = "x-powers,axp813-battery-power-supply", |
| 791 | }, { | ||
| 792 | .name = "axp20x-ac-power-supply", | ||
| 793 | .of_compatible = "x-powers,axp813-ac-power-supply", | ||
| 794 | .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources), | ||
| 795 | .resources = axp20x_ac_power_supply_resources, | ||
| 782 | }, | 796 | }, |
| 783 | }; | 797 | }; |
| 784 | 798 | ||
| @@ -59,6 +59,7 @@ static const struct regmap_access_table bd9571mwv_writable_table = { · 58 unmodified lines | |||
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | static const struct regmap_range bd9571mwv_volatile_yes_ranges[] = { | 61 | static const struct regmap_range bd9571mwv_volatile_yes_ranges[] = { |
| 62 | regmap_reg_range(BD9571MWV_DVFS_MONIVDAC, BD9571MWV_DVFS_MONIVDAC), | ||
| 62 | regmap_reg_range(BD9571MWV_GPIO_IN, BD9571MWV_GPIO_IN), | 63 | regmap_reg_range(BD9571MWV_GPIO_IN, BD9571MWV_GPIO_IN), |
| 63 | regmap_reg_range(BD9571MWV_GPIO_INT, BD9571MWV_GPIO_INT), | 64 | regmap_reg_range(BD9571MWV_GPIO_INT, BD9571MWV_GPIO_INT), |
| 64 | regmap_reg_range(BD9571MWV_INT_INTREQ, BD9571MWV_INT_INTREQ), | 65 | regmap_reg_range(BD9571MWV_INT_INTREQ, BD9571MWV_INT_INTREQ), |
| @@ -499,6 +499,7 @@ static int ec_device_remove(struct platform_device *pdev) · 498 unmodified lines | |||
| 499 | 499 | ||
| 500 | cros_ec_debugfs_remove(ec); | 500 | cros_ec_debugfs_remove(ec); |
| 501 | 501 | ||
| 502 | mfd_remove_devices(ec->dev); | ||
| 502 | cdev_del(&ec->cdev); | 503 | cdev_del(&ec->cdev); |
| 503 | device_unregister(&ec->class_dev); | 504 | device_unregister(&ec->class_dev); |
| 504 | return 0; | 505 | return 0; |
| @@ -2584,7 +2584,7 @@ static struct irq_chip prcmu_irq_chip = { · 2583 unmodified lines | |||
| 2584 | .irq_unmask = prcmu_irq_unmask, | 2584 | .irq_unmask = prcmu_irq_unmask, |
| 2585 | }; | 2585 | }; |
| 2586 | 2586 | ||
| 2587 | static __init char *fw_project_name(u32 project) | 2587 | static char *fw_project_name(u32 project) |
| 2588 | { | 2588 | { |
| 2589 | switch (project) { | 2589 | switch (project) { |
| 2590 | case PRCMU_FW_PROJECT_U8500: | 2590 | case PRCMU_FW_PROJECT_U8500: |
| @@ -2732,7 +2732,7 @@ void __init db8500_prcmu_early_init(u32 phy_base, u32 size) · 141 unmodified lines | |||
| 2732 | INIT_WORK(&mb0_transfer.mask_work, prcmu_mask_work); | 2732 | INIT_WORK(&mb0_transfer.mask_work, prcmu_mask_work); |
| 2733 | } | 2733 | } |
| 2734 | 2734 | ||
| 2735 | static void __init init_prcm_registers(void) | 2735 | static void init_prcm_registers(void) |
| 2736 | { | 2736 | { |
| 2737 | u32 val; | 2737 | u32 val; |
| 2738 | 2738 | ||
| @@ -82,11 +82,13 @@ static void exynos_lpass_enable(struct exynos_lpass *lpass) · 81 unmodified lines | |||
| 82 | LPASS_INTR_SFR | LPASS_INTR_DMA | LPASS_INTR_I2S); | 82 | LPASS_INTR_SFR | LPASS_INTR_DMA | LPASS_INTR_I2S); |
| 83 | 83 | ||
| 84 | regmap_write(lpass->top, SFR_LPASS_INTR_CPU_MASK, | 84 | regmap_write(lpass->top, SFR_LPASS_INTR_CPU_MASK, |
| 85 | LPASS_INTR_SFR | LPASS_INTR_DMA | LPASS_INTR_I2S); | 85 | LPASS_INTR_SFR | LPASS_INTR_DMA | LPASS_INTR_I2S | |
| 86 | LPASS_INTR_UART); | ||
| 86 | 87 | ||
| 87 | exynos_lpass_core_sw_reset(lpass, LPASS_I2S_SW_RESET); | 88 | exynos_lpass_core_sw_reset(lpass, LPASS_I2S_SW_RESET); |
| 88 | exynos_lpass_core_sw_reset(lpass, LPASS_DMA_SW_RESET); | 89 | exynos_lpass_core_sw_reset(lpass, LPASS_DMA_SW_RESET); |
| 89 | exynos_lpass_core_sw_reset(lpass, LPASS_MEM_SW_RESET); | 90 | exynos_lpass_core_sw_reset(lpass, LPASS_MEM_SW_RESET); |
| 91 | exynos_lpass_core_sw_reset(lpass, LPASS_UART_SW_RESET); | ||
| 90 | } | 92 | } |
| 91 | 93 | ||
| 92 | static void exynos_lpass_disable(struct exynos_lpass *lpass) | 94 | static void exynos_lpass_disable(struct exynos_lpass *lpass) |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | |||
| 15 | #include <linux/gpio.h> | 15 | #include <linux/gpio.h> |
| 16 | #include <linux/mfd/core.h> | 16 | #include <linux/mfd/core.h> |
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/mutex.h> | ||
| 18 | #include <linux/notifier.h> | 19 | #include <linux/notifier.h> |
| 19 | #include <linux/of.h> | 20 | #include <linux/of.h> |
| 20 | #include <linux/of_gpio.h> | 21 | #include <linux/of_gpio.h> |
| @@ -155,7 +156,7 @@ static int madera_wait_for_boot(struct madera *madera) · 134 unmodified lines | |||
| 155 | usleep_range(MADERA_BOOT_POLL_INTERVAL_USEC / 2, | 156 | usleep_range(MADERA_BOOT_POLL_INTERVAL_USEC / 2, |
| 156 | MADERA_BOOT_POLL_INTERVAL_USEC); | 157 | MADERA_BOOT_POLL_INTERVAL_USEC); |
| 157 | regmap_read(madera->regmap, MADERA_IRQ1_RAW_STATUS_1, &val); | 158 | regmap_read(madera->regmap, MADERA_IRQ1_RAW_STATUS_1, &val); |
| 158 | }; | 159 | } |
| 159 | 160 | ||
| 160 | if (!(val & MADERA_BOOT_DONE_STS1)) { | 161 | if (!(val & MADERA_BOOT_DONE_STS1)) { |
| 161 | dev_err(madera->dev, "Polling BOOT_DONE_STS timed out\n"); | 162 | dev_err(madera->dev, "Polling BOOT_DONE_STS timed out\n"); |
| @@ -357,6 +358,8 @@ int madera_dev_init(struct madera *madera) · 195 unmodified lines | |||
| 357 | 358 | ||
| 358 | dev_set_drvdata(madera->dev, madera); | 359 | dev_set_drvdata(madera->dev, madera); |
| 359 | BLOCKING_INIT_NOTIFIER_HEAD(&madera->notifier); | 360 | BLOCKING_INIT_NOTIFIER_HEAD(&madera->notifier); |
| 361 | mutex_init(&madera->dapm_ptr_lock); | ||
| 362 | |||
| 360 | madera_set_micbias_info(madera); | 363 | madera_set_micbias_info(madera); |
| 361 | 364 | ||
| 362 | /* | 365 | /* |
| @@ -280,7 +280,7 @@ static int max77620_config_fps(struct max77620_chip *chip, · 279 unmodified lines | |||
| 280 | 280 | ||
| 281 | for (fps_id = 0; fps_id < MAX77620_FPS_COUNT; fps_id++) { | 281 | for (fps_id = 0; fps_id < MAX77620_FPS_COUNT; fps_id++) { |
| 282 | sprintf(fps_name, "fps%d", fps_id); | 282 | sprintf(fps_name, "fps%d", fps_id); |
| 283 | if (!strcmp(fps_np->name, fps_name)) | 283 | if (of_node_name_eq(fps_np, fps_name)) |
| 284 | break; | 284 | break; |
| 285 | } | 285 | } |
| 286 | 286 | ||
| @@ -274,7 +274,9 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode, · 273 unmodified lines | |||
| 274 | 274 | ||
| 275 | mc13xxx->adcflags |= MC13XXX_ADC_WORKING; | 275 | mc13xxx->adcflags |= MC13XXX_ADC_WORKING; |
| 276 | 276 | ||
| 277 | mc13xxx_reg_read(mc13xxx, MC13XXX_ADC0, &old_adc0); | 277 | ret = mc13xxx_reg_read(mc13xxx, MC13XXX_ADC0, &old_adc0); |
| 278 | if (ret) | ||
| 279 | goto out; | ||
| 278 | 280 | ||
| 279 | adc0 = MC13XXX_ADC0_ADINC1 | MC13XXX_ADC0_ADINC2 | | 281 | adc0 = MC13XXX_ADC0_ADINC1 | MC13XXX_ADC0_ADINC2 | |
| 280 | MC13XXX_ADC0_CHRGRAWDIV; | 282 | MC13XXX_ADC0_CHRGRAWDIV; |
| @@ -329,8 +329,7 @@ static int mt6397_probe(struct platform_device *pdev) · 328 unmodified lines | |||
| 329 | 329 | ||
| 330 | default: | 330 | default: |
| 331 | dev_err(&pdev->dev, "unsupported chip: %d\n", id); | 331 | dev_err(&pdev->dev, "unsupported chip: %d\n", id); |
| 332 | ret = -ENODEV; | 332 | return -ENODEV; |
| 333 | break; | ||
| 334 | } | 333 | } |
| 335 | 334 | ||
| 336 | if (ret) { | 335 | if (ret) { |
| @@ -638,6 +638,10 @@ static int qcom_rpm_probe(struct platform_device *pdev) · 637 unmodified lines | |||
| 638 | return -EFAULT; | 638 | return -EFAULT; |
| 639 | } | 639 | } |
| 640 | 640 | ||
| 641 | writel(fw_version[0], RPM_CTRL_REG(rpm, 0)); | ||
| 642 | writel(fw_version[1], RPM_CTRL_REG(rpm, 1)); | ||
| 643 | writel(fw_version[2], RPM_CTRL_REG(rpm, 2)); | ||
| 644 | |||
| 641 | dev_info(&pdev->dev, "RPM firmware %u.%u.%u\n", fw_version[0], | 645 | dev_info(&pdev->dev, "RPM firmware %u.%u.%u\n", fw_version[0], |
| 642 | fw_version[1], | 646 | fw_version[1], |
| 643 | fw_version[2]); | 647 | fw_version[2]); |
| @@ -109,7 +109,7 @@ struct rave_sp_reply { · 108 unmodified lines | |||
| 109 | /** | 109 | /** |
| 110 | * struct rave_sp_checksum - Variant specific checksum implementation details | 110 | * struct rave_sp_checksum - Variant specific checksum implementation details |
| 111 | * | 111 | * |
| 112 | * @length: Caculated checksum length | 112 | * @length: Calculated checksum length |
| 113 | * @subroutine: Utilized checksum algorithm implementation | 113 | * @subroutine: Utilized checksum algorithm implementation |
| 114 | */ | 114 | */ |
| 115 | struct rave_sp_checksum { | 115 | struct rave_sp_checksum { |
| @@ -1302,17 +1302,17 @@ static void stmpe_of_probe(struct stmpe_platform_data *pdata, · 1301 unmodified lines | |||
| 1302 | pdata->autosleep = (pdata->autosleep_timeout) ? true : false; | 1302 | pdata->autosleep = (pdata->autosleep_timeout) ? true : false; |
| 1303 | 1303 | ||
| 1304 | for_each_child_of_node(np, child) { | 1304 | for_each_child_of_node(np, child) { |
| 1305 | if (!strcmp(child->name, "stmpe_gpio")) { | 1305 | if (of_node_name_eq(child, "stmpe_gpio")) { |
| 1306 | pdata->blocks |= STMPE_BLOCK_GPIO; | 1306 | pdata->blocks |= STMPE_BLOCK_GPIO; |
| 1307 | } else if (!strcmp(child->name, "stmpe_keypad")) { | 1307 | } else if (of_node_name_eq(child, "stmpe_keypad")) { |
| 1308 | pdata->blocks |= STMPE_BLOCK_KEYPAD; | 1308 | pdata->blocks |= STMPE_BLOCK_KEYPAD; |
| 1309 | } else if (!strcmp(child->name, "stmpe_touchscreen")) { | 1309 | } else if (of_node_name_eq(child, "stmpe_touchscreen")) { |
| 1310 | pdata->blocks |= STMPE_BLOCK_TOUCHSCREEN; | 1310 | pdata->blocks |= STMPE_BLOCK_TOUCHSCREEN; |
| 1311 | } else if (!strcmp(child->name, "stmpe_adc")) { | 1311 | } else if (of_node_name_eq(child, "stmpe_adc")) { |
| 1312 | pdata->blocks |= STMPE_BLOCK_ADC; | 1312 | pdata->blocks |= STMPE_BLOCK_ADC; |
| 1313 | } else if (!strcmp(child->name, "stmpe_pwm")) { | 1313 | } else if (of_node_name_eq(child, "stmpe_pwm")) { |
| 1314 | pdata->blocks |= STMPE_BLOCK_PWM; | 1314 | pdata->blocks |= STMPE_BLOCK_PWM; |
| 1315 | } else if (!strcmp(child->name, "stmpe_rotator")) { | 1315 | } else if (of_node_name_eq(child, "stmpe_rotator")) { |
| 1316 | pdata->blocks |= STMPE_BLOCK_ROTATOR; | 1316 | pdata->blocks |= STMPE_BLOCK_ROTATOR; |
| 1317 | } | 1317 | } |
| 1318 | } | 1318 | } |
| @@ -264,8 +264,9 @@ static int ti_tscadc_probe(struct platform_device *pdev) · 263 unmodified lines | |||
| 264 | cell->pdata_size = sizeof(tscadc); | 264 | cell->pdata_size = sizeof(tscadc); |
| 265 | } | 265 | } |
| 266 | 266 | ||
| 267 | err = mfd_add_devices(&pdev->dev, pdev->id, tscadc->cells, | 267 | err = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, |
| 268 | tscadc->used_cells, NULL, 0, NULL); | 268 | tscadc->cells, tscadc->used_cells, NULL, |
| 269 | 0, NULL); | ||
| 269 | if (err < 0) | 270 | if (err < 0) |
| 270 | goto err_disable_clk; | 271 | goto err_disable_clk; |
| 271 | 272 | ||
| @@ -235,9 +235,9 @@ static int tps65218_probe(struct i2c_client *client, · 234 unmodified lines | |||
| 235 | 235 | ||
| 236 | mutex_init(&tps->tps_lock); | 236 | mutex_init(&tps->tps_lock); |
| 237 | 237 | ||
| 238 | ret = regmap_add_irq_chip(tps->regmap, tps->irq, | 238 | ret = devm_regmap_add_irq_chip(&client->dev, tps->regmap, tps->irq, |
| 239 | IRQF_ONESHOT, 0, &tps65218_irq_chip, | 239 | IRQF_ONESHOT, 0, &tps65218_irq_chip, |
| 240 | &tps->irq_data); | 240 | &tps->irq_data); |
| 241 | if (ret < 0) | 241 | if (ret < 0) |
| 242 | return ret; | 242 | return ret; |
| 243 | 243 | ||
| @@ -253,26 +253,9 @@ static int tps65218_probe(struct i2c_client *client, · 9 unmodified lines | |||
| 253 | ARRAY_SIZE(tps65218_cells), NULL, 0, | 253 | ARRAY_SIZE(tps65218_cells), NULL, 0, |
| 254 | regmap_irq_get_domain(tps->irq_data)); | 254 | regmap_irq_get_domain(tps->irq_data)); |
| 255 | 255 | ||
| 256 | if (ret < 0) | ||
| 257 | goto err_irq; | ||
| 258 | |||
| 259 | return 0; | ||
| 260 | |||
| 261 | err_irq: | ||
| 262 | regmap_del_irq_chip(tps->irq, tps->irq_data); | ||
| 263 | |||
| 264 | return ret; | 256 | return ret; |
| 265 | } | 257 | } |
| 266 | 258 | ||
| 267 | static int tps65218_remove(struct i2c_client *client) | ||
| 268 | { | ||
| 269 | struct tps65218 *tps = i2c_get_clientdata(client); | ||
| 270 | |||
| 271 | regmap_del_irq_chip(tps->irq, tps->irq_data); | ||
| 272 | |||
| 273 | return 0; | ||
| 274 | } | ||
| 275 | |||
| 276 | static const struct i2c_device_id tps65218_id_table[] = { | 259 | static const struct i2c_device_id tps65218_id_table[] = { |
| 277 | { "tps65218", TPS65218 }, | 260 | { "tps65218", TPS65218 }, |
| 278 | { }, | 261 | { }, |
| @@ -285,7 +268,6 @@ static struct i2c_driver tps65218_driver = { · 6 unmodified lines | |||
| 285 | .of_match_table = of_tps65218_match_table, | 268 | .of_match_table = of_tps65218_match_table, |
| 286 | }, | 269 | }, |
| 287 | .probe = tps65218_probe, | 270 | .probe = tps65218_probe, |
| 288 | .remove = tps65218_remove, | ||
| 289 | .id_table = tps65218_id_table, | 271 | .id_table = tps65218_id_table, |
| 290 | }; | 272 | }; |
| 291 | 273 | ||
| @@ -592,6 +592,29 @@ static int tps6586x_i2c_remove(struct i2c_client *client) · 591 unmodified lines | |||
| 592 | return 0; | 592 | return 0; |
| 593 | } | 593 | } |
| 594 | 594 | ||
| 595 | static int __maybe_unused tps6586x_i2c_suspend(struct device *dev) | ||
| 596 | { | ||
| 597 | struct tps6586x *tps6586x = dev_get_drvdata(dev); | ||
| 598 | |||
| 599 | if (tps6586x->client->irq) | ||
| 600 | disable_irq(tps6586x->client->irq); | ||
| 601 | |||
| 602 | return 0; | ||
| 603 | } | ||
| 604 | |||
| 605 | static int __maybe_unused tps6586x_i2c_resume(struct device *dev) | ||
| 606 | { | ||
| 607 | struct tps6586x *tps6586x = dev_get_drvdata(dev); | ||
| 608 | |||
| 609 | if (tps6586x->client->irq) | ||
| 610 | enable_irq(tps6586x->client->irq); | ||
| 611 | |||
| 612 | return 0; | ||
| 613 | } | ||
| 614 | |||
| 615 | static SIMPLE_DEV_PM_OPS(tps6586x_pm_ops, tps6586x_i2c_suspend, | ||
| 616 | tps6586x_i2c_resume); | ||
| 617 | |||
| 595 | static const struct i2c_device_id tps6586x_id_table[] = { | 618 | static const struct i2c_device_id tps6586x_id_table[] = { |
| 596 | { "tps6586x", 0 }, | 619 | { "tps6586x", 0 }, |
| 597 | { }, | 620 | { }, |
| @@ -602,6 +625,7 @@ static struct i2c_driver tps6586x_driver = { · 4 unmodified lines | |||
| 602 | .driver = { | 625 | .driver = { |
| 603 | .name = "tps6586x", | 626 | .name = "tps6586x", |
| 604 | .of_match_table = of_match_ptr(tps6586x_of_match), | 627 | .of_match_table = of_match_ptr(tps6586x_of_match), |
| 628 | .pm = &tps6586x_pm_ops, | ||
| 605 | }, | 629 | }, |
| 606 | .probe = tps6586x_i2c_probe, | 630 | .probe = tps6586x_i2c_probe, |
| 607 | .remove = tps6586x_i2c_remove, | 631 | .remove = tps6586x_i2c_remove, |
| @@ -979,7 +979,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base, · 978 unmodified lines | |||
| 979 | * letting it generate the right frequencies for USB, MADC, and | 979 | * letting it generate the right frequencies for USB, MADC, and |
| 980 | * other purposes. | 980 | * other purposes. |
| 981 | */ | 981 | */ |
| 982 | static inline int __init protect_pm_master(void) | 982 | static inline int protect_pm_master(void) |
| 983 | { | 983 | { |
| 984 | int e = 0; | 984 | int e = 0; |
| 985 | 985 | ||
| @@ -988,7 +988,7 @@ static inline int __init protect_pm_master(void) · 2 unmodified lines | |||
| 988 | return e; | 988 | return e; |
| 989 | } | 989 | } |
| 990 | 990 | ||
| 991 | static inline int __init unprotect_pm_master(void) | 991 | static inline int unprotect_pm_master(void) |
| 992 | { | 992 | { |
| 993 | int e = 0; | 993 | int e = 0; |
| 994 | 994 | ||
| @@ -1618,6 +1618,7 @@ static const struct reg_default wm5110_reg_default[] = { · 1617 unmodified lines | |||
| 1618 | { 0x00000ECD, 0x0000 }, /* R3789 - HPLPF4_2 */ | 1618 | { 0x00000ECD, 0x0000 }, /* R3789 - HPLPF4_2 */ |
| 1619 | { 0x00000EE0, 0x0000 }, /* R3808 - ASRC_ENABLE */ | 1619 | { 0x00000EE0, 0x0000 }, /* R3808 - ASRC_ENABLE */ |
| 1620 | { 0x00000EE2, 0x0000 }, /* R3810 - ASRC_RATE1 */ | 1620 | { 0x00000EE2, 0x0000 }, /* R3810 - ASRC_RATE1 */ |
| 1621 | { 0x00000EE3, 0x4000 }, /* R3811 - ASRC_RATE2 */ | ||
| 1621 | { 0x00000EF0, 0x0000 }, /* R3824 - ISRC 1 CTRL 1 */ | 1622 | { 0x00000EF0, 0x0000 }, /* R3824 - ISRC 1 CTRL 1 */ |
| 1622 | { 0x00000EF1, 0x0000 }, /* R3825 - ISRC 1 CTRL 2 */ | 1623 | { 0x00000EF1, 0x0000 }, /* R3825 - ISRC 1 CTRL 2 */ |
| 1623 | { 0x00000EF2, 0x0000 }, /* R3826 - ISRC 1 CTRL 3 */ | 1624 | { 0x00000EF2, 0x0000 }, /* R3826 - ISRC 1 CTRL 3 */ |
| @@ -2869,6 +2870,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg) · 1245 unmodified lines | |||
| 2869 | case ARIZONA_ASRC_ENABLE: | 2870 | case ARIZONA_ASRC_ENABLE: |
| 2870 | case ARIZONA_ASRC_STATUS: | 2871 | case ARIZONA_ASRC_STATUS: |
| 2871 | case ARIZONA_ASRC_RATE1: | 2872 | case ARIZONA_ASRC_RATE1: |
| 2873 | case ARIZONA_ASRC_RATE2: | ||
| 2872 | case ARIZONA_ISRC_1_CTRL_1: | 2874 | case ARIZONA_ISRC_1_CTRL_1: |
| 2873 | case ARIZONA_ISRC_1_CTRL_2: | 2875 | case ARIZONA_ISRC_1_CTRL_2: |
| 2874 | case ARIZONA_ISRC_1_CTRL_3: | 2876 | case ARIZONA_ISRC_1_CTRL_3: |
| @@ -218,8 +218,8 @@ void *__genwqe_alloc_consistent(struct genwqe_dev *cd, size_t size, · 217 unmodified lines | |||
| 218 | if (get_order(size) >= MAX_ORDER) | 218 | if (get_order(size) >= MAX_ORDER) |
| 219 | return NULL; | 219 | return NULL; |
| 220 | 220 | ||
| 221 | return dma_zalloc_coherent(&cd->pci_dev->dev, size, dma_handle, | 221 | return dma_alloc_coherent(&cd->pci_dev->dev, size, dma_handle, |
| 222 | GFP_KERNEL); | 222 | GFP_KERNEL); |
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | void __genwqe_free_consistent(struct genwqe_dev *cd, size_t size, | 225 | void __genwqe_free_consistent(struct genwqe_dev *cd, size_t size, |
| @@ -820,21 +820,24 @@ static int ibmvmc_send_msg(struct crq_server_adapter *adapter, · 819 unmodified lines | |||
| 820 | * | 820 | * |
| 821 | * Return: | 821 | * Return: |
| 822 | * 0 - Success | 822 | * 0 - Success |
| 823 | * Non-zero - Failure | ||
| 823 | */ | 824 | */ |
| 824 | static int ibmvmc_open(struct inode *inode, struct file *file) | 825 | static int ibmvmc_open(struct inode *inode, struct file *file) |
| 825 | { | 826 | { |
| 826 | struct ibmvmc_file_session *session; | 827 | struct ibmvmc_file_session *session; |
| 827 | int rc = 0; | ||
| 828 | 828 | ||
| 829 | pr_debug("%s: inode = 0x%lx, file = 0x%lx, state = 0x%x\n", __func__, | 829 | pr_debug("%s: inode = 0x%lx, file = 0x%lx, state = 0x%x\n", __func__, |
| 830 | (unsigned long)inode, (unsigned long)file, | 830 | (unsigned long)inode, (unsigned long)file, |
| 831 | ibmvmc.state); | 831 | ibmvmc.state); |
| 832 | 832 | ||
| 833 | session = kzalloc(sizeof(*session), GFP_KERNEL); | 833 | session = kzalloc(sizeof(*session), GFP_KERNEL); |
| 834 | if (!session) | ||
| 835 | return -ENOMEM; | ||
| 836 | |||
| 834 | session->file = file; | 837 | session->file = file; |
| 835 | file->private_data = session; | 838 | file->private_data = session; |
| 836 | 839 | ||
| 837 | return rc; | 840 | return 0; |
| 838 | } | 841 | } |
| 839 | 842 | ||
| 840 | /** | 843 | /** |
| @@ -401,8 +401,11 @@ static void mei_io_list_flush_cl(struct list_head *head, · 400 unmodified lines | |||
| 401 | struct mei_cl_cb *cb, *next; | 401 | struct mei_cl_cb *cb, *next; |
| 402 | 402 | ||
| 403 | list_for_each_entry_safe(cb, next, head, list) { | 403 | list_for_each_entry_safe(cb, next, head, list) { |
| 404 | if (cl == cb->cl) | 404 | if (cl == cb->cl) { |
| 405 | list_del_init(&cb->list); | 405 | list_del_init(&cb->list); |
| 406 | if (cb->fop_type == MEI_FOP_READ) | ||
| 407 | mei_io_cb_free(cb); | ||
| 408 | } | ||
| 406 | } | 409 | } |
| 407 | } | 410 | } |
| 408 | 411 | ||
| @@ -1187,9 +1187,15 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) · 1186 unmodified lines | |||
| 1187 | dma_setup_res = (struct hbm_dma_setup_response *)mei_msg; | 1187 | dma_setup_res = (struct hbm_dma_setup_response *)mei_msg; |
| 1188 | 1188 | ||
| 1189 | if (dma_setup_res->status) { | 1189 | if (dma_setup_res->status) { |
| 1190 | dev_info(dev->dev, "hbm: dma setup response: failure = %d %s\n", | 1190 | u8 status = dma_setup_res->status; |
| 1191 | dma_setup_res->status, | 1191 | |
| 1192 | mei_hbm_status_str(dma_setup_res->status)); | 1192 | if (status == MEI_HBMS_NOT_ALLOWED) { |
| 1193 | dev_dbg(dev->dev, "hbm: dma setup not allowed\n"); | ||
| 1194 | } else { | ||
| 1195 | dev_info(dev->dev, "hbm: dma setup response: failure = %d %s\n", | ||
| 1196 | status, | ||
| 1197 | mei_hbm_status_str(status)); | ||
| 1198 | } | ||
| 1193 | dev->hbm_f_dr_supported = 0; | 1199 | dev->hbm_f_dr_supported = 0; |
| 1194 | mei_dmam_ring_free(dev); | 1200 | mei_dmam_ring_free(dev); |
| 1195 | } | 1201 | } |
| @@ -127,6 +127,8 @@ · 126 unmodified lines | |||
| 127 | #define MEI_DEV_ID_BXT_M 0x1A9A /* Broxton M */ | 127 | #define MEI_DEV_ID_BXT_M 0x1A9A /* Broxton M */ |
| 128 | #define MEI_DEV_ID_APL_I 0x5A9A /* Apollo Lake I */ | 128 | #define MEI_DEV_ID_APL_I 0x5A9A /* Apollo Lake I */ |
| 129 | 129 | ||
| 130 | #define MEI_DEV_ID_DNV_IE 0x19E5 /* Denverton IE */ | ||
| 131 | |||
| 130 | #define MEI_DEV_ID_GLK 0x319A /* Gemini Lake */ | 132 | #define MEI_DEV_ID_GLK 0x319A /* Gemini Lake */ |
| 131 | 133 | ||
| 132 | #define MEI_DEV_ID_KBP 0xA2BA /* Kaby Point */ | 134 | #define MEI_DEV_ID_KBP 0xA2BA /* Kaby Point */ |
| @@ -137,6 +139,8 @@ · 4 unmodified lines | |||
| 137 | #define MEI_DEV_ID_CNP_H 0xA360 /* Cannon Point H */ | 139 | #define MEI_DEV_ID_CNP_H 0xA360 /* Cannon Point H */ |
| 138 | #define MEI_DEV_ID_CNP_H_4 0xA364 /* Cannon Point H 4 (iTouch) */ | 140 | #define MEI_DEV_ID_CNP_H_4 0xA364 /* Cannon Point H 4 (iTouch) */ |
| 139 | 141 | ||
| 142 | #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */ | ||
| 143 | |||
| 140 | /* | 144 | /* |
| 141 | * MEI HW Section | 145 | * MEI HW Section |
| 142 | */ | 146 | */ |
| @@ -88,11 +88,13 @@ static const struct pci_device_id mei_me_pci_tbl[] = { · 87 unmodified lines | |||
| 88 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_2, MEI_ME_PCH8_CFG)}, | 88 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_2, MEI_ME_PCH8_CFG)}, |
| 89 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H, MEI_ME_PCH8_SPS_CFG)}, | 89 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H, MEI_ME_PCH8_SPS_CFG)}, |
| 90 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H_2, MEI_ME_PCH8_SPS_CFG)}, | 90 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H_2, MEI_ME_PCH8_SPS_CFG)}, |
| 91 | {MEI_PCI_DEVICE(MEI_DEV_ID_LBG, MEI_ME_PCH8_CFG)}, | 91 | {MEI_PCI_DEVICE(MEI_DEV_ID_LBG, MEI_ME_PCH12_CFG)}, |
| 92 | 92 | ||
| 93 | {MEI_PCI_DEVICE(MEI_DEV_ID_BXT_M, MEI_ME_PCH8_CFG)}, | 93 | {MEI_PCI_DEVICE(MEI_DEV_ID_BXT_M, MEI_ME_PCH8_CFG)}, |
| 94 | {MEI_PCI_DEVICE(MEI_DEV_ID_APL_I, MEI_ME_PCH8_CFG)}, | 94 | {MEI_PCI_DEVICE(MEI_DEV_ID_APL_I, MEI_ME_PCH8_CFG)}, |
| 95 | 95 | ||
| 96 | {MEI_PCI_DEVICE(MEI_DEV_ID_DNV_IE, MEI_ME_PCH8_CFG)}, | ||
| 97 | |||
| 96 | {MEI_PCI_DEVICE(MEI_DEV_ID_GLK, MEI_ME_PCH8_CFG)}, | 98 | {MEI_PCI_DEVICE(MEI_DEV_ID_GLK, MEI_ME_PCH8_CFG)}, |
| 97 | 99 | ||
| 98 | {MEI_PCI_DEVICE(MEI_DEV_ID_KBP, MEI_ME_PCH8_CFG)}, | 100 | {MEI_PCI_DEVICE(MEI_DEV_ID_KBP, MEI_ME_PCH8_CFG)}, |
| @@ -103,6 +105,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = { · 4 unmodified lines | |||
| 103 | {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_H, MEI_ME_PCH12_CFG)}, | 105 | {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_H, MEI_ME_PCH12_CFG)}, |
| 104 | {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_H_4, MEI_ME_PCH8_CFG)}, | 106 | {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_H_4, MEI_ME_PCH8_CFG)}, |
| 105 | 107 | ||
| 108 | {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)}, | ||
| 109 | |||
| 106 | /* required last entry */ | 110 | /* required last entry */ |
| 107 | {0, } | 111 | {0, } |
| 108 | }; | 112 | }; |
| @@ -47,7 +47,8 @@ · 46 unmodified lines | |||
| 47 | * @dc: Virtio device control | 47 | * @dc: Virtio device control |
| 48 | * @vpdev: VOP device which is the parent for this virtio device | 48 | * @vpdev: VOP device which is the parent for this virtio device |
| 49 | * @vr: Buffer for accessing the VRING | 49 | * @vr: Buffer for accessing the VRING |
| 50 | * @used: Buffer for used | 50 | * @used_virt: Virtual address of used ring |
| 51 | * @used: DMA address of used ring | ||
| 51 | * @used_size: Size of the used buffer | 52 | * @used_size: Size of the used buffer |
| 52 | * @reset_done: Track whether VOP reset is complete | 53 | * @reset_done: Track whether VOP reset is complete |
| 53 | * @virtio_cookie: Cookie returned upon requesting a interrupt | 54 | * @virtio_cookie: Cookie returned upon requesting a interrupt |
| @@ -61,6 +62,7 @@ struct _vop_vdev { · 7 unmodified lines | |||
| 61 | struct mic_device_ctrl __iomem *dc; | 62 | struct mic_device_ctrl __iomem *dc; |
| 62 | struct vop_device *vpdev; | 63 | struct vop_device *vpdev; |
| 63 | void __iomem *vr[VOP_MAX_VRINGS]; | 64 | void __iomem *vr[VOP_MAX_VRINGS]; |
| 65 | void *used_virt[VOP_MAX_VRINGS]; | ||
| 64 | dma_addr_t used[VOP_MAX_VRINGS]; | 66 | dma_addr_t used[VOP_MAX_VRINGS]; |
| 65 | int used_size[VOP_MAX_VRINGS]; | 67 | int used_size[VOP_MAX_VRINGS]; |
| 66 | struct completion reset_done; | 68 | struct completion reset_done; |
| @@ -260,12 +262,12 @@ static bool vop_notify(struct virtqueue *vq) · 193 unmodified lines | |||
| 260 | static void vop_del_vq(struct virtqueue *vq, int n) | 262 | static void vop_del_vq(struct virtqueue *vq, int n) |
| 261 | { | 263 | { |
| 262 | struct _vop_vdev *vdev = to_vopvdev(vq->vdev); | 264 | struct _vop_vdev *vdev = to_vopvdev(vq->vdev); |
| 263 | struct vring *vr = (struct vring *)(vq + 1); | ||
| 264 | struct vop_device *vpdev = vdev->vpdev; | 265 | struct vop_device *vpdev = vdev->vpdev; |
| 265 | 266 | ||
| 266 | dma_unmap_single(&vpdev->dev, vdev->used[n], | 267 | dma_unmap_single(&vpdev->dev, vdev->used[n], |
| 267 | vdev->used_size[n], DMA_BIDIRECTIONAL); | 268 | vdev->used_size[n], DMA_BIDIRECTIONAL); |
| 268 | free_pages((unsigned long)vr->used, get_order(vdev->used_size[n])); | 269 | free_pages((unsigned long)vdev->used_virt[n], |
| 270 | get_order(vdev->used_size[n])); | ||
| 269 | vring_del_virtqueue(vq); | 271 | vring_del_virtqueue(vq); |
| 270 | vpdev->hw_ops->iounmap(vpdev, vdev->vr[n]); | 272 | vpdev->hw_ops->iounmap(vpdev, vdev->vr[n]); |
| 271 | vdev->vr[n] = NULL; | 273 | vdev->vr[n] = NULL; |
| @@ -283,6 +285,26 @@ static void vop_del_vqs(struct virtio_device *dev) · 11 unmodified lines | |||
| 283 | vop_del_vq(vq, idx++); | 285 | vop_del_vq(vq, idx++); |
| 284 | } | 286 | } |
| 285 | 287 | ||
| 288 | static struct virtqueue *vop_new_virtqueue(unsigned int index, | ||
| 289 | unsigned int num, | ||
| 290 | struct virtio_device *vdev, | ||
| 291 | bool context, | ||
| 292 | void *pages, | ||
| 293 | bool (*notify)(struct virtqueue *vq), | ||
| 294 | void (*callback)(struct virtqueue *vq), | ||
| 295 | const char *name, | ||
| 296 | void *used) | ||
| 297 | { | ||
| 298 | bool weak_barriers = false; | ||
| 299 | struct vring vring; | ||
| 300 | |||
| 301 | vring_init(&vring, num, pages, MIC_VIRTIO_RING_ALIGN); | ||
| 302 | vring.used = used; | ||
| 303 | |||
| 304 | return __vring_new_virtqueue(index, vring, vdev, weak_barriers, context, | ||
| 305 | notify, callback, name); | ||
| 306 | } | ||
| 307 | |||
| 286 | /* | 308 | /* |
| 287 | * This routine will assign vring's allocated in host/io memory. Code in | 309 | * This routine will assign vring's allocated in host/io memory. Code in |
| 288 | * virtio_ring.c however continues to access this io memory as if it were local | 310 | * virtio_ring.c however continues to access this io memory as if it were local |
| @@ -302,7 +324,6 @@ static struct virtqueue *vop_find_vq(struct virtio_device *dev, · 13 unmodified lines | |||
| 302 | struct _mic_vring_info __iomem *info; | 324 | struct _mic_vring_info __iomem *info; |
| 303 | void *used; | 325 | void *used; |
| 304 | int vr_size, _vr_size, err, magic; | 326 | int vr_size, _vr_size, err, magic; |
| 305 | struct vring *vr; | ||
| 306 | u8 type = ioread8(&vdev->desc->type); | 327 | u8 type = ioread8(&vdev->desc->type); |
| 307 | 328 | ||
| 308 | if (index >= ioread8(&vdev->desc->num_vq)) | 329 | if (index >= ioread8(&vdev->desc->num_vq)) |
| @@ -322,17 +343,7 @@ static struct virtqueue *vop_find_vq(struct virtio_device *dev, · 13 unmodified lines | |||
| 322 | return ERR_PTR(-ENOMEM); | 343 | return ERR_PTR(-ENOMEM); |
| 323 | vdev->vr[index] = va; | 344 | vdev->vr[index] = va; |
| 324 | memset_io(va, 0x0, _vr_size); | 345 | memset_io(va, 0x0, _vr_size); |
| 325 | vq = vring_new_virtqueue( | 346 | |
| 326 | index, | ||
| 327 | le16_to_cpu(config.num), MIC_VIRTIO_RING_ALIGN, | ||
| 328 | dev, | ||
| 329 | false, | ||
| 330 | ctx, | ||
| 331 | (void __force *)va, vop_notify, callback, name); | ||
| 332 | if (!vq) { | ||
| 333 | err = -ENOMEM; | ||
| 334 | goto unmap; | ||
| 335 | } | ||
| 336 | info = va + _vr_size; | 347 | info = va + _vr_size; |
| 337 | magic = ioread32(&info->magic); | 348 | magic = ioread32(&info->magic); |
| 338 | 349 | ||
| @@ -341,18 +352,27 @@ static struct virtqueue *vop_find_vq(struct virtio_device *dev, · 2 unmodified lines | |||
| 341 | goto unmap; | 352 | goto unmap; |
| 342 | } | 353 | } |
| 343 | 354 | ||
| 344 | /* Allocate and reassign used ring now */ | ||
| 345 | vdev->used_size[index] = PAGE_ALIGN(sizeof(__u16) * 3 + | 355 | vdev->used_size[index] = PAGE_ALIGN(sizeof(__u16) * 3 + |
| 346 | sizeof(struct vring_used_elem) * | 356 | sizeof(struct vring_used_elem) * |
| 347 | le16_to_cpu(config.num)); | 357 | le16_to_cpu(config.num)); |
| 348 | used = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, | 358 | used = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, |
| 349 | get_order(vdev->used_size[index])); | 359 | get_order(vdev->used_size[index])); |
| 360 | vdev->used_virt[index] = used; | ||
| 350 | if (!used) { | 361 | if (!used) { |
| 351 | err = -ENOMEM; | 362 | err = -ENOMEM; |
| 352 | dev_err(_vop_dev(vdev), "%s %d err %d\n", | 363 | dev_err(_vop_dev(vdev), "%s %d err %d\n", |
| 353 | __func__, __LINE__, err); | 364 | __func__, __LINE__, err); |
| 354 | goto del_vq; | 365 | goto unmap; |
| 355 | } | 366 | } |
| 367 | |||
| 368 | vq = vop_new_virtqueue(index, le16_to_cpu(config.num), dev, ctx, | ||
| 369 | (void __force *)va, vop_notify, callback, | ||
| 370 | name, used); | ||
| 371 | if (!vq) { | ||
| 372 | err = -ENOMEM; | ||
| 373 | goto free_used; | ||
| 374 | } | ||
| 375 | |||
| 356 | vdev->used[index] = dma_map_single(&vpdev->dev, used, | 376 | vdev->used[index] = dma_map_single(&vpdev->dev, used, |
| 357 | vdev->used_size[index], | 377 | vdev->used_size[index], |
| 358 | DMA_BIDIRECTIONAL); | 378 | DMA_BIDIRECTIONAL); |
| @@ -360,26 +380,17 @@ static struct virtqueue *vop_find_vq(struct virtio_device *dev, · 1 unmodified line | |||
| 360 | err = -ENOMEM; | 380 | err = -ENOMEM; |
| 361 | dev_err(_vop_dev(vdev), "%s %d err %d\n", | 381 | dev_err(_vop_dev(vdev), "%s %d err %d\n", |
| 362 | __func__, __LINE__, err); | 382 | __func__, __LINE__, err); |
| 363 | goto free_used; | 383 | goto del_vq; |
| 364 | } | 384 | } |
| 365 | writeq(vdev->used[index], &vqconfig->used_address); | 385 | writeq(vdev->used[index], &vqconfig->used_address); |
| 366 | /* | ||
| 367 | * To reassign the used ring here we are directly accessing | ||
| 368 | * struct vring_virtqueue which is a private data structure | ||
| 369 | * in virtio_ring.c. At the minimum, a BUILD_BUG_ON() in | ||
| 370 | * vring_new_virtqueue() would ensure that | ||
| 371 | * (&vq->vring == (struct vring *) (&vq->vq + 1)); | ||
| 372 | */ | ||
| 373 | vr = (struct vring *)(vq + 1); | ||
| 374 | vr->used = used; | ||
| 375 | 386 | ||
| 376 | vq->priv = vdev; | 387 | vq->priv = vdev; |
| 377 | return vq; | 388 | return vq; |
| 389 | del_vq: | ||
| 390 | vring_del_virtqueue(vq); | ||
| 378 | free_used: | 391 | free_used: |
| 379 | free_pages((unsigned long)used, | 392 | free_pages((unsigned long)used, |
| 380 | get_order(vdev->used_size[index])); | 393 | get_order(vdev->used_size[index])); |
| 381 | del_vq: | ||
| 382 | vring_del_virtqueue(vq); | ||
| 383 | unmap: | 394 | unmap: |
| 384 | vpdev->hw_ops->iounmap(vpdev, vdev->vr[index]); | 395 | vpdev->hw_ops->iounmap(vpdev, vdev->vr[index]); |
| 385 | return ERR_PTR(err); | 396 | return ERR_PTR(err); |
| @@ -394,16 +405,21 @@ static int vop_find_vqs(struct virtio_device *dev, unsigned nvqs, · 8 unmodified lines | |||
| 394 | struct _vop_vdev *vdev = to_vopvdev(dev); | 405 | struct _vop_vdev *vdev = to_vopvdev(dev); |
| 395 | struct vop_device *vpdev = vdev->vpdev; | 406 | struct vop_device *vpdev = vdev->vpdev; |
| 396 | struct mic_device_ctrl __iomem *dc = vdev->dc; | 407 | struct mic_device_ctrl __iomem *dc = vdev->dc; |
| 397 | int i, err, retry; | 408 | int i, err, retry, queue_idx = 0; |
| 398 | 409 | ||
| 399 | /* We must have this many virtqueues. */ | 410 | /* We must have this many virtqueues. */ |
| 400 | if (nvqs > ioread8(&vdev->desc->num_vq)) | 411 | if (nvqs > ioread8(&vdev->desc->num_vq)) |
| 401 | return -ENOENT; | 412 | return -ENOENT; |
| 402 | 413 | ||
| 403 | for (i = 0; i < nvqs; ++i) { | 414 | for (i = 0; i < nvqs; ++i) { |
| 415 | if (!names[i]) { | ||
| 416 | vqs[i] = NULL; | ||
| 417 | continue; | ||
| 418 | } | ||
| 419 | |||
| 404 | dev_dbg(_vop_dev(vdev), "%s: %d: %s\n", | 420 | dev_dbg(_vop_dev(vdev), "%s: %d: %s\n", |
| 405 | __func__, i, names[i]); | 421 | __func__, i, names[i]); |
| 406 | vqs[i] = vop_find_vq(dev, i, callbacks[i], names[i], | 422 | vqs[i] = vop_find_vq(dev, queue_idx++, callbacks[i], names[i], |
| 407 | ctx ? ctx[i] : false); | 423 | ctx ? ctx[i] : false); |
| 408 | if (IS_ERR(vqs[i])) { | 424 | if (IS_ERR(vqs[i])) { |
| 409 | err = PTR_ERR(vqs[i]); | 425 | err = PTR_ERR(vqs[i]); |
| @@ -576,6 +592,8 @@ static int _vop_remove_device(struct mic_device_desc __iomem *d, · 166 unmodified lines | |||
| 576 | int ret = -1; | 592 | int ret = -1; |
| 577 | 593 | ||
| 578 | if (ioread8(&dc->config_change) == MIC_VIRTIO_PARAM_DEV_REMOVE) { | 594 | if (ioread8(&dc->config_change) == MIC_VIRTIO_PARAM_DEV_REMOVE) { |
| 595 | struct device *dev = get_device(&vdev->vdev.dev); | ||
| 596 | |||
| 579 | dev_dbg(&vpdev->dev, | 597 | dev_dbg(&vpdev->dev, |
| 580 | "%s %d config_change %d type %d vdev %p\n", | 598 | "%s %d config_change %d type %d vdev %p\n", |
| 581 | __func__, __LINE__, | 599 | __func__, __LINE__, |
| @@ -587,7 +605,7 @@ static int _vop_remove_device(struct mic_device_desc __iomem *d, · 5 unmodified lines | |||
| 587 | iowrite8(-1, &dc->h2c_vdev_db); | 605 | iowrite8(-1, &dc->h2c_vdev_db); |
| 588 | if (status & VIRTIO_CONFIG_S_DRIVER_OK) | 606 | if (status & VIRTIO_CONFIG_S_DRIVER_OK) |
| 589 | wait_for_completion(&vdev->reset_done); | 607 | wait_for_completion(&vdev->reset_done); |
| 590 | put_device(&vdev->vdev.dev); | 608 | put_device(dev); |
| 591 | iowrite8(1, &dc->guest_ack); | 609 | iowrite8(1, &dc->guest_ack); |
| 592 | dev_dbg(&vpdev->dev, "%s %d guest_ack %d\n", | 610 | dev_dbg(&vpdev->dev, "%s %d guest_ack %d\n", |
| 593 | __func__, __LINE__, ioread8(&dc->guest_ack)); | 611 | __func__, __LINE__, ioread8(&dc->guest_ack)); |
| @@ -70,8 +70,12 @@ pvpanic_walk_resources(struct acpi_resource *res, void *context) · 69 unmodified lines | |||
| 70 | struct resource r; | 70 | struct resource r; |
| 71 | 71 | ||
| 72 | if (acpi_dev_resource_io(res, &r)) { | 72 | if (acpi_dev_resource_io(res, &r)) { |
| 73 | #ifdef CONFIG_HAS_IOPORT_MAP | ||
| 73 | base = ioport_map(r.start, resource_size(&r)); | 74 | base = ioport_map(r.start, resource_size(&r)); |
| 74 | return AE_OK; | 75 | return AE_OK; |
| 76 | #else | ||
| 77 | return AE_ERROR; | ||
| 78 | #endif | ||
| 75 | } else if (acpi_dev_resource_memory(res, &r)) { | 79 | } else if (acpi_dev_resource_memory(res, &r)) { |
| 76 | base = ioremap(r.start, resource_size(&r)); | 80 | base = ioremap(r.start, resource_size(&r)); |
| 77 | return AE_OK; | 81 | return AE_OK; |
| @@ -234,7 +234,7 @@ int mmc_of_parse(struct mmc_host *host) · 233 unmodified lines | |||
| 234 | if (device_property_read_bool(dev, "broken-cd")) | 234 | if (device_property_read_bool(dev, "broken-cd")) |
| 235 | host->caps |= MMC_CAP_NEEDS_POLL; | 235 | host->caps |= MMC_CAP_NEEDS_POLL; |
| 236 | 236 | ||
| 237 | ret = mmc_gpiod_request_cd(host, "cd", 0, true, | 237 | ret = mmc_gpiod_request_cd(host, "cd", 0, false, |
| 238 | cd_debounce_delay_ms * 1000, | 238 | cd_debounce_delay_ms * 1000, |
| 239 | &cd_gpio_invert); | 239 | &cd_gpio_invert); |
| 240 | if (!ret) | 240 | if (!ret) |
| @@ -116,7 +116,7 @@ config MMC_RICOH_MMC · 115 unmodified lines | |||
| 116 | 116 | ||
| 117 | config MMC_SDHCI_ACPI | 117 | config MMC_SDHCI_ACPI |
| 118 | tristate "SDHCI support for ACPI enumerated SDHCI controllers" | 118 | tristate "SDHCI support for ACPI enumerated SDHCI controllers" |
| 119 | depends on MMC_SDHCI && ACPI | 119 | depends on MMC_SDHCI && ACPI && PCI |
| 120 | select IOSF_MBI if X86 | 120 | select IOSF_MBI if X86 |
| 121 | help | 121 | help |
| 122 | This selects support for ACPI enumerated SDHCI controllers, | 122 | This selects support for ACPI enumerated SDHCI controllers, |
| @@ -978,7 +978,7 @@ config MMC_SDHCI_OMAP · 855 unmodified lines | |||
| 978 | tristate "TI SDHCI Controller Support" | 978 | tristate "TI SDHCI Controller Support" |
| 979 | depends on MMC_SDHCI_PLTFM && OF | 979 | depends on MMC_SDHCI_PLTFM && OF |
| 980 | select THERMAL | 980 | select THERMAL |
| 981 | select TI_SOC_THERMAL | 981 | imply TI_SOC_THERMAL |
| 982 | help | 982 | help |
| 983 | This selects the Secure Digital Host Controller Interface (SDHCI) | 983 | This selects the Secure Digital Host Controller Interface (SDHCI) |
| 984 | support present in TI's DRA7 SOCs. The controller supports | 984 | support present in TI's DRA7 SOCs. The controller supports |
| @@ -1431,6 +1431,8 @@ static int bcm2835_probe(struct platform_device *pdev) · 1430 unmodified lines | |||
| 1431 | 1431 | ||
| 1432 | err: | 1432 | err: |
| 1433 | dev_dbg(dev, "%s -> err %d\n", __func__, ret); | 1433 | dev_dbg(dev, "%s -> err %d\n", __func__, ret); |
| 1434 | if (host->dma_chan_rxtx) | ||
| 1435 | dma_release_channel(host->dma_chan_rxtx); | ||
| 1434 | mmc_free_host(mmc); | 1436 | mmc_free_host(mmc); |
| 1435 | 1437 | ||
| 1436 | return ret; | 1438 | return ret; |
| @@ -1,11 +1,6 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* | 2 | /* |
| 3 | * Copyright (C) 2018 Mellanox Technologies. | 3 | * Copyright (C) 2018 Mellanox Technologies. |
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | */ | 4 | */ |
| 10 | 5 | ||
| 11 | #include <linux/bitfield.h> | 6 | #include <linux/bitfield.h> |
| @@ -179,6 +179,8 @@ struct meson_host { · 178 unmodified lines | |||
| 179 | struct sd_emmc_desc *descs; | 179 | struct sd_emmc_desc *descs; |
| 180 | dma_addr_t descs_dma_addr; | 180 | dma_addr_t descs_dma_addr; |
| 181 | 181 | ||
| 182 | int irq; | ||
| 183 | |||
| 182 | bool vqmmc_enabled; | 184 | bool vqmmc_enabled; |
| 183 | }; | 185 | }; |
| 184 | 186 | ||
| @@ -738,6 +740,11 @@ static int meson_mmc_clk_phase_tuning(struct mmc_host *mmc, u32 opcode, · 553 unmodified lines | |||
| 738 | static int meson_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode) | 740 | static int meson_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode) |
| 739 | { | 741 | { |
| 740 | struct meson_host *host = mmc_priv(mmc); | 742 | struct meson_host *host = mmc_priv(mmc); |
| 743 | int adj = 0; | ||
| 744 | |||
| 745 | /* enable signal resampling w/o delay */ | ||
| 746 | adj = ADJUST_ADJ_EN; | ||
| 747 | writel(adj, host->regs + host->data->adjust); | ||
| 741 | 748 | ||
| 742 | return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk); | 749 | return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk); |
| 743 | } | 750 | } |
| @@ -768,6 +775,9 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) · 24 unmodified lines | |||
| 768 | if (!IS_ERR(mmc->supply.vmmc)) | 775 | if (!IS_ERR(mmc->supply.vmmc)) |
| 769 | mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); | 776 | mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); |
| 770 | 777 | ||
| 778 | /* disable signal resampling */ | ||
| 779 | writel(0, host->regs + host->data->adjust); | ||
| 780 | |||
| 771 | /* Reset rx phase */ | 781 | /* Reset rx phase */ |
| 772 | clk_set_phase(host->rx_clk, 0); | 782 | clk_set_phase(host->rx_clk, 0); |
| 773 | 783 | ||
| @@ -1166,7 +1176,7 @@ static int meson_mmc_get_cd(struct mmc_host *mmc) · 392 unmodified lines | |||
| 1166 | 1176 | ||
| 1167 | static void meson_mmc_cfg_init(struct meson_host *host) | 1177 | static void meson_mmc_cfg_init(struct meson_host *host) |
| 1168 | { | 1178 | { |
| 1169 | u32 cfg = 0, adj = 0; | 1179 | u32 cfg = 0; |
| 1170 | 1180 | ||
| 1171 | cfg |= FIELD_PREP(CFG_RESP_TIMEOUT_MASK, | 1181 | cfg |= FIELD_PREP(CFG_RESP_TIMEOUT_MASK, |
| 1172 | ilog2(SD_EMMC_CFG_RESP_TIMEOUT)); | 1182 | ilog2(SD_EMMC_CFG_RESP_TIMEOUT)); |
| @@ -1177,10 +1187,6 @@ static void meson_mmc_cfg_init(struct meson_host *host) · 4 unmodified lines | |||
| 1177 | cfg |= CFG_ERR_ABORT; | 1187 | cfg |= CFG_ERR_ABORT; |
| 1178 | 1188 | ||
| 1179 | writel(cfg, host->regs + SD_EMMC_CFG); | 1189 | writel(cfg, host->regs + SD_EMMC_CFG); |
| 1180 | |||
| 1181 | /* enable signal resampling w/o delay */ | ||
| 1182 | adj = ADJUST_ADJ_EN; | ||
| 1183 | writel(adj, host->regs + host->data->adjust); | ||
| 1184 | } | 1190 | } |
| 1185 | 1191 | ||
| 1186 | static int meson_mmc_card_busy(struct mmc_host *mmc) | 1192 | static int meson_mmc_card_busy(struct mmc_host *mmc) |
| @@ -1231,7 +1237,7 @@ static int meson_mmc_probe(struct platform_device *pdev) · 44 unmodified lines | |||
| 1231 | struct resource *res; | 1237 | struct resource *res; |
| 1232 | struct meson_host *host; | 1238 | struct meson_host *host; |
| 1233 | struct mmc_host *mmc; | 1239 | struct mmc_host *mmc; |
| 1234 | int ret, irq; | 1240 | int ret; |
| 1235 | 1241 | ||
| 1236 | mmc = mmc_alloc_host(sizeof(struct meson_host), &pdev->dev); | 1242 | mmc = mmc_alloc_host(sizeof(struct meson_host), &pdev->dev); |
| 1237 | if (!mmc) | 1243 | if (!mmc) |
| @@ -1276,8 +1282,8 @@ static int meson_mmc_probe(struct platform_device *pdev) · 38 unmodified lines | |||
| 1276 | goto free_host; | 1282 | goto free_host; |
| 1277 | } | 1283 | } |
| 1278 | 1284 | ||
| 1279 | irq = platform_get_irq(pdev, 0); | 1285 | host->irq = platform_get_irq(pdev, 0); |
| 1280 | if (irq <= 0) { | 1286 | if (host->irq <= 0) { |
| 1281 | dev_err(&pdev->dev, "failed to get interrupt resource.\n"); | 1287 | dev_err(&pdev->dev, "failed to get interrupt resource.\n"); |
| 1282 | ret = -EINVAL; | 1288 | ret = -EINVAL; |
| 1283 | goto free_host; | 1289 | goto free_host; |
| @@ -1331,9 +1337,8 @@ static int meson_mmc_probe(struct platform_device *pdev) · 47 unmodified lines | |||
| 1331 | writel(IRQ_CRC_ERR | IRQ_TIMEOUTS | IRQ_END_OF_CHAIN, | 1337 | writel(IRQ_CRC_ERR | IRQ_TIMEOUTS | IRQ_END_OF_CHAIN, |
| 1332 | host->regs + SD_EMMC_IRQ_EN); | 1338 | host->regs + SD_EMMC_IRQ_EN); |
| 1333 | 1339 | ||
| 1334 | ret = devm_request_threaded_irq(&pdev->dev, irq, meson_mmc_irq, | 1340 | ret = request_threaded_irq(host->irq, meson_mmc_irq, |
| 1335 | meson_mmc_irq_thread, IRQF_SHARED, | 1341 | meson_mmc_irq_thread, IRQF_SHARED, NULL, host); |
| 1336 | NULL, host); | ||
| 1337 | if (ret) | 1342 | if (ret) |
| 1338 | goto err_init_clk; | 1343 | goto err_init_clk; |
| 1339 | 1344 | ||
| @@ -1351,7 +1356,7 @@ static int meson_mmc_probe(struct platform_device *pdev) · 11 unmodified lines | |||
| 1351 | if (host->bounce_buf == NULL) { | 1356 | if (host->bounce_buf == NULL) { |
| 1352 | dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n"); | 1357 | dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n"); |
| 1353 | ret = -ENOMEM; | 1358 | ret = -ENOMEM; |
| 1354 | goto err_init_clk; | 1359 | goto err_free_irq; |
| 1355 | } | 1360 | } |
| 1356 | 1361 | ||
| 1357 | host->descs = dma_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN, | 1362 | host->descs = dma_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN, |
| @@ -1370,6 +1375,8 @@ static int meson_mmc_probe(struct platform_device *pdev) · 12 unmodified lines | |||
| 1370 | err_bounce_buf: | 1375 | err_bounce_buf: |
| 1371 | dma_free_coherent(host->dev, host->bounce_buf_size, | 1376 | dma_free_coherent(host->dev, host->bounce_buf_size, |
| 1372 | host->bounce_buf, host->bounce_dma_addr); | 1377 | host->bounce_buf, host->bounce_dma_addr); |
| 1378 | err_free_irq: | ||
| 1379 | free_irq(host->irq, host); | ||
| 1373 | err_init_clk: | 1380 | err_init_clk: |
| 1374 | clk_disable_unprepare(host->mmc_clk); | 1381 | clk_disable_unprepare(host->mmc_clk); |
| 1375 | err_core_clk: | 1382 | err_core_clk: |
| @@ -1387,6 +1394,7 @@ static int meson_mmc_remove(struct platform_device *pdev) · 11 unmodified lines | |||
| 1387 | 1394 | ||
| 1388 | /* disable interrupts */ | 1395 | /* disable interrupts */ |
| 1389 | writel(0, host->regs + SD_EMMC_IRQ_EN); | 1396 | writel(0, host->regs + SD_EMMC_IRQ_EN); |
| 1397 | free_irq(host->irq, host); | ||
| 1390 | 1398 | ||
| 1391 | dma_free_coherent(host->dev, SD_EMMC_DESC_BUF_LEN, | 1399 | dma_free_coherent(host->dev, SD_EMMC_DESC_BUF_LEN, |
| 1392 | host->descs, host->descs_dma_addr); | 1400 | host->descs, host->descs_dma_addr); |
| @@ -846,7 +846,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz) · 845 unmodified lines | |||
| 846 | 846 | ||
| 847 | if (timing == MMC_TIMING_MMC_HS400 && | 847 | if (timing == MMC_TIMING_MMC_HS400 && |
| 848 | host->dev_comp->hs400_tune) | 848 | host->dev_comp->hs400_tune) |
| 849 | sdr_set_field(host->base + PAD_CMD_TUNE, | 849 | sdr_set_field(host->base + tune_reg, |
| 850 | MSDC_PAD_TUNE_CMDRRDLY, | 850 | MSDC_PAD_TUNE_CMDRRDLY, |
| 851 | host->hs400_cmd_int_delay); | 851 | host->hs400_cmd_int_delay); |
| 852 | dev_dbg(host->dev, "sclk: %d, timing: %d\n", host->mmc->actual_clock, | 852 | dev_dbg(host->dev, "sclk: %d, timing: %d\n", host->mmc->actual_clock, |
| @@ -296,7 +296,10 @@ static int sdhci_iproc_probe(struct platform_device *pdev) · 295 unmodified lines | |||
| 296 | 296 | ||
| 297 | iproc_host->data = iproc_data; | 297 | iproc_host->data = iproc_data; |
| 298 | 298 | ||
| 299 | mmc_of_parse(host->mmc); | 299 | ret = mmc_of_parse(host->mmc); |
| 300 | if (ret) | ||
| 301 | goto err; | ||
| 302 | |||
| 300 | sdhci_get_property(pdev); | 303 | sdhci_get_property(pdev); |
| 301 | 304 | ||
| 302 | host->mmc->caps |= iproc_host->data->mmc_caps; | 305 | host->mmc->caps |= iproc_host->data->mmc_caps; |
| @@ -3763,8 +3763,9 @@ int sdhci_setup_host(struct sdhci_host *host) · 3762 unmodified lines | |||
| 3763 | * Use zalloc to zero the reserved high 32-bits of 128-bit | 3763 | * Use zalloc to zero the reserved high 32-bits of 128-bit |
| 3764 | * descriptors so that they never need to be written. | 3764 | * descriptors so that they never need to be written. |
| 3765 | */ | 3765 | */ |
| 3766 | buf = dma_zalloc_coherent(mmc_dev(mmc), host->align_buffer_sz + | 3766 | buf = dma_alloc_coherent(mmc_dev(mmc), |
| 3767 | host->adma_table_sz, &dma, GFP_KERNEL); | 3767 | host->align_buffer_sz + host->adma_table_sz, |
| 3768 | &dma, GFP_KERNEL); | ||
| 3768 | if (!buf) { | 3769 | if (!buf) { |
| 3769 | pr_warn("%s: Unable to allocate ADMA buffers - falling back to standard DMA\n", | 3770 | pr_warn("%s: Unable to allocate ADMA buffers - falling back to standard DMA\n", |
| 3770 | mmc_hostname(mmc)); | 3771 | mmc_hostname(mmc)); |
| @@ -522,7 +522,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd) · 521 unmodified lines | |||
| 522 | mtd->nvmem = nvmem_register(&config); | 522 | mtd->nvmem = nvmem_register(&config); |
| 523 | if (IS_ERR(mtd->nvmem)) { | 523 | if (IS_ERR(mtd->nvmem)) { |
| 524 | /* Just ignore if there is no NVMEM support in the kernel */ | 524 | /* Just ignore if there is no NVMEM support in the kernel */ |
| 525 | if (PTR_ERR(mtd->nvmem) == -ENOSYS) { | 525 | if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP) { |
| 526 | mtd->nvmem = NULL; | 526 | mtd->nvmem = NULL; |
| 527 | } else { | 527 | } else { |
| 528 | dev_err(&mtd->dev, "Failed to register NVMEM device\n"); | 528 | dev_err(&mtd->dev, "Failed to register NVMEM device\n"); |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | |||
| 7 | extern struct mutex mtd_table_mutex; | 7 | extern struct mutex mtd_table_mutex; |
| 8 | 8 | ||
| 9 | struct mtd_info *__mtd_next_device(int i); | 9 | struct mtd_info *__mtd_next_device(int i); |
| 10 | int add_mtd_device(struct mtd_info *mtd); | 10 | int __must_check add_mtd_device(struct mtd_info *mtd); |
| 11 | int del_mtd_device(struct mtd_info *mtd); | 11 | int del_mtd_device(struct mtd_info *mtd); |
| 12 | int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int); | 12 | int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int); |
| 13 | int del_mtd_partitions(struct mtd_info *); | 13 | int del_mtd_partitions(struct mtd_info *); |
| @@ -480,6 +480,10 @@ static struct mtd_part *allocate_partition(struct mtd_info *parent, · 479 unmodified lines | |||
| 480 | /* let's register it anyway to preserve ordering */ | 480 | /* let's register it anyway to preserve ordering */ |
| 481 | slave->offset = 0; | 481 | slave->offset = 0; |
| 482 | slave->mtd.size = 0; | 482 | slave->mtd.size = 0; |
| 483 | |||
| 484 | /* Initialize ->erasesize to make add_mtd_device() happy. */ | ||
| 485 | slave->mtd.erasesize = parent->erasesize; | ||
| 486 | |||
| 483 | printk(KERN_ERR"mtd: partition \"%s\" is out of reach -- disabled\n", | 487 | printk(KERN_ERR"mtd: partition \"%s\" is out of reach -- disabled\n", |
| 484 | part->name); | 488 | part->name); |
| 485 | goto out_register; | 489 | goto out_register; |
| @@ -618,10 +622,21 @@ int mtd_add_partition(struct mtd_info *parent, const char *name, · 132 unmodified lines | |||
| 618 | list_add(&new->list, &mtd_partitions); | 622 | list_add(&new->list, &mtd_partitions); |
| 619 | mutex_unlock(&mtd_partitions_mutex); | 623 | mutex_unlock(&mtd_partitions_mutex); |
| 620 | 624 | ||
| 621 | add_mtd_device(&new->mtd); | 625 | ret = add_mtd_device(&new->mtd); |
| 626 | if (ret) | ||
| 627 | goto err_remove_part; | ||
| 622 | 628 | ||
| 623 | mtd_add_partition_attrs(new); | 629 | mtd_add_partition_attrs(new); |
| 624 | 630 | ||
| 631 | return 0; | ||
| 632 | |||
| 633 | err_remove_part: | ||
| 634 | mutex_lock(&mtd_partitions_mutex); | ||
| 635 | list_del(&new->list); | ||
| 636 | mutex_unlock(&mtd_partitions_mutex); | ||
| 637 | |||
| 638 | free_partition(new); | ||
| 639 | |||
| 625 | return ret; | 640 | return ret; |
| 626 | } | 641 | } |
| 627 | EXPORT_SYMBOL_GPL(mtd_add_partition); | 642 | EXPORT_SYMBOL_GPL(mtd_add_partition); |
| @@ -712,22 +727,31 @@ int add_mtd_partitions(struct mtd_info *master, · 84 unmodified lines | |||
| 712 | { | 727 | { |
| 713 | struct mtd_part *slave; | 728 | struct mtd_part *slave; |
| 714 | uint64_t cur_offset = 0; | 729 | uint64_t cur_offset = 0; |
| 715 | int i; | 730 | int i, ret; |
| 716 | 731 | ||
| 717 | printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); | 732 | printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); |
| 718 | 733 | ||
| 719 | for (i = 0; i < nbparts; i++) { | 734 | for (i = 0; i < nbparts; i++) { |
| 720 | slave = allocate_partition(master, parts + i, i, cur_offset); | 735 | slave = allocate_partition(master, parts + i, i, cur_offset); |
| 721 | if (IS_ERR(slave)) { | 736 | if (IS_ERR(slave)) { |
| 722 | del_mtd_partitions(master); | 737 | ret = PTR_ERR(slave); |
| 723 | return PTR_ERR(slave); | 738 | goto err_del_partitions; |
| 724 | } | 739 | } |
| 725 | 740 | ||
| 726 | mutex_lock(&mtd_partitions_mutex); | 741 | mutex_lock(&mtd_partitions_mutex); |
| 727 | list_add(&slave->list, &mtd_partitions); | 742 | list_add(&slave->list, &mtd_partitions); |
| 728 | mutex_unlock(&mtd_partitions_mutex); | 743 | mutex_unlock(&mtd_partitions_mutex); |
| 729 | 744 | ||
| 730 | add_mtd_device(&slave->mtd); | 745 | ret = add_mtd_device(&slave->mtd); |
| 746 | if (ret) { | ||
| 747 | mutex_lock(&mtd_partitions_mutex); | ||
| 748 | list_del(&slave->list); | ||
| 749 | mutex_unlock(&mtd_partitions_mutex); | ||
| 750 | |||
| 751 | free_partition(slave); | ||
| 752 | goto err_del_partitions; | ||
| 753 | } | ||
| 754 | |||
| 731 | mtd_add_partition_attrs(slave); | 755 | mtd_add_partition_attrs(slave); |
| 732 | /* Look for subpartitions */ | 756 | /* Look for subpartitions */ |
| 733 | parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); | 757 | parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); |
| @@ -736,6 +760,11 @@ int add_mtd_partitions(struct mtd_info *master, · 2 unmodified lines | |||
| 736 | } | 760 | } |
| 737 | 761 | ||
| 738 | return 0; | 762 | return 0; |
| 763 | |||
| 764 | err_del_partitions: | ||
| 765 | del_mtd_partitions(master); | ||
| 766 | |||
| 767 | return ret; | ||
| 739 | } | 768 | } |
| 740 | 769 | ||
| 741 | static DEFINE_SPINLOCK(part_parser_lock); | 770 | static DEFINE_SPINLOCK(part_parser_lock); |
| @@ -1322,7 +1322,7 @@ int denali_init(struct denali_nand_info *denali) · 1321 unmodified lines | |||
| 1322 | } | 1322 | } |
| 1323 | 1323 | ||
| 1324 | /* clk rate info is needed for setup_data_interface */ | 1324 | /* clk rate info is needed for setup_data_interface */ |
| 1325 | if (denali->clk_rate && denali->clk_x_rate) | 1325 | if (!denali->clk_rate || !denali->clk_x_rate) |
| 1326 | chip->options |= NAND_KEEP_TIMINGS; | 1326 | chip->options |= NAND_KEEP_TIMINGS; |
| 1327 | 1327 | ||
| 1328 | chip->legacy.dummy_controller.ops = &denali_controller_ops; | 1328 | chip->legacy.dummy_controller.ops = &denali_controller_ops; |
| @@ -593,23 +593,6 @@ static void fsmc_write_buf_dma(struct fsmc_nand_data *host, const u8 *buf, · 592 unmodified lines | |||
| 593 | dma_xfer(host, (void *)buf, len, DMA_TO_DEVICE); | 593 | dma_xfer(host, (void *)buf, len, DMA_TO_DEVICE); |
| 594 | } | 594 | } |
| 595 | 595 | ||
| 596 | /* fsmc_select_chip - assert or deassert nCE */ | ||
| 597 | static void fsmc_ce_ctrl(struct fsmc_nand_data *host, bool assert) | ||
| 598 | { | ||
| 599 | u32 pc = readl(host->regs_va + FSMC_PC); | ||
| 600 | |||
| 601 | if (!assert) | ||
| 602 | writel_relaxed(pc & ~FSMC_ENABLE, host->regs_va + FSMC_PC); | ||
| 603 | else | ||
| 604 | writel_relaxed(pc | FSMC_ENABLE, host->regs_va + FSMC_PC); | ||
| 605 | |||
| 606 | /* | ||
| 607 | * nCE line changes must be applied before returning from this | ||
| 608 | * function. | ||
| 609 | */ | ||
| 610 | mb(); | ||
| 611 | } | ||
| 612 | |||
| 613 | /* | 596 | /* |
| 614 | * fsmc_exec_op - hook called by the core to execute NAND operations | 597 | * fsmc_exec_op - hook called by the core to execute NAND operations |
| 615 | * | 598 | * |
| @@ -627,8 +610,6 @@ static int fsmc_exec_op(struct nand_chip *chip, const struct nand_operation *op, · 11 unmodified lines | |||
| 627 | 610 | ||
| 628 | pr_debug("Executing operation [%d instructions]:\n", op->ninstrs); | 611 | pr_debug("Executing operation [%d instructions]:\n", op->ninstrs); |
| 629 | 612 | ||
| 630 | fsmc_ce_ctrl(host, true); | ||
| 631 | |||
| 632 | for (op_id = 0; op_id < op->ninstrs; op_id++) { | 613 | for (op_id = 0; op_id < op->ninstrs; op_id++) { |
| 633 | instr = &op->instrs[op_id]; | 614 | instr = &op->instrs[op_id]; |
| 634 | 615 | ||
| @@ -686,8 +667,6 @@ static int fsmc_exec_op(struct nand_chip *chip, const struct nand_operation *op, · 51 unmodified lines | |||
| 686 | } | 667 | } |
| 687 | } | 668 | } |
| 688 | 669 | ||
| 689 | fsmc_ce_ctrl(host, false); | ||
| 690 | |||
| 691 | return ret; | 670 | return ret; |
| 692 | } | 671 | } |
| 693 | 672 | ||
| @@ -155,9 +155,10 @@ int gpmi_init(struct gpmi_nand_data *this) · 154 unmodified lines | |||
| 155 | 155 | ||
| 156 | /* | 156 | /* |
| 157 | * Reset BCH here, too. We got failures otherwise :( | 157 | * Reset BCH here, too. We got failures otherwise :( |
| 158 | * See later BCH reset for explanation of MX23 handling | 158 | * See later BCH reset for explanation of MX23 and MX28 handling |
| 159 | */ | 159 | */ |
| 160 | ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); | 160 | ret = gpmi_reset_block(r->bch_regs, |
| 161 | GPMI_IS_MX23(this) || GPMI_IS_MX28(this)); | ||
| 161 | if (ret) | 162 | if (ret) |
| 162 | goto err_out; | 163 | goto err_out; |
| 163 | 164 | ||
| @@ -263,12 +264,10 @@ int bch_set_geometry(struct gpmi_nand_data *this) · 99 unmodified lines | |||
| 263 | /* | 264 | /* |
| 264 | * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this | 265 | * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this |
| 265 | * chip, otherwise it will lock up. So we skip resetting BCH on the MX23. | 266 | * chip, otherwise it will lock up. So we skip resetting BCH on the MX23. |
| 266 | * On the other hand, the MX28 needs the reset, because one case has been | 267 | * and MX28. |
| 267 | * seen where the BCH produced ECC errors constantly after 10000 | ||
| 268 | * consecutive reboots. The latter case has not been seen on the MX23 | ||
| 269 | * yet, still we don't know if it could happen there as well. | ||
| 270 | */ | 268 | */ |
| 271 | ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); | 269 | ret = gpmi_reset_block(r->bch_regs, |
| 270 | GPMI_IS_MX23(this) || GPMI_IS_MX28(this)); | ||
| 272 | if (ret) | 271 | if (ret) |
| 273 | goto err_out; | 272 | goto err_out; |
| 274 | 273 | ||
| @@ -260,7 +260,7 @@ static int jz_nand_correct_ecc_rs(struct nand_chip *chip, uint8_t *dat, · 259 unmodified lines | |||
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | static int jz_nand_ioremap_resource(struct platform_device *pdev, | 262 | static int jz_nand_ioremap_resource(struct platform_device *pdev, |
| 263 | const char *name, struct resource **res, void *__iomem *base) | 263 | const char *name, struct resource **res, void __iomem **base) |
| 264 | { | 264 | { |
| 265 | int ret; | 265 | int ret; |
| 266 | 266 | ||
| @@ -410,6 +410,7 @@ static int nand_check_wp(struct nand_chip *chip) · 409 unmodified lines | |||
| 410 | 410 | ||
| 411 | /** | 411 | /** |
| 412 | * nand_fill_oob - [INTERN] Transfer client buffer to oob | 412 | * nand_fill_oob - [INTERN] Transfer client buffer to oob |
| 413 | * @chip: NAND chip object | ||
| 413 | * @oob: oob data buffer | 414 | * @oob: oob data buffer |
| 414 | * @len: oob data write length | 415 | * @len: oob data write length |
| 415 | * @ops: oob ops structure | 416 | * @ops: oob ops structure |
| @@ -158,7 +158,7 @@ static u32 add_marker_len(struct nand_bbt_descr *td) · 157 unmodified lines | |||
| 158 | 158 | ||
| 159 | /** | 159 | /** |
| 160 | * read_bbt - [GENERIC] Read the bad block table starting from page | 160 | * read_bbt - [GENERIC] Read the bad block table starting from page |
| 161 | * @chip: NAND chip object | 161 | * @this: NAND chip object |
| 162 | * @buf: temporary buffer | 162 | * @buf: temporary buffer |
| 163 | * @page: the starting page | 163 | * @page: the starting page |
| 164 | * @num: the number of bbt descriptors to read | 164 | * @num: the number of bbt descriptors to read |
| @@ -2833,6 +2833,16 @@ static int qcom_nand_host_init_and_register(struct qcom_nand_controller *nandc, · 2832 unmodified lines | |||
| 2833 | if (ret) | 2833 | if (ret) |
| 2834 | return ret; | 2834 | return ret; |
| 2835 | 2835 | ||
| 2836 | if (nandc->props->is_bam) { | ||
| 2837 | free_bam_transaction(nandc); | ||
| 2838 | nandc->bam_txn = alloc_bam_transaction(nandc); | ||
| 2839 | if (!nandc->bam_txn) { | ||
| 2840 | dev_err(nandc->dev, | ||
| 2841 | "failed to allocate bam transaction\n"); | ||
| 2842 | return -ENOMEM; | ||
| 2843 | } | ||
| 2844 | } | ||
| 2845 | |||
| 2836 | ret = mtd_device_register(mtd, NULL, 0); | 2846 | ret = mtd_device_register(mtd, NULL, 0); |
| 2837 | if (ret) | 2847 | if (ret) |
| 2838 | nand_cleanup(chip); | 2848 | nand_cleanup(chip); |
| @@ -2847,16 +2857,6 @@ static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc) · 8 unmodified lines | |||
| 2847 | struct qcom_nand_host *host; | 2857 | struct qcom_nand_host *host; |
| 2848 | int ret; | 2858 | int ret; |
| 2849 | 2859 | ||
| 2850 | if (nandc->props->is_bam) { | ||
| 2851 | free_bam_transaction(nandc); | ||
| 2852 | nandc->bam_txn = alloc_bam_transaction(nandc); | ||
| 2853 | if (!nandc->bam_txn) { | ||
| 2854 | dev_err(nandc->dev, | ||
| 2855 | "failed to allocate bam transaction\n"); | ||
| 2856 | return -ENOMEM; | ||
| 2857 | } | ||
| 2858 | } | ||
| 2859 | |||
| 2860 | for_each_available_child_of_node(dn, child) { | 2860 | for_each_available_child_of_node(dn, child) { |
| 2861 | host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); | 2861 | host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); |
| 2862 | if (!host) { | 2862 | if (!host) { |
| @@ -304,24 +304,30 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, · 303 unmodified lines | |||
| 304 | struct nand_device *nand = spinand_to_nand(spinand); | 304 | struct nand_device *nand = spinand_to_nand(spinand); |
| 305 | struct mtd_info *mtd = nanddev_to_mtd(nand); | 305 | struct mtd_info *mtd = nanddev_to_mtd(nand); |
| 306 | struct nand_page_io_req adjreq = *req; | 306 | struct nand_page_io_req adjreq = *req; |
| 307 | unsigned int nbytes = 0; | 307 | void *buf = spinand->databuf; |
| 308 | void *buf = NULL; | 308 | unsigned int nbytes; |
| 309 | u16 column = 0; | 309 | u16 column = 0; |
| 310 | int ret; | 310 | int ret; |
| 311 | 311 | ||
| 312 | memset(spinand->databuf, 0xff, | 312 | /* |
| 313 | nanddev_page_size(nand) + | 313 | * Looks like PROGRAM LOAD (AKA write cache) does not necessarily reset |
| 314 | nanddev_per_page_oobsize(nand)); | 314 | * the cache content to 0xFF (depends on vendor implementation), so we |
| 315 | * must fill the page cache entirely even if we only want to program | ||
| 316 | * the data portion of the page, otherwise we might corrupt the BBM or | ||
| 317 | * user data previously programmed in OOB area. | ||
| 318 | */ | ||
| 319 | nbytes = nanddev_page_size(nand) + nanddev_per_page_oobsize(nand); | ||
| 320 | memset(spinand->databuf, 0xff, nbytes); | ||
| 321 | adjreq.dataoffs = 0; | ||
| 322 | adjreq.datalen = nanddev_page_size(nand); | ||
| 323 | adjreq.databuf.out = spinand->databuf; | ||
| 324 | adjreq.ooblen = nanddev_per_page_oobsize(nand); | ||
| 325 | adjreq.ooboffs = 0; | ||
| 326 | adjreq.oobbuf.out = spinand->oobbuf; | ||
| 315 | 327 | ||
| 316 | if (req->datalen) { | 328 | if (req->datalen) |
| 317 | memcpy(spinand->databuf + req->dataoffs, req->databuf.out, | 329 | memcpy(spinand->databuf + req->dataoffs, req->databuf.out, |
| 318 | req->datalen); | 330 | req->datalen); |
| 319 | adjreq.dataoffs = 0; | ||
| 320 | adjreq.datalen = nanddev_page_size(nand); | ||
| 321 | adjreq.databuf.out = spinand->databuf; | ||
| 322 | nbytes = adjreq.datalen; | ||
| 323 | buf = spinand->databuf; | ||
| 324 | } | ||
| 325 | 331 | ||
| 326 | if (req->ooblen) { | 332 | if (req->ooblen) { |
| 327 | if (req->mode == MTD_OPS_AUTO_OOB) | 333 | if (req->mode == MTD_OPS_AUTO_OOB) |
| @@ -332,14 +338,6 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, · 4 unmodified lines | |||
| 332 | else | 338 | else |
| 333 | memcpy(spinand->oobbuf + req->ooboffs, req->oobbuf.out, | 339 | memcpy(spinand->oobbuf + req->ooboffs, req->oobbuf.out, |
| 334 | req->ooblen); | 340 | req->ooblen); |
| 335 | |||
| 336 | adjreq.ooblen = nanddev_per_page_oobsize(nand); | ||
| 337 | adjreq.ooboffs = 0; | ||
| 338 | nbytes += nanddev_per_page_oobsize(nand); | ||
| 339 | if (!buf) { | ||
| 340 | buf = spinand->oobbuf; | ||
| 341 | column = nanddev_page_size(nand); | ||
| 342 | } | ||
| 343 | } | 341 | } |
| 344 | 342 | ||
| 345 | spinand_cache_op_adjust_colum(spinand, &adjreq, &column); | 343 | spinand_cache_op_adjust_colum(spinand, &adjreq, &column); |
| @@ -370,8 +368,8 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, · 24 unmodified lines | |||
| 370 | 368 | ||
| 371 | /* | 369 | /* |
| 372 | * We need to use the RANDOM LOAD CACHE operation if there's | 370 | * We need to use the RANDOM LOAD CACHE operation if there's |
| 373 | * more than one iteration, because the LOAD operation resets | 371 | * more than one iteration, because the LOAD operation might |
| 374 | * the cache to 0xff. | 372 | * reset the cache to 0xff. |
| 375 | */ | 373 | */ |
| 376 | if (nbytes) { | 374 | if (nbytes) { |
| 377 | column = op.addr.val; | 375 | column = op.addr.val; |
| @@ -1018,11 +1016,11 @@ static int spinand_init(struct spinand_device *spinand) · 640 unmodified lines | |||
| 1018 | for (i = 0; i < nand->memorg.ntargets; i++) { | 1016 | for (i = 0; i < nand->memorg.ntargets; i++) { |
| 1019 | ret = spinand_select_target(spinand, i); | 1017 | ret = spinand_select_target(spinand, i); |
| 1020 | if (ret) | 1018 | if (ret) |
| 1021 | goto err_free_bufs; | 1019 | goto err_manuf_cleanup; |
| 1022 | 1020 | ||
| 1023 | ret = spinand_lock_block(spinand, BL_ALL_UNLOCKED); | 1021 | ret = spinand_lock_block(spinand, BL_ALL_UNLOCKED); |
| 1024 | if (ret) | 1022 | if (ret) |
| 1025 | goto err_free_bufs; | 1023 | goto err_manuf_cleanup; |
| 1026 | } | 1024 | } |
| 1027 | 1025 | ||
| 1028 | ret = nanddev_init(nand, &spinand_ops, THIS_MODULE); | 1026 | ret = nanddev_init(nand, &spinand_ops, THIS_MODULE); |
| @@ -519,7 +519,7 @@ config NET_FAILOVER · 518 unmodified lines | |||
| 519 | and destroy a failover master netdev and manages a primary and | 519 | and destroy a failover master netdev and manages a primary and |
| 520 | standby slave netdevs that get registered via the generic failover | 520 | standby slave netdevs that get registered via the generic failover |
| 521 | infrastructure. This can be used by paravirtual drivers to enable | 521 | infrastructure. This can be used by paravirtual drivers to enable |
| 522 | an alternate low latency datapath. It alsoenables live migration of | 522 | an alternate low latency datapath. It also enables live migration of |
| 523 | a VM with direct attached VF by failing over to the paravirtual | 523 | a VM with direct attached VF by failing over to the paravirtual |
| 524 | datapath when the VF is unplugged. | 524 | datapath when the VF is unplugged. |
| 525 | 525 | ||
| @@ -1963,6 +1963,9 @@ static int __bond_release_one(struct net_device *bond_dev, · 1962 unmodified lines | |||
| 1963 | if (!bond_has_slaves(bond)) { | 1963 | if (!bond_has_slaves(bond)) { |
| 1964 | bond_set_carrier(bond); | 1964 | bond_set_carrier(bond); |
| 1965 | eth_hw_addr_random(bond_dev); | 1965 | eth_hw_addr_random(bond_dev); |
| 1966 | bond->nest_level = SINGLE_DEPTH_NESTING; | ||
| 1967 | } else { | ||
| 1968 | bond->nest_level = dev_get_nest_level(bond_dev) + 1; | ||
| 1966 | } | 1969 | } |
| 1967 | 1970 | ||
| 1968 | unblock_netpoll_tx(); | 1971 | unblock_netpoll_tx(); |
| @@ -257,10 +257,7 @@ static int handle_tx(struct ser_device *ser) · 256 unmodified lines | |||
| 257 | if (skb->len == 0) { | 257 | if (skb->len == 0) { |
| 258 | struct sk_buff *tmp = skb_dequeue(&ser->head); | 258 | struct sk_buff *tmp = skb_dequeue(&ser->head); |
| 259 | WARN_ON(tmp != skb); | 259 | WARN_ON(tmp != skb); |
| 260 | if (in_interrupt()) | 260 | dev_consume_skb_any(skb); |
| 261 | dev_kfree_skb_irq(skb); | ||
| 262 | else | ||
| 263 | kfree_skb(skb); | ||
| 264 | } | 261 | } |
| 265 | } | 262 | } |
| 266 | /* Send flow off if queue is empty */ | 263 | /* Send flow off if queue is empty */ |
| @@ -480,8 +480,6 @@ EXPORT_SYMBOL_GPL(can_put_echo_skb); · 479 unmodified lines | |||
| 480 | struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) | 480 | struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) |
| 481 | { | 481 | { |
| 482 | struct can_priv *priv = netdev_priv(dev); | 482 | struct can_priv *priv = netdev_priv(dev); |
| 483 | struct sk_buff *skb = priv->echo_skb[idx]; | ||
| 484 | struct canfd_frame *cf; | ||
| 485 | 483 | ||
| 486 | if (idx >= priv->echo_skb_max) { | 484 | if (idx >= priv->echo_skb_max) { |
| 487 | netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n", | 485 | netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n", |
| @@ -489,20 +487,21 @@ struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 · 1 unmodified line | |||
| 489 | return NULL; | 487 | return NULL; |
| 490 | } | 488 | } |
| 491 | 489 | ||
| 492 | if (!skb) { | 490 | if (priv->echo_skb[idx]) { |
| 493 | netdev_err(dev, "%s: BUG! Trying to echo non existing skb: can_priv::echo_skb[%u]\n", | 491 | /* Using "struct canfd_frame::len" for the frame |
| 494 | __func__, idx); | 492 | * length is supported on both CAN and CANFD frames. |
| 495 | return NULL; | 493 | */ |
| 496 | } | 494 | struct sk_buff *skb = priv->echo_skb[idx]; |
| 495 | struct canfd_frame *cf = (struct canfd_frame *)skb->data; | ||
| 496 | u8 len = cf->len; | ||
| 497 | 497 | ||
| 498 | /* Using "struct canfd_frame::len" for the frame | 498 | *len_ptr = len; |
| 499 | * length is supported on both CAN and CANFD frames. | 499 | priv->echo_skb[idx] = NULL; |
| 500 | */ | ||
| 501 | cf = (struct canfd_frame *)skb->data; | ||
| 502 | *len_ptr = cf->len; | ||
| 503 | priv->echo_skb[idx] = NULL; | ||
| 504 | 500 | ||
| 505 | return skb; | 501 | return skb; |
| 502 | } | ||
| 503 | |||
| 504 | return NULL; | ||
| 506 | } | 505 | } |
| 507 | 506 | ||
| 508 | /* | 507 | /* |
| @@ -1106,7 +1106,7 @@ static int flexcan_chip_start(struct net_device *dev) · 1105 unmodified lines | |||
| 1106 | } | 1106 | } |
| 1107 | } else { | 1107 | } else { |
| 1108 | /* clear and invalidate unused mailboxes first */ | 1108 | /* clear and invalidate unused mailboxes first */ |
| 1109 | for (i = FLEXCAN_TX_MB_RESERVED_OFF_FIFO; i <= priv->mb_count; i++) { | 1109 | for (i = FLEXCAN_TX_MB_RESERVED_OFF_FIFO; i < priv->mb_count; i++) { |
| 1110 | mb = flexcan_get_mb(priv, i); | 1110 | mb = flexcan_get_mb(priv, i); |
| 1111 | priv->write(FLEXCAN_MB_CODE_RX_INACTIVE, | 1111 | priv->write(FLEXCAN_MB_CODE_RX_INACTIVE, |
| 1112 | &mb->can_ctrl); | 1112 | &mb->can_ctrl); |
| @@ -1432,7 +1432,7 @@ static int flexcan_setup_stop_mode(struct platform_device *pdev) · 319 unmodified lines | |||
| 1432 | gpr_np = of_find_node_by_phandle(phandle); | 1432 | gpr_np = of_find_node_by_phandle(phandle); |
| 1433 | if (!gpr_np) { | 1433 | if (!gpr_np) { |
| 1434 | dev_dbg(&pdev->dev, "could not find gpr node by phandle\n"); | 1434 | dev_dbg(&pdev->dev, "could not find gpr node by phandle\n"); |
| 1435 | return PTR_ERR(gpr_np); | 1435 | return -ENODEV; |
| 1436 | } | 1436 | } |
| 1437 | 1437 | ||
| 1438 | priv = netdev_priv(dev); | 1438 | priv = netdev_priv(dev); |
| @@ -511,9 +511,6 @@ static void b53_srab_prepare_irq(struct platform_device *pdev) · 510 unmodified lines | |||
| 511 | /* Clear all pending interrupts */ | 511 | /* Clear all pending interrupts */ |
| 512 | writel(0xffffffff, priv->regs + B53_SRAB_INTR); | 512 | writel(0xffffffff, priv->regs + B53_SRAB_INTR); |
| 513 | 513 | ||
| 514 | if (dev->pdata && dev->pdata->chip_id != BCM58XX_DEVICE_ID) | ||
| 515 | return; | ||
| 516 | |||
| 517 | for (i = 0; i < B53_N_PORTS; i++) { | 514 | for (i = 0; i < B53_N_PORTS; i++) { |
| 518 | port = &priv->port_intrs[i]; | 515 | port = &priv->port_intrs[i]; |
| 519 | 516 | ||
| @@ -7,7 +7,6 @@ · 6 unmodified lines | |||
| 7 | 7 | ||
| 8 | #include <linux/delay.h> | 8 | #include <linux/delay.h> |
| 9 | #include <linux/export.h> | 9 | #include <linux/export.h> |
| 10 | #include <linux/gpio.h> | ||
| 11 | #include <linux/gpio/consumer.h> | 10 | #include <linux/gpio/consumer.h> |
| 12 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
| 13 | #include <linux/module.h> | 12 | #include <linux/module.h> |
| @@ -15,7 +14,6 @@ · 1 unmodified line | |||
| 15 | #include <linux/phy.h> | 14 | #include <linux/phy.h> |
| 16 | #include <linux/etherdevice.h> | 15 | #include <linux/etherdevice.h> |
| 17 | #include <linux/if_bridge.h> | 16 | #include <linux/if_bridge.h> |
| 18 | #include <linux/of_gpio.h> | ||
| 19 | #include <linux/of_net.h> | 17 | #include <linux/of_net.h> |
| 20 | #include <net/dsa.h> | 18 | #include <net/dsa.h> |
| 21 | #include <net/switchdev.h> | 19 | #include <net/switchdev.h> |
| @@ -18,7 +18,6 @@ · 17 unmodified lines | |||
| 18 | #include <linux/mfd/syscon.h> | 18 | #include <linux/mfd/syscon.h> |
| 19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
| 20 | #include <linux/netdevice.h> | 20 | #include <linux/netdevice.h> |
| 21 | #include <linux/of_gpio.h> | ||
| 22 | #include <linux/of_mdio.h> | 21 | #include <linux/of_mdio.h> |
| 23 | #include <linux/of_net.h> | 22 | #include <linux/of_net.h> |
| 24 | #include <linux/of_platform.h> | 23 | #include <linux/of_platform.h> |
| @@ -2403,6 +2403,107 @@ static int mv88e6xxx_stats_setup(struct mv88e6xxx_chip *chip) · 2402 unmodified lines | |||
| 2403 | return mv88e6xxx_g1_stats_clear(chip); | 2403 | return mv88e6xxx_g1_stats_clear(chip); |
| 2404 | } | 2404 | } |
| 2405 | 2405 | ||
| 2406 | /* The mv88e6390 has some hidden registers used for debug and | ||
| 2407 | * development. The errata also makes use of them. | ||
| 2408 | */ | ||
| 2409 | static int mv88e6390_hidden_write(struct mv88e6xxx_chip *chip, int port, | ||
| 2410 | int reg, u16 val) | ||
| 2411 | { | ||
| 2412 | u16 ctrl; | ||
| 2413 | int err; | ||
| 2414 | |||
| 2415 | err = mv88e6xxx_port_write(chip, PORT_RESERVED_1A_DATA_PORT, | ||
| 2416 | PORT_RESERVED_1A, val); | ||
| 2417 | if (err) | ||
| 2418 | return err; | ||
| 2419 | |||
| 2420 | ctrl = PORT_RESERVED_1A_BUSY | PORT_RESERVED_1A_WRITE | | ||
| 2421 | PORT_RESERVED_1A_BLOCK | port << PORT_RESERVED_1A_PORT_SHIFT | | ||
| 2422 | reg; | ||
| 2423 | |||
| 2424 | return mv88e6xxx_port_write(chip, PORT_RESERVED_1A_CTRL_PORT, | ||
| 2425 | PORT_RESERVED_1A, ctrl); | ||
| 2426 | } | ||
| 2427 | |||
| 2428 | static int mv88e6390_hidden_wait(struct mv88e6xxx_chip *chip) | ||
| 2429 | { | ||
| 2430 | return mv88e6xxx_wait(chip, PORT_RESERVED_1A_CTRL_PORT, | ||
| 2431 | PORT_RESERVED_1A, PORT_RESERVED_1A_BUSY); | ||
| 2432 | } | ||
| 2433 | |||
| 2434 | |||
| 2435 | static int mv88e6390_hidden_read(struct mv88e6xxx_chip *chip, int port, | ||
| 2436 | int reg, u16 *val) | ||
| 2437 | { | ||
| 2438 | u16 ctrl; | ||
| 2439 | int err; | ||
| 2440 | |||
| 2441 | ctrl = PORT_RESERVED_1A_BUSY | PORT_RESERVED_1A_READ | | ||
| 2442 | PORT_RESERVED_1A_BLOCK | port << PORT_RESERVED_1A_PORT_SHIFT | | ||
| 2443 | reg; | ||
| 2444 | |||
| 2445 | err = mv88e6xxx_port_write(chip, PORT_RESERVED_1A_CTRL_PORT, | ||
| 2446 | PORT_RESERVED_1A, ctrl); | ||
| 2447 | if (err) | ||
| 2448 | return err; | ||
| 2449 | |||
| 2450 | err = mv88e6390_hidden_wait(chip); | ||
| 2451 | if (err) | ||
| 2452 | return err; | ||
| 2453 | |||
| 2454 | return mv88e6xxx_port_read(chip, PORT_RESERVED_1A_DATA_PORT, | ||
| 2455 | PORT_RESERVED_1A, val); | ||
| 2456 | } | ||
| 2457 | |||
| 2458 | /* Check if the errata has already been applied. */ | ||
| 2459 | static bool mv88e6390_setup_errata_applied(struct mv88e6xxx_chip *chip) | ||
| 2460 | { | ||
| 2461 | int port; | ||
| 2462 | int err; | ||
| 2463 | u16 val; | ||
| 2464 | |||
| 2465 | for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { | ||
| 2466 | err = mv88e6390_hidden_read(chip, port, 0, &val); | ||
| 2467 | if (err) { | ||
| 2468 | dev_err(chip->dev, | ||
| 2469 | "Error reading hidden register: %d\n", err); | ||
| 2470 | return false; | ||
| 2471 | } | ||
| 2472 | if (val != 0x01c0) | ||
| 2473 | return false; | ||
| 2474 | } | ||
| 2475 | |||
| 2476 | return true; | ||
| 2477 | } | ||
| 2478 | |||
| 2479 | /* The 6390 copper ports have an errata which require poking magic | ||
| 2480 | * values into undocumented hidden registers and then performing a | ||
| 2481 | * software reset. | ||
| 2482 | */ | ||
| 2483 | static int mv88e6390_setup_errata(struct mv88e6xxx_chip *chip) | ||
| 2484 | { | ||
| 2485 | int port; | ||
| 2486 | int err; | ||
| 2487 | |||
| 2488 | if (mv88e6390_setup_errata_applied(chip)) | ||
| 2489 | return 0; | ||
| 2490 | |||
| 2491 | /* Set the ports into blocking mode */ | ||
| 2492 | for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { | ||
| 2493 | err = mv88e6xxx_port_set_state(chip, port, BR_STATE_DISABLED); | ||
| 2494 | if (err) | ||
| 2495 | return err; | ||
| 2496 | } | ||
| 2497 | |||
| 2498 | for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { | ||
| 2499 | err = mv88e6390_hidden_write(chip, port, 0, 0x01c0); | ||
| 2500 | if (err) | ||
| 2501 | return err; | ||
| 2502 | } | ||
| 2503 | |||
| 2504 | return mv88e6xxx_software_reset(chip); | ||
| 2505 | } | ||
| 2506 | |||
| 2406 | static int mv88e6xxx_setup(struct dsa_switch *ds) | 2507 | static int mv88e6xxx_setup(struct dsa_switch *ds) |
| 2407 | { | 2508 | { |
| 2408 | struct mv88e6xxx_chip *chip = ds->priv; | 2509 | struct mv88e6xxx_chip *chip = ds->priv; |
| @@ -2415,6 +2516,12 @@ static int mv88e6xxx_setup(struct dsa_switch *ds) · 6 unmodified lines | |||
| 2415 | 2516 | ||
| 2416 | mutex_lock(&chip->reg_lock); | 2517 | mutex_lock(&chip->reg_lock); |
| 2417 | 2518 | ||
| 2519 | if (chip->info->ops->setup_errata) { | ||
| 2520 | err = chip->info->ops->setup_errata(chip); | ||
| 2521 | if (err) | ||
| 2522 | goto unlock; | ||
| 2523 | } | ||
| 2524 | |||
| 2418 | /* Cache the cmode of each port. */ | 2525 | /* Cache the cmode of each port. */ |
| 2419 | for (i = 0; i < mv88e6xxx_num_ports(chip); i++) { | 2526 | for (i = 0; i < mv88e6xxx_num_ports(chip); i++) { |
| 2420 | if (chip->info->ops->port_get_cmode) { | 2527 | if (chip->info->ops->port_get_cmode) { |
| @@ -3226,6 +3333,7 @@ static const struct mv88e6xxx_ops mv88e6185_ops = { · 805 unmodified lines | |||
| 3226 | 3333 | ||
| 3227 | static const struct mv88e6xxx_ops mv88e6190_ops = { | 3334 | static const struct mv88e6xxx_ops mv88e6190_ops = { |
| 3228 | /* MV88E6XXX_FAMILY_6390 */ | 3335 | /* MV88E6XXX_FAMILY_6390 */ |
| 3336 | .setup_errata = mv88e6390_setup_errata, | ||
| 3229 | .irl_init_all = mv88e6390_g2_irl_init_all, | 3337 | .irl_init_all = mv88e6390_g2_irl_init_all, |
| 3230 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, | 3338 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3231 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, | 3339 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| @@ -3269,6 +3377,7 @@ static const struct mv88e6xxx_ops mv88e6190_ops = { · 37 unmodified lines | |||
| 3269 | 3377 | ||
| 3270 | static const struct mv88e6xxx_ops mv88e6190x_ops = { | 3378 | static const struct mv88e6xxx_ops mv88e6190x_ops = { |
| 3271 | /* MV88E6XXX_FAMILY_6390 */ | 3379 | /* MV88E6XXX_FAMILY_6390 */ |
| 3380 | .setup_errata = mv88e6390_setup_errata, | ||
| 3272 | .irl_init_all = mv88e6390_g2_irl_init_all, | 3381 | .irl_init_all = mv88e6390_g2_irl_init_all, |
| 3273 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, | 3382 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3274 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, | 3383 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| @@ -3312,6 +3421,7 @@ static const struct mv88e6xxx_ops mv88e6190x_ops = { · 37 unmodified lines | |||
| 3312 | 3421 | ||
| 3313 | static const struct mv88e6xxx_ops mv88e6191_ops = { | 3422 | static const struct mv88e6xxx_ops mv88e6191_ops = { |
| 3314 | /* MV88E6XXX_FAMILY_6390 */ | 3423 | /* MV88E6XXX_FAMILY_6390 */ |
| 3424 | .setup_errata = mv88e6390_setup_errata, | ||
| 3315 | .irl_init_all = mv88e6390_g2_irl_init_all, | 3425 | .irl_init_all = mv88e6390_g2_irl_init_all, |
| 3316 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, | 3426 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3317 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, | 3427 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| @@ -3404,6 +3514,7 @@ static const struct mv88e6xxx_ops mv88e6240_ops = { · 86 unmodified lines | |||
| 3404 | 3514 | ||
| 3405 | static const struct mv88e6xxx_ops mv88e6290_ops = { | 3515 | static const struct mv88e6xxx_ops mv88e6290_ops = { |
| 3406 | /* MV88E6XXX_FAMILY_6390 */ | 3516 | /* MV88E6XXX_FAMILY_6390 */ |
| 3517 | .setup_errata = mv88e6390_setup_errata, | ||
| 3407 | .irl_init_all = mv88e6390_g2_irl_init_all, | 3518 | .irl_init_all = mv88e6390_g2_irl_init_all, |
| 3408 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, | 3519 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3409 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, | 3520 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| @@ -3709,6 +3820,7 @@ static const struct mv88e6xxx_ops mv88e6352_ops = { · 299 unmodified lines | |||
| 3709 | 3820 | ||
| 3710 | static const struct mv88e6xxx_ops mv88e6390_ops = { | 3821 | static const struct mv88e6xxx_ops mv88e6390_ops = { |
| 3711 | /* MV88E6XXX_FAMILY_6390 */ | 3822 | /* MV88E6XXX_FAMILY_6390 */ |
| 3823 | .setup_errata = mv88e6390_setup_errata, | ||
| 3712 | .irl_init_all = mv88e6390_g2_irl_init_all, | 3824 | .irl_init_all = mv88e6390_g2_irl_init_all, |
| 3713 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, | 3825 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3714 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, | 3826 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| @@ -3756,6 +3868,7 @@ static const struct mv88e6xxx_ops mv88e6390_ops = { · 41 unmodified lines | |||
| 3756 | 3868 | ||
| 3757 | static const struct mv88e6xxx_ops mv88e6390x_ops = { | 3869 | static const struct mv88e6xxx_ops mv88e6390x_ops = { |
| 3758 | /* MV88E6XXX_FAMILY_6390 */ | 3870 | /* MV88E6XXX_FAMILY_6390 */ |
| 3871 | .setup_errata = mv88e6390_setup_errata, | ||
| 3759 | .irl_init_all = mv88e6390_g2_irl_init_all, | 3872 | .irl_init_all = mv88e6390_g2_irl_init_all, |
| 3760 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, | 3873 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3761 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, | 3874 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| @@ -300,6 +300,11 @@ struct mv88e6xxx_mdio_bus { · 299 unmodified lines | |||
| 300 | }; | 300 | }; |
| 301 | 301 | ||
| 302 | struct mv88e6xxx_ops { | 302 | struct mv88e6xxx_ops { |
| 303 | /* Switch Setup Errata, called early in the switch setup to | ||
| 304 | * allow any errata actions to be performed | ||
| 305 | */ | ||
| 306 | int (*setup_errata)(struct mv88e6xxx_chip *chip); | ||
| 307 | |||
| 303 | int (*ieee_pri_map)(struct mv88e6xxx_chip *chip); | 308 | int (*ieee_pri_map)(struct mv88e6xxx_chip *chip); |
| 304 | int (*ip_pri_map)(struct mv88e6xxx_chip *chip); | 309 | int (*ip_pri_map)(struct mv88e6xxx_chip *chip); |
| 305 | 310 | ||
| @@ -314,6 +314,7 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) · 313 unmodified lines | |||
| 314 | { | 314 | { |
| 315 | struct mv88e6xxx_chip *chip = dev_id; | 315 | struct mv88e6xxx_chip *chip = dev_id; |
| 316 | struct mv88e6xxx_atu_entry entry; | 316 | struct mv88e6xxx_atu_entry entry; |
| 317 | int spid; | ||
| 317 | int err; | 318 | int err; |
| 318 | u16 val; | 319 | u16 val; |
| 319 | 320 | ||
| @@ -336,6 +337,8 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) · 16 unmodified lines | |||
| 336 | if (err) | 337 | if (err) |
| 337 | goto out; | 338 | goto out; |
| 338 | 339 | ||
| 340 | spid = entry.state; | ||
| 341 | |||
| 339 | if (val & MV88E6XXX_G1_ATU_OP_AGE_OUT_VIOLATION) { | 342 | if (val & MV88E6XXX_G1_ATU_OP_AGE_OUT_VIOLATION) { |
| 340 | dev_err_ratelimited(chip->dev, | 343 | dev_err_ratelimited(chip->dev, |
| 341 | "ATU age out violation for %pM\n", | 344 | "ATU age out violation for %pM\n", |
| @@ -344,23 +347,23 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) · 2 unmodified lines | |||
| 344 | 347 | ||
| 345 | if (val & MV88E6XXX_G1_ATU_OP_MEMBER_VIOLATION) { | 348 | if (val & MV88E6XXX_G1_ATU_OP_MEMBER_VIOLATION) { |
| 346 | dev_err_ratelimited(chip->dev, | 349 | dev_err_ratelimited(chip->dev, |
| 347 | "ATU member violation for %pM portvec %x\n", | 350 | "ATU member violation for %pM portvec %x spid %d\n", |
| 348 | entry.mac, entry.portvec); | 351 | entry.mac, entry.portvec, spid); |
| 349 | chip->ports[entry.portvec].atu_member_violation++; | 352 | chip->ports[spid].atu_member_violation++; |
| 350 | } | 353 | } |
| 351 | 354 | ||
| 352 | if (val & MV88E6XXX_G1_ATU_OP_MISS_VIOLATION) { | 355 | if (val & MV88E6XXX_G1_ATU_OP_MISS_VIOLATION) { |
| 353 | dev_err_ratelimited(chip->dev, | 356 | dev_err_ratelimited(chip->dev, |
| 354 | "ATU miss violation for %pM portvec %x\n", | 357 | "ATU miss violation for %pM portvec %x spid %d\n", |
| 355 | entry.mac, entry.portvec); | 358 | entry.mac, entry.portvec, spid); |
| 356 | chip->ports[entry.portvec].atu_miss_violation++; | 359 | chip->ports[spid].atu_miss_violation++; |
| 357 | } | 360 | } |
| 358 | 361 | ||
| 359 | if (val & MV88E6XXX_G1_ATU_OP_FULL_VIOLATION) { | 362 | if (val & MV88E6XXX_G1_ATU_OP_FULL_VIOLATION) { |
| 360 | dev_err_ratelimited(chip->dev, | 363 | dev_err_ratelimited(chip->dev, |
| 361 | "ATU full violation for %pM portvec %x\n", | 364 | "ATU full violation for %pM portvec %x spid %d\n", |
| 362 | entry.mac, entry.portvec); | 365 | entry.mac, entry.portvec, spid); |
| 363 | chip->ports[entry.portvec].atu_full_violation++; | 366 | chip->ports[spid].atu_full_violation++; |
| 364 | } | 367 | } |
| 365 | mutex_unlock(&chip->reg_lock); | 368 | mutex_unlock(&chip->reg_lock); |
| 366 | 369 | ||
| @@ -251,6 +251,16 @@ · 250 unmodified lines | |||
| 251 | /* Offset 0x19: Port IEEE Priority Remapping Registers (4-7) */ | 251 | /* Offset 0x19: Port IEEE Priority Remapping Registers (4-7) */ |
| 252 | #define MV88E6095_PORT_IEEE_PRIO_REMAP_4567 0x19 | 252 | #define MV88E6095_PORT_IEEE_PRIO_REMAP_4567 0x19 |
| 253 | 253 | ||
| 254 | /* Offset 0x1a: Magic undocumented errata register */ | ||
| 255 | #define PORT_RESERVED_1A 0x1a | ||
| 256 | #define PORT_RESERVED_1A_BUSY BIT(15) | ||
| 257 | #define PORT_RESERVED_1A_WRITE BIT(14) | ||
| 258 | #define PORT_RESERVED_1A_READ 0 | ||
| 259 | #define PORT_RESERVED_1A_PORT_SHIFT 5 | ||
| 260 | #define PORT_RESERVED_1A_BLOCK (0xf << 10) | ||
| 261 | #define PORT_RESERVED_1A_CTRL_PORT 4 | ||
| 262 | #define PORT_RESERVED_1A_DATA_PORT 5 | ||
| 263 | |||
| 254 | int mv88e6xxx_port_read(struct mv88e6xxx_chip *chip, int port, int reg, | 264 | int mv88e6xxx_port_read(struct mv88e6xxx_chip *chip, int port, int reg, |
| 255 | u16 *val); | 265 | u16 *val); |
| 256 | int mv88e6xxx_port_write(struct mv88e6xxx_chip *chip, int port, int reg, | 266 | int mv88e6xxx_port_write(struct mv88e6xxx_chip *chip, int port, int reg, |
| @@ -664,7 +664,7 @@ int mv88e6390_serdes_irq_setup(struct mv88e6xxx_chip *chip, int port) · 663 unmodified lines | |||
| 664 | if (port < 9) | 664 | if (port < 9) |
| 665 | return 0; | 665 | return 0; |
| 666 | 666 | ||
| 667 | return mv88e6390_serdes_irq_setup(chip, port); | 667 | return mv88e6390x_serdes_irq_setup(chip, port); |
| 668 | } | 668 | } |
| 669 | 669 | ||
| 670 | void mv88e6390x_serdes_irq_free(struct mv88e6xxx_chip *chip, int port) | 670 | void mv88e6390x_serdes_irq_free(struct mv88e6xxx_chip *chip, int port) |
| @@ -347,16 +347,17 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi) · 346 unmodified lines | |||
| 347 | struct device_node *mdio_np; | 347 | struct device_node *mdio_np; |
| 348 | int ret; | 348 | int ret; |
| 349 | 349 | ||
| 350 | mdio_np = of_find_compatible_node(smi->dev->of_node, NULL, | 350 | mdio_np = of_get_compatible_child(smi->dev->of_node, "realtek,smi-mdio"); |
| 351 | "realtek,smi-mdio"); | ||
| 352 | if (!mdio_np) { | 351 | if (!mdio_np) { |
| 353 | dev_err(smi->dev, "no MDIO bus node\n"); | 352 | dev_err(smi->dev, "no MDIO bus node\n"); |
| 354 | return -ENODEV; | 353 | return -ENODEV; |
| 355 | } | 354 | } |
| 356 | 355 | ||
| 357 | smi->slave_mii_bus = devm_mdiobus_alloc(smi->dev); | 356 | smi->slave_mii_bus = devm_mdiobus_alloc(smi->dev); |
| 358 | if (!smi->slave_mii_bus) | 357 | if (!smi->slave_mii_bus) { |
| 359 | return -ENOMEM; | 358 | ret = -ENOMEM; |
| 359 | goto err_put_node; | ||
| 360 | } | ||
| 360 | smi->slave_mii_bus->priv = smi; | 361 | smi->slave_mii_bus->priv = smi; |
| 361 | smi->slave_mii_bus->name = "SMI slave MII"; | 362 | smi->slave_mii_bus->name = "SMI slave MII"; |
| 362 | smi->slave_mii_bus->read = realtek_smi_mdio_read; | 363 | smi->slave_mii_bus->read = realtek_smi_mdio_read; |
| @@ -371,10 +372,15 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi) · 8 unmodified lines | |||
| 371 | if (ret) { | 372 | if (ret) { |
| 372 | dev_err(smi->dev, "unable to register MDIO bus %s\n", | 373 | dev_err(smi->dev, "unable to register MDIO bus %s\n", |
| 373 | smi->slave_mii_bus->id); | 374 | smi->slave_mii_bus->id); |
| 374 | of_node_put(mdio_np); | 375 | goto err_put_node; |
| 375 | } | 376 | } |
| 376 | 377 | ||
| 377 | return 0; | 378 | return 0; |
| 379 | |||
| 380 | err_put_node: | ||
| 381 | of_node_put(mdio_np); | ||
| 382 | |||
| 383 | return ret; | ||
| 378 | } | 384 | } |
| 379 | 385 | ||
| 380 | static int realtek_smi_probe(struct platform_device *pdev) | 386 | static int realtek_smi_probe(struct platform_device *pdev) |
| @@ -457,6 +463,8 @@ static int realtek_smi_remove(struct platform_device *pdev) · 76 unmodified lines | |||
| 457 | struct realtek_smi *smi = dev_get_drvdata(&pdev->dev); | 463 | struct realtek_smi *smi = dev_get_drvdata(&pdev->dev); |
| 458 | 464 | ||
| 459 | dsa_unregister_switch(smi->ds); | 465 | dsa_unregister_switch(smi->ds); |
| 466 | if (smi->slave_mii_bus) | ||
| 467 | of_node_put(smi->slave_mii_bus->dev.of_node); | ||
| 460 | gpiod_set_value(smi->reset, 1); | 468 | gpiod_set_value(smi->reset, 1); |
| 461 | 469 | ||
| 462 | return 0; | 470 | return 0; |
| @@ -1433,18 +1433,18 @@ static int greth_of_probe(struct platform_device *ofdev) · 1432 unmodified lines | |||
| 1433 | } | 1433 | } |
| 1434 | 1434 | ||
| 1435 | /* Allocate TX descriptor ring in coherent memory */ | 1435 | /* Allocate TX descriptor ring in coherent memory */ |
| 1436 | greth->tx_bd_base = dma_zalloc_coherent(greth->dev, 1024, | 1436 | greth->tx_bd_base = dma_alloc_coherent(greth->dev, 1024, |
| 1437 | &greth->tx_bd_base_phys, | 1437 | &greth->tx_bd_base_phys, |
| 1438 | GFP_KERNEL); | 1438 | GFP_KERNEL); |
| 1439 | if (!greth->tx_bd_base) { | 1439 | if (!greth->tx_bd_base) { |
| 1440 | err = -ENOMEM; | 1440 | err = -ENOMEM; |
| 1441 | goto error3; | 1441 | goto error3; |
| 1442 | } | 1442 | } |
| 1443 | 1443 | ||
| 1444 | /* Allocate RX descriptor ring in coherent memory */ | 1444 | /* Allocate RX descriptor ring in coherent memory */ |
| 1445 | greth->rx_bd_base = dma_zalloc_coherent(greth->dev, 1024, | 1445 | greth->rx_bd_base = dma_alloc_coherent(greth->dev, 1024, |
| 1446 | &greth->rx_bd_base_phys, | 1446 | &greth->rx_bd_base_phys, |
| 1447 | GFP_KERNEL); | 1447 | GFP_KERNEL); |
| 1448 | if (!greth->rx_bd_base) { | 1448 | if (!greth->rx_bd_base) { |
| 1449 | err = -ENOMEM; | 1449 | err = -ENOMEM; |
| 1450 | goto error4; | 1450 | goto error4; |
| @@ -795,8 +795,8 @@ static int slic_init_stat_queue(struct slic_device *sdev) · 794 unmodified lines | |||
| 795 | size = stq->len * sizeof(*descs) + DESC_ALIGN_MASK; | 795 | size = stq->len * sizeof(*descs) + DESC_ALIGN_MASK; |
| 796 | 796 | ||
| 797 | for (i = 0; i < SLIC_NUM_STAT_DESC_ARRAYS; i++) { | 797 | for (i = 0; i < SLIC_NUM_STAT_DESC_ARRAYS; i++) { |
| 798 | descs = dma_zalloc_coherent(&sdev->pdev->dev, size, &paddr, | 798 | descs = dma_alloc_coherent(&sdev->pdev->dev, size, &paddr, |
| 799 | GFP_KERNEL); | 799 | GFP_KERNEL); |
| 800 | if (!descs) { | 800 | if (!descs) { |
| 801 | netdev_err(sdev->netdev, | 801 | netdev_err(sdev->netdev, |
| 802 | "failed to allocate status descriptors\n"); | 802 | "failed to allocate status descriptors\n"); |
| @@ -1240,8 +1240,8 @@ static int slic_init_shmem(struct slic_device *sdev) · 437 unmodified lines | |||
| 1240 | struct slic_shmem_data *sm_data; | 1240 | struct slic_shmem_data *sm_data; |
| 1241 | dma_addr_t paddr; | 1241 | dma_addr_t paddr; |
| 1242 | 1242 | ||
| 1243 | sm_data = dma_zalloc_coherent(&sdev->pdev->dev, sizeof(*sm_data), | 1243 | sm_data = dma_alloc_coherent(&sdev->pdev->dev, sizeof(*sm_data), |
| 1244 | &paddr, GFP_KERNEL); | 1244 | &paddr, GFP_KERNEL); |
| 1245 | if (!sm_data) { | 1245 | if (!sm_data) { |
| 1246 | dev_err(&sdev->pdev->dev, "failed to allocate shared memory\n"); | 1246 | dev_err(&sdev->pdev->dev, "failed to allocate shared memory\n"); |
| 1247 | return -ENOMEM; | 1247 | return -ENOMEM; |
| @@ -1621,8 +1621,8 @@ static int slic_read_eeprom(struct slic_device *sdev) · 373 unmodified lines | |||
| 1621 | int err = 0; | 1621 | int err = 0; |
| 1622 | u8 *mac[2]; | 1622 | u8 *mac[2]; |
| 1623 | 1623 | ||
| 1624 | eeprom = dma_zalloc_coherent(&sdev->pdev->dev, SLIC_EEPROM_SIZE, | 1624 | eeprom = dma_alloc_coherent(&sdev->pdev->dev, SLIC_EEPROM_SIZE, |
| 1625 | &paddr, GFP_KERNEL); | 1625 | &paddr, GFP_KERNEL); |
| 1626 | if (!eeprom) | 1626 | if (!eeprom) |
| 1627 | return -ENOMEM; | 1627 | return -ENOMEM; |
| 1628 | 1628 | ||
| @@ -2059,7 +2059,7 @@ static inline void ace_tx_int(struct net_device *dev, · 2058 unmodified lines | |||
| 2059 | if (skb) { | 2059 | if (skb) { |
| 2060 | dev->stats.tx_packets++; | 2060 | dev->stats.tx_packets++; |
| 2061 | dev->stats.tx_bytes += skb->len; | 2061 | dev->stats.tx_bytes += skb->len; |
| 2062 | dev_kfree_skb_irq(skb); | 2062 | dev_consume_skb_irq(skb); |
| 2063 | info->skb = NULL; | 2063 | info->skb = NULL; |
| 2064 | } | 2064 | } |
| 2065 | 2065 | ||
| @@ -145,7 +145,8 @@ u32 msgdma_tx_completions(struct altera_tse_private *priv) · 144 unmodified lines | |||
| 145 | & 0xffff; | 145 | & 0xffff; |
| 146 | 146 | ||
| 147 | if (inuse) { /* Tx FIFO is not empty */ | 147 | if (inuse) { /* Tx FIFO is not empty */ |
| 148 | ready = priv->tx_prod - priv->tx_cons - inuse - 1; | 148 | ready = max_t(int, |
| 149 | priv->tx_prod - priv->tx_cons - inuse - 1, 0); | ||
| 149 | } else { | 150 | } else { |
| 150 | /* Check for buffered last packet */ | 151 | /* Check for buffered last packet */ |
| 151 | status = csrrd32(priv->tx_dma_csr, msgdma_csroffs(status)); | 152 | status = csrrd32(priv->tx_dma_csr, msgdma_csroffs(status)); |
| @@ -714,8 +714,10 @@ static struct phy_device *connect_local_phy(struct net_device *dev) · 713 unmodified lines | |||
| 714 | 714 | ||
| 715 | phydev = phy_connect(dev, phy_id_fmt, &altera_tse_adjust_link, | 715 | phydev = phy_connect(dev, phy_id_fmt, &altera_tse_adjust_link, |
| 716 | priv->phy_iface); | 716 | priv->phy_iface); |
| 717 | if (IS_ERR(phydev)) | 717 | if (IS_ERR(phydev)) { |
| 718 | netdev_err(dev, "Could not attach to PHY\n"); | 718 | netdev_err(dev, "Could not attach to PHY\n"); |
| 719 | phydev = NULL; | ||
| 720 | } | ||
| 719 | 721 | ||
| 720 | } else { | 722 | } else { |
| 721 | int ret; | 723 | int ret; |
| @@ -111,8 +111,8 @@ static int ena_com_admin_init_sq(struct ena_com_admin_queue *queue) · 110 unmodified lines | |||
| 111 | struct ena_com_admin_sq *sq = &queue->sq; | 111 | struct ena_com_admin_sq *sq = &queue->sq; |
| 112 | u16 size = ADMIN_SQ_SIZE(queue->q_depth); | 112 | u16 size = ADMIN_SQ_SIZE(queue->q_depth); |
| 113 | 113 | ||
| 114 | sq->entries = dma_zalloc_coherent(queue->q_dmadev, size, &sq->dma_addr, | 114 | sq->entries = dma_alloc_coherent(queue->q_dmadev, size, &sq->dma_addr, |
| 115 | GFP_KERNEL); | 115 | GFP_KERNEL); |
| 116 | 116 | ||
| 117 | if (!sq->entries) { | 117 | if (!sq->entries) { |
| 118 | pr_err("memory allocation failed"); | 118 | pr_err("memory allocation failed"); |
| @@ -133,8 +133,8 @@ static int ena_com_admin_init_cq(struct ena_com_admin_queue *queue) · 14 unmodified lines | |||
| 133 | struct ena_com_admin_cq *cq = &queue->cq; | 133 | struct ena_com_admin_cq *cq = &queue->cq; |
| 134 | u16 size = ADMIN_CQ_SIZE(queue->q_depth); | 134 | u16 size = ADMIN_CQ_SIZE(queue->q_depth); |
| 135 | 135 | ||
| 136 | cq->entries = dma_zalloc_coherent(queue->q_dmadev, size, &cq->dma_addr, | 136 | cq->entries = dma_alloc_coherent(queue->q_dmadev, size, &cq->dma_addr, |
| 137 | GFP_KERNEL); | 137 | GFP_KERNEL); |
| 138 | 138 | ||
| 139 | if (!cq->entries) { | 139 | if (!cq->entries) { |
| 140 | pr_err("memory allocation failed"); | 140 | pr_err("memory allocation failed"); |
| @@ -156,8 +156,8 @@ static int ena_com_admin_init_aenq(struct ena_com_dev *dev, · 15 unmodified lines | |||
| 156 | 156 | ||
| 157 | dev->aenq.q_depth = ENA_ASYNC_QUEUE_DEPTH; | 157 | dev->aenq.q_depth = ENA_ASYNC_QUEUE_DEPTH; |
| 158 | size = ADMIN_AENQ_SIZE(ENA_ASYNC_QUEUE_DEPTH); | 158 | size = ADMIN_AENQ_SIZE(ENA_ASYNC_QUEUE_DEPTH); |
| 159 | aenq->entries = dma_zalloc_coherent(dev->dmadev, size, &aenq->dma_addr, | 159 | aenq->entries = dma_alloc_coherent(dev->dmadev, size, &aenq->dma_addr, |
| 160 | GFP_KERNEL); | 160 | GFP_KERNEL); |
| 161 | 161 | ||
| 162 | if (!aenq->entries) { | 162 | if (!aenq->entries) { |
| 163 | pr_err("memory allocation failed"); | 163 | pr_err("memory allocation failed"); |
| @@ -344,15 +344,15 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev, · 180 unmodified lines | |||
| 344 | dev_node = dev_to_node(ena_dev->dmadev); | 344 | dev_node = dev_to_node(ena_dev->dmadev); |
| 345 | set_dev_node(ena_dev->dmadev, ctx->numa_node); | 345 | set_dev_node(ena_dev->dmadev, ctx->numa_node); |
| 346 | io_sq->desc_addr.virt_addr = | 346 | io_sq->desc_addr.virt_addr = |
| 347 | dma_zalloc_coherent(ena_dev->dmadev, size, | 347 | dma_alloc_coherent(ena_dev->dmadev, size, |
| 348 | &io_sq->desc_addr.phys_addr, | 348 | &io_sq->desc_addr.phys_addr, |
| 349 | GFP_KERNEL); | 349 | GFP_KERNEL); |
| 350 | set_dev_node(ena_dev->dmadev, dev_node); | 350 | set_dev_node(ena_dev->dmadev, dev_node); |
| 351 | if (!io_sq->desc_addr.virt_addr) { | 351 | if (!io_sq->desc_addr.virt_addr) { |
| 352 | io_sq->desc_addr.virt_addr = | 352 | io_sq->desc_addr.virt_addr = |
| 353 | dma_zalloc_coherent(ena_dev->dmadev, size, | 353 | dma_alloc_coherent(ena_dev->dmadev, size, |
| 354 | &io_sq->desc_addr.phys_addr, | 354 | &io_sq->desc_addr.phys_addr, |
| 355 | GFP_KERNEL); | 355 | GFP_KERNEL); |
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | if (!io_sq->desc_addr.virt_addr) { | 358 | if (!io_sq->desc_addr.virt_addr) { |
| @@ -425,14 +425,14 @@ static int ena_com_init_io_cq(struct ena_com_dev *ena_dev, · 66 unmodified lines | |||
| 425 | prev_node = dev_to_node(ena_dev->dmadev); | 425 | prev_node = dev_to_node(ena_dev->dmadev); |
| 426 | set_dev_node(ena_dev->dmadev, ctx->numa_node); | 426 | set_dev_node(ena_dev->dmadev, ctx->numa_node); |
| 427 | io_cq->cdesc_addr.virt_addr = | 427 | io_cq->cdesc_addr.virt_addr = |
| 428 | dma_zalloc_coherent(ena_dev->dmadev, size, | 428 | dma_alloc_coherent(ena_dev->dmadev, size, |
| 429 | &io_cq->cdesc_addr.phys_addr, GFP_KERNEL); | 429 | &io_cq->cdesc_addr.phys_addr, GFP_KERNEL); |
| 430 | set_dev_node(ena_dev->dmadev, prev_node); | 430 | set_dev_node(ena_dev->dmadev, prev_node); |
| 431 | if (!io_cq->cdesc_addr.virt_addr) { | 431 | if (!io_cq->cdesc_addr.virt_addr) { |
| 432 | io_cq->cdesc_addr.virt_addr = | 432 | io_cq->cdesc_addr.virt_addr = |
| 433 | dma_zalloc_coherent(ena_dev->dmadev, size, | 433 | dma_alloc_coherent(ena_dev->dmadev, size, |
| 434 | &io_cq->cdesc_addr.phys_addr, | 434 | &io_cq->cdesc_addr.phys_addr, |
| 435 | GFP_KERNEL); | 435 | GFP_KERNEL); |
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | if (!io_cq->cdesc_addr.virt_addr) { | 438 | if (!io_cq->cdesc_addr.virt_addr) { |
| @@ -1026,8 +1026,8 @@ static int ena_com_hash_key_allocate(struct ena_com_dev *ena_dev) · 587 unmodified lines | |||
| 1026 | struct ena_rss *rss = &ena_dev->rss; | 1026 | struct ena_rss *rss = &ena_dev->rss; |
| 1027 | 1027 | ||
| 1028 | rss->hash_key = | 1028 | rss->hash_key = |
| 1029 | dma_zalloc_coherent(ena_dev->dmadev, sizeof(*rss->hash_key), | 1029 | dma_alloc_coherent(ena_dev->dmadev, sizeof(*rss->hash_key), |
| 1030 | &rss->hash_key_dma_addr, GFP_KERNEL); | 1030 | &rss->hash_key_dma_addr, GFP_KERNEL); |
| 1031 | 1031 | ||
| 1032 | if (unlikely(!rss->hash_key)) | 1032 | if (unlikely(!rss->hash_key)) |
| 1033 | return -ENOMEM; | 1033 | return -ENOMEM; |
| @@ -1050,8 +1050,8 @@ static int ena_com_hash_ctrl_init(struct ena_com_dev *ena_dev) · 16 unmodified lines | |||
| 1050 | struct ena_rss *rss = &ena_dev->rss; | 1050 | struct ena_rss *rss = &ena_dev->rss; |
| 1051 | 1051 | ||
| 1052 | rss->hash_ctrl = | 1052 | rss->hash_ctrl = |
| 1053 | dma_zalloc_coherent(ena_dev->dmadev, sizeof(*rss->hash_ctrl), | 1053 | dma_alloc_coherent(ena_dev->dmadev, sizeof(*rss->hash_ctrl), |
| 1054 | &rss->hash_ctrl_dma_addr, GFP_KERNEL); | 1054 | &rss->hash_ctrl_dma_addr, GFP_KERNEL); |
| 1055 | 1055 | ||
| 1056 | if (unlikely(!rss->hash_ctrl)) | 1056 | if (unlikely(!rss->hash_ctrl)) |
| 1057 | return -ENOMEM; | 1057 | return -ENOMEM; |
| @@ -1094,8 +1094,8 @@ static int ena_com_indirect_table_allocate(struct ena_com_dev *ena_dev, · 36 unmodified lines | |||
| 1094 | sizeof(struct ena_admin_rss_ind_table_entry); | 1094 | sizeof(struct ena_admin_rss_ind_table_entry); |
| 1095 | 1095 | ||
| 1096 | rss->rss_ind_tbl = | 1096 | rss->rss_ind_tbl = |
| 1097 | dma_zalloc_coherent(ena_dev->dmadev, tbl_size, | 1097 | dma_alloc_coherent(ena_dev->dmadev, tbl_size, |
| 1098 | &rss->rss_ind_tbl_dma_addr, GFP_KERNEL); | 1098 | &rss->rss_ind_tbl_dma_addr, GFP_KERNEL); |
| 1099 | if (unlikely(!rss->rss_ind_tbl)) | 1099 | if (unlikely(!rss->rss_ind_tbl)) |
| 1100 | goto mem_err1; | 1100 | goto mem_err1; |
| 1101 | 1101 | ||
| @@ -1649,9 +1649,9 @@ int ena_com_mmio_reg_read_request_init(struct ena_com_dev *ena_dev) · 547 unmodified lines | |||
| 1649 | 1649 | ||
| 1650 | spin_lock_init(&mmio_read->lock); | 1650 | spin_lock_init(&mmio_read->lock); |
| 1651 | mmio_read->read_resp = | 1651 | mmio_read->read_resp = |
| 1652 | dma_zalloc_coherent(ena_dev->dmadev, | 1652 | dma_alloc_coherent(ena_dev->dmadev, |
| 1653 | sizeof(*mmio_read->read_resp), | 1653 | sizeof(*mmio_read->read_resp), |
| 1654 | &mmio_read->read_resp_dma_addr, GFP_KERNEL); | 1654 | &mmio_read->read_resp_dma_addr, GFP_KERNEL); |
| 1655 | if (unlikely(!mmio_read->read_resp)) | 1655 | if (unlikely(!mmio_read->read_resp)) |
| 1656 | goto err; | 1656 | goto err; |
| 1657 | 1657 | ||
| @@ -2623,8 +2623,8 @@ int ena_com_allocate_host_info(struct ena_com_dev *ena_dev) · 965 unmodified lines | |||
| 2623 | struct ena_host_attribute *host_attr = &ena_dev->host_attr; | 2623 | struct ena_host_attribute *host_attr = &ena_dev->host_attr; |
| 2624 | 2624 | ||
| 2625 | host_attr->host_info = | 2625 | host_attr->host_info = |
| 2626 | dma_zalloc_coherent(ena_dev->dmadev, SZ_4K, | 2626 | dma_alloc_coherent(ena_dev->dmadev, SZ_4K, |
| 2627 | &host_attr->host_info_dma_addr, GFP_KERNEL); | 2627 | &host_attr->host_info_dma_addr, GFP_KERNEL); |
| 2628 | if (unlikely(!host_attr->host_info)) | 2628 | if (unlikely(!host_attr->host_info)) |
| 2629 | return -ENOMEM; | 2629 | return -ENOMEM; |
| 2630 | 2630 | ||
| @@ -2641,8 +2641,9 @@ int ena_com_allocate_debug_area(struct ena_com_dev *ena_dev, · 10 unmodified lines | |||
| 2641 | struct ena_host_attribute *host_attr = &ena_dev->host_attr; | 2641 | struct ena_host_attribute *host_attr = &ena_dev->host_attr; |
| 2642 | 2642 | ||
| 2643 | host_attr->debug_area_virt_addr = | 2643 | host_attr->debug_area_virt_addr = |
| 2644 | dma_zalloc_coherent(ena_dev->dmadev, debug_area_size, | 2644 | dma_alloc_coherent(ena_dev->dmadev, debug_area_size, |
| 2645 | &host_attr->debug_area_dma_addr, GFP_KERNEL); | 2645 | &host_attr->debug_area_dma_addr, |
| 2646 | GFP_KERNEL); | ||
| 2646 | if (unlikely(!host_attr->debug_area_virt_addr)) { | 2647 | if (unlikely(!host_attr->debug_area_virt_addr)) { |
| 2647 | host_attr->debug_area_size = 0; | 2648 | host_attr->debug_area_size = 0; |
| 2648 | return -ENOMEM; | 2649 | return -ENOMEM; |
| @@ -666,7 +666,7 @@ static int amd8111e_tx(struct net_device *dev) · 665 unmodified lines | |||
| 666 | pci_unmap_single(lp->pci_dev, lp->tx_dma_addr[tx_index], | 666 | pci_unmap_single(lp->pci_dev, lp->tx_dma_addr[tx_index], |
| 667 | lp->tx_skbuff[tx_index]->len, | 667 | lp->tx_skbuff[tx_index]->len, |
| 668 | PCI_DMA_TODEVICE); | 668 | PCI_DMA_TODEVICE); |
| 669 | dev_kfree_skb_irq (lp->tx_skbuff[tx_index]); | 669 | dev_consume_skb_irq(lp->tx_skbuff[tx_index]); |
| 670 | lp->tx_skbuff[tx_index] = NULL; | 670 | lp->tx_skbuff[tx_index] = NULL; |
| 671 | lp->tx_dma_addr[tx_index] = 0; | 671 | lp->tx_dma_addr[tx_index] = 0; |
| 672 | } | 672 | } |
| @@ -431,8 +431,6 @@ · 430 unmodified lines | |||
| 431 | #define MAC_MDIOSCAR_PA_WIDTH 5 | 431 | #define MAC_MDIOSCAR_PA_WIDTH 5 |
| 432 | #define MAC_MDIOSCAR_RA_INDEX 0 | 432 | #define MAC_MDIOSCAR_RA_INDEX 0 |
| 433 | #define MAC_MDIOSCAR_RA_WIDTH 16 | 433 | #define MAC_MDIOSCAR_RA_WIDTH 16 |
| 434 | #define MAC_MDIOSCAR_REG_INDEX 0 | ||
| 435 | #define MAC_MDIOSCAR_REG_WIDTH 21 | ||
| 436 | #define MAC_MDIOSCCDR_BUSY_INDEX 22 | 434 | #define MAC_MDIOSCCDR_BUSY_INDEX 22 |
| 437 | #define MAC_MDIOSCCDR_BUSY_WIDTH 1 | 435 | #define MAC_MDIOSCCDR_BUSY_WIDTH 1 |
| 438 | #define MAC_MDIOSCCDR_CMD_INDEX 16 | 436 | #define MAC_MDIOSCCDR_CMD_INDEX 16 |
| @@ -1284,6 +1284,20 @@ static void xgbe_write_mmd_regs(struct xgbe_prv_data *pdata, int prtad, · 1283 unmodified lines | |||
| 1284 | } | 1284 | } |
| 1285 | } | 1285 | } |
| 1286 | 1286 | ||
| 1287 | static unsigned int xgbe_create_mdio_sca(int port, int reg) | ||
| 1288 | { | ||
| 1289 | unsigned int mdio_sca, da; | ||
| 1290 | |||
| 1291 | da = (reg & MII_ADDR_C45) ? reg >> 16 : 0; | ||
| 1292 | |||
| 1293 | mdio_sca = 0; | ||
| 1294 | XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, RA, reg); | ||
| 1295 | XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, PA, port); | ||
| 1296 | XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, da); | ||
| 1297 | |||
| 1298 | return mdio_sca; | ||
| 1299 | } | ||
| 1300 | |||
| 1287 | static int xgbe_write_ext_mii_regs(struct xgbe_prv_data *pdata, int addr, | 1301 | static int xgbe_write_ext_mii_regs(struct xgbe_prv_data *pdata, int addr, |
| 1288 | int reg, u16 val) | 1302 | int reg, u16 val) |
| 1289 | { | 1303 | { |
| @@ -1291,9 +1305,7 @@ static int xgbe_write_ext_mii_regs(struct xgbe_prv_data *pdata, int addr, · 1 unmodified line | |||
| 1291 | 1305 | ||
| 1292 | reinit_completion(&pdata->mdio_complete); | 1306 | reinit_completion(&pdata->mdio_complete); |
| 1293 | 1307 | ||
| 1294 | mdio_sca = 0; | 1308 | mdio_sca = xgbe_create_mdio_sca(addr, reg); |
| 1295 | XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, REG, reg); | ||
| 1296 | XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, addr); | ||
| 1297 | XGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca); | 1309 | XGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca); |
| 1298 | 1310 | ||
| 1299 | mdio_sccd = 0; | 1311 | mdio_sccd = 0; |
| @@ -1317,9 +1329,7 @@ static int xgbe_read_ext_mii_regs(struct xgbe_prv_data *pdata, int addr, · 17 unmodified lines | |||
| 1317 | 1329 | ||
| 1318 | reinit_completion(&pdata->mdio_complete); | 1330 | reinit_completion(&pdata->mdio_complete); |
| 1319 | 1331 | ||
| 1320 | mdio_sca = 0; | ||
6 more lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 76 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 119 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 166 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 115 lines aren’t shown here.
This diff is large: its 196 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 148 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 155 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 133 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 175 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 291 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 88 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 334 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 113 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 88 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 299 lines aren’t shown here.
This diff is large: its 118 lines aren’t shown here.
This diff is large: its 76 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 96 lines aren’t shown here.
This diff is large: its 127 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 89 lines aren’t shown here.
This diff is large: its 117 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 119 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 97 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 107 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 134 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 97 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 76 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 285 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 132 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 107 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 191 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 84 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 175 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 211 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 111 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 154 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 172 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 157 lines aren’t shown here.
This diff is large: its 275 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 197 lines aren’t shown here.
This diff is large: its 117 lines aren’t shown here.
This diff is large: its 117 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 103 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 103 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 101 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 313 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 99 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 190 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 207 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 121 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 129 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 124 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 139 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 126 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 85 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 76 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 244 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 330 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 111 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 169 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 169 lines aren’t shown here.
This diff is large: its 113 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 149 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 133 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 184 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 169 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 372 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 150 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 84 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 176 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 405 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 88 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 1164 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 129 lines aren’t shown here.
This diff is large: its 4 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 261 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 428 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 76 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 114 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 101 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 110 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 127 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 2 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 276 lines aren’t shown here.
This diff is large: its 4 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 156 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 190 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 4 lines aren’t shown here.
This diff is large: its 763 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 130 lines aren’t shown here.
This diff is large: its 128 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 193 lines aren’t shown here.
This diff is large: its 396 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.