]> git.baikalelectronics.ru Git - kernel.git/commitdiff
habanalabs: page size can only be a power of 2
authorOhad Sharabi <osharabi@habana.ai>
Wed, 22 Jun 2022 12:38:56 +0000 (15:38 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Tue, 12 Jul 2022 06:09:26 +0000 (09:09 +0300)
We dropped support for page sizes that are not power of 2.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/habanalabs.h
drivers/misc/habanalabs/common/memory.c
drivers/misc/habanalabs/gaudi/gaudi.c
drivers/misc/habanalabs/goya/goya.c

index c5c0861f2059198e3a39e5ee2d99faf9c29b305c..df8d1038723d2aaa591e68a3a2f1550bd9952859 100644 (file)
@@ -1332,8 +1332,6 @@ struct fw_load_mgr {
  * @get_sob_addr: get SOB base address offset.
  * @set_pci_memory_regions: setting properties of PCI memory regions
  * @get_stream_master_qid_arr: get pointer to stream masters QID array
- * @is_valid_dram_page_size: return true if page size is supported in device
- *                           memory allocation, otherwise false.
  * @get_valid_dram_page_orders: get valid device memory allocation page orders
  * @access_dev_mem: access device memory
  * @set_dram_bar_base: set the base of the DRAM BAR
@@ -1453,7 +1451,6 @@ struct hl_asic_funcs {
        u32 (*get_sob_addr)(struct hl_device *hdev, u32 sob_id);
        void (*set_pci_memory_regions)(struct hl_device *hdev);
        u32* (*get_stream_master_qid_arr)(void);
-       bool (*is_valid_dram_page_size)(u32 page_size);
        int (*mmu_get_real_page_size)(struct hl_device *hdev, struct hl_mmu_properties *mmu_prop,
                                        u32 page_size, u32 *real_page_size, bool is_dram_addr);
        void (*get_valid_dram_page_orders)(struct hl_info_dev_memalloc_page_sizes *info);
index 039fd87021ab51cdec9a22056a0f96221949e552..4f35a5668fcbc658ada1afb9ed9ba0f822b90a88 100644 (file)
@@ -36,8 +36,8 @@ static int set_alloc_page_size(struct hl_device *hdev, struct hl_mem_in *args, u
        if (prop->supports_user_set_page_size && args->alloc.page_size) {
                psize = args->alloc.page_size;
 
-               if (!hdev->asic_funcs->is_valid_dram_page_size(psize)) {
-                       dev_err(hdev->dev, "user page size (%#x) is not valid\n", psize);
+               if (!is_power_of_2(psize)) {
+                       dev_err(hdev->dev, "user page size (%#x) is not power of 2\n", psize);
                        return -EINVAL;
                }
        } else {
index 8d206c848e9a379730a2fb810a6357d4e2dc4906..33ad7226dd8cfa34056151e9881cf3e995136e7d 100644 (file)
@@ -9350,7 +9350,6 @@ static const struct hl_asic_funcs gaudi_funcs = {
        .get_sob_addr = gaudi_get_sob_addr,
        .set_pci_memory_regions = gaudi_set_pci_memory_regions,
        .get_stream_master_qid_arr = gaudi_get_stream_master_qid_arr,
-       .is_valid_dram_page_size = NULL,
        .mmu_get_real_page_size = hl_mmu_get_real_page_size,
        .get_valid_dram_page_orders = gaudi_get_valid_dram_page_orders,
        .access_dev_mem = hl_access_dev_mem,
index 9d524527572619851cb0896c889e0df1bfad5ae9..49f859a1f07a5bce104cbd0936e9c4d7814ce825 100644 (file)
@@ -5504,7 +5504,6 @@ static const struct hl_asic_funcs goya_funcs = {
        .get_sob_addr = &goya_get_sob_addr,
        .set_pci_memory_regions = goya_set_pci_memory_regions,
        .get_stream_master_qid_arr = goya_get_stream_master_qid_arr,
-       .is_valid_dram_page_size = NULL,
        .mmu_get_real_page_size = hl_mmu_get_real_page_size,
        .get_valid_dram_page_orders = goya_get_valid_dram_page_orders,
        .access_dev_mem = hl_access_dev_mem,