accel/habanalabs: check failure of eventfd_signal
Oded Gabbay
maintainerPATCH 1/6 accel/habanalabs: check failure of eventfd_signal
From: Dafna Hirschfeld <[email protected]>
print err log if eventfd_signal return val is not 1 as expected.
--- drivers/accel/habanalabs/common/device.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/accel/habanalabs/common/device.c +10 -4
@@ -2043,13 +2043,19 @@ int hl_device_cond_reset(struct hl_device *hdev, u32 flags, u64 event_mask)return hl_device_reset (hdev, flags |HL_DRV_RESET_HARD ); } -static void hl_notifier_event_send (struct hl_notifier_event *notifier_event,u64 event_mask) +static void hl_notifier_event_send (struct hl_device *hdev, +struct hl_notifier_event *notifier_event,u64 event_mask) { +u64 n; +mutex_lock (¬ifier_event->lock); notifier_event->events_mask |= event_mask; -if (notifier_event->eventfd) -eventfd_signal (notifier_event->eventfd,1 ); +if (notifier_event->eventfd) { + n =eventfd_signal (notifier_event->eventfd,1 ); +if (n !=1 ) +dev_err (hdev->dev,"eventfd signal failed, incremented by %llu\n" , n); + }mutex_unlock (¬ifier_event->lock); }
@@ -2073,7 +2079,7 @@ void hl_notifier_event_send_all(struct hl_device *hdev, u64 event_mask)mutex_lock (&hdev->fpriv_list_lock);list_for_each_entry (hpriv, &hdev->fpriv_list, dev_node) -hl_notifier_event_send (&hpriv->notifier_event, event_mask); +hl_notifier_event_send (hdev, &hpriv->notifier_event, event_mask);mutex_unlock (&hdev->fpriv_list_lock); }
Signature · 1 line
2.34.1
Oded Gabbay
maintainerPATCH 2/6 accel/habanalabs/gaudi2: add interrupt affinity for user interrupts
From: Dani Liberman <[email protected]>
User interrupts are MSIx interrupts coming from Gaudi2, that have specific range of IDs and are assigned to the sole use of the user process that opened the Gaudi2 device (reminder: there can be only a single user process running on Gaudi2 at any given time).
The interrupts are allocated and managed by the driver and therefore, the user expects the driver to initialize them properly, which also includes setting the affinity to the related CPU cores of the device's NUMA node to get maximum performance.
--- drivers/accel/habanalabs/common/device.c | 30 ++++++++++++++++++++ drivers/accel/habanalabs/common/habanalabs.h | 5 ++++ drivers/accel/habanalabs/gaudi2/gaudi2.c | 5 ++++ 3 files changed, 40 insertions(+)
drivers/accel/habanalabs/common/device.c +30 -0
@@ -2807,3 +2807,33 @@ void hl_enable_err_info_capture(struct hl_error_info *captured_err_info)atomic_set (&captured_err_info->cs_timeout.write_enable,1 ); captured_err_info->undef_opcode.write_enable = true; } + +void hl_init_cpu_for_irq (struct hl_device *hdev) +{ +struct cpumask *available_mask = &hdev->irq_affinity_mask; +int numa_node = hdev->pdev->dev.numa_node, i; +static struct cpumask cpu_mask; + +if (numa_node <0 ) +return ; + +if (!cpumask_and (&cpu_mask,cpumask_of_node (numa_node), cpu_online_mask)) { +dev_err (hdev->dev,"No available affinities in current numa node\n" ); +return ; + } + +/* Remove HT siblings */ +for_each_cpu (i, &cpu_mask) +cpumask_set_cpu (cpumask_first (topology_sibling_cpumask (i)), available_mask); +} + +void hl_set_irq_affinity (struct hl_device *hdev,int irq) +{ +if (cpumask_empty (&hdev->irq_affinity_mask)) { +dev_dbg (hdev->dev,"affinity mask is empty\n" ); +return ; + } + +if (irq_set_affinity_hint (irq, &hdev->irq_affinity_mask)) +dev_err (hdev->dev,"Failed setting irq %d affinity\n" , irq); +}
drivers/accel/habanalabs/common/habanalabs.h +5 -0
@@ -3257,6 +3257,7 @@ struct hl_reset_info {* @clk_throttling: holds information about current/previous clock throttling events * @captured_err_info: holds information about errors. * @reset_info: holds current device reset information. +* @irq_affinity_mask: mask of available CPU cores for user and decoder interrupt handling. * @stream_master_qid_arr: pointer to array with QIDs of master streams. * @fw_inner_major_ver: the major of current loaded preboot inner version. * @fw_inner_minor_ver: the minor of current loaded preboot inner version.
@@ -3446,6 +3447,8 @@ struct hl_device {struct hl_reset_info reset_info; +cpumask_t irq_affinity_mask; +u32 *stream_master_qid_arr;u32 fw_inner_major_ver;u32 fw_inner_minor_ver;
@@ -4032,6 +4035,8 @@ void hl_handle_critical_hw_err(struct hl_device *hdev, u16 event_id, u64 *event_void hl_handle_fw_err (struct hl_device *hdev,struct hl_info_fw_err_info *info);void hl_capture_engine_err (struct hl_device *hdev,u16 engine_id,u16 error_count);void hl_enable_err_info_capture (struct hl_error_info *captured_err_info); +void hl_init_cpu_for_irq (struct hl_device *hdev); +void hl_set_irq_affinity (struct hl_device *hdev,int irq);#ifdef CONFIG_DEBUG_FS
drivers/accel/habanalabs/gaudi2/gaudi2.c +5 -0
@@ -4254,6 +4254,8 @@ static int gaudi2_enable_msix(struct hl_device *hdev)if (gaudi2->hw_cap_initialized &HW_CAP_MSIX )return 0 ; +hl_init_cpu_for_irq (hdev); + rc =pci_alloc_irq_vectors (hdev->pdev,GAUDI2_MSIX_ENTRIES ,GAUDI2_MSIX_ENTRIES ,PCI_IRQ_MSIX );if (rc <0 ) {
@@ -4307,6 +4309,7 @@ static int gaudi2_enable_msix(struct hl_device *hdev) i++, j++, user_irq_init_cnt++) { irq =pci_irq_vector (hdev->pdev, i); +hl_set_irq_affinity (hdev, irq); rc =request_irq (irq, hl_irq_user_interrupt_handler,0 ,gaudi2_irq_name (i), &hdev->user_interrupt[j]);if (rc) {
@@ -4333,6 +4336,7 @@ static int gaudi2_enable_msix(struct hl_device *hdev) i < GAUDI2_IRQ_NUM_USER_FIRST + user_irq_init_cnt ; i++, j++) { irq =pci_irq_vector (hdev->pdev, i); +irq_set_affinity_hint (irq,NULL );free_irq (irq, &hdev->user_interrupt[j]); } irq =pci_irq_vector (hdev->pdev,GAUDI2_IRQ_NUM_UNEXPECTED_ERROR );
@@ -4413,6 +4417,7 @@ static void gaudi2_disable_msix(struct hl_device *hdev) k < hdev->asic_prop.user_interrupt_count ; i++, j++, k++) { irq =pci_irq_vector (hdev->pdev, i); +irq_set_affinity_hint (irq,NULL );free_irq (irq, &hdev->user_interrupt[j]); }
Signature · 1 line
2.34.1
kernel test robot
build botRe: [PATCH 2/6] accel/habanalabs/gaudi2: add interrupt affinity for user interrupts
kernel test robot noticed the following build errors:
Hi Oded,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-tip/drm-tip]
[also build test ERROR on linus/master v6.7-rc8]
[cannot apply to drm-misc/drm-misc-next next-20240103]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Oded-Gabbay/accel-habanalabs-gaudi2-add-interrupt-affinity-for-user-interrupts/20240102-231007 base: git://anongit.freedesktop.org/drm/drm-tip drm-tip patch link: https://lore.kernel.org/r/20240102150654.522555-2-ogabbay%40kernel.org patch subject: [PATCH 2/6] accel/habanalabs/gaudi2: add interrupt affinity for user interrupts config: x86_64-randconfig-121-20240103 (https://download.01.org/0day-ci/archive/20240103/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240103/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/accel/habanalabs/common/device.c: In function 'hl_init_cpu_for_irq':
>> drivers/accel/habanalabs/common/device.c:2814:40: error: 'struct device' has no member named 'numa_node'
2814 | int numa_node = hdev->pdev->dev.numa_node, i;
| ^vim +2814 drivers/accel/habanalabs/common/device.c
2810
2811 void hl_init_cpu_for_irq(struct hl_device *hdev)
2812 {
2813 struct cpumask *available_mask = &hdev->irq_affinity_mask;
> 2814 int numa_node = hdev->pdev->dev.numa_node, i;
2815 static struct cpumask cpu_mask;
2816
2817 if (numa_node < 0)
2818 return;
2819
2820 if (!cpumask_and(&cpu_mask, cpumask_of_node(numa_node), cpu_online_mask)) {
2821 dev_err(hdev->dev, "No available affinities in current numa node\n");
2822 return;
2823 }
2824
2825 /* Remove HT siblings */
2826 for_each_cpu(i, &cpu_mask)
2827 cpumask_set_cpu(cpumask_first(topology_sibling_cpumask(i)), available_mask);
2828 }
2829
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 2/6] accel/habanalabs/gaudi2: add interrupt affinity for user interrupts
In reply to Oded Gabbaykernel test robot noticed the following build errors:
Hi Oded,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-tip/drm-tip]
[also build test ERROR on linus/master v6.7-rc8]
[cannot apply to drm-misc/drm-misc-next next-20240103]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Oded-Gabbay/accel-habanalabs-gaudi2-add-interrupt-affinity-for-user-interrupts/20240102-231007 base: git://anongit.freedesktop.org/drm/drm-tip drm-tip patch link: https://lore.kernel.org/r/20240102150654.522555-2-ogabbay%40kernel.org patch subject: [PATCH 2/6] accel/habanalabs/gaudi2: add interrupt affinity for user interrupts config: x86_64-buildonly-randconfig-003-20240103 (https://download.01.org/0day-ci/archive/20240104/[email protected]/config) compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240104/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> drivers/accel/habanalabs/common/device.c:2814:34: error: no member named 'numa_node' in 'struct device'
2814 | int numa_node = hdev->pdev->dev.numa_node, i;
| ~~~~~~~~~~~~~~~ ^1 error generated.
vim +2814 drivers/accel/habanalabs/common/device.c
2810
2811 void hl_init_cpu_for_irq(struct hl_device *hdev)
2812 {
2813 struct cpumask *available_mask = &hdev->irq_affinity_mask;
> 2814 int numa_node = hdev->pdev->dev.numa_node, i;
2815 static struct cpumask cpu_mask;
2816
2817 if (numa_node < 0)
2818 return;
2819
2820 if (!cpumask_and(&cpu_mask, cpumask_of_node(numa_node), cpu_online_mask)) {
2821 dev_err(hdev->dev, "No available affinities in current numa node\n");
2822 return;
2823 }
2824
2825 /* Remove HT siblings */
2826 for_each_cpu(i, &cpu_mask)
2827 cpumask_set_cpu(cpumask_first(topology_sibling_cpumask(i)), available_mask);
2828 }
2829
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Oded Gabbay
maintainerPATCH 3/6 accel/habanalabs: increase HL_MAX_STR to 64 bytes to avoid warnings
In reply to Oded GabbayFrom: Koby Elbaz <[email protected]>
Fix a warning of a buffer overflow:
‘snprintf’ output between 38 and 47 bytes into a destination of size 32
--- drivers/accel/habanalabs/common/habanalabs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/habanalabs/common/habanalabs.h +1 -1
@@ -2547,7 +2547,7 @@ struct hl_state_dump_specs {* DEVICES */ -#define HL_STR_MAX 32 +#define HL_STR_MAX 64#define HL_DEV_STS_MAX (HL_DEVICE_STATUS_LAST + 1)
Signature · 1 line
2.34.1
Oded Gabbay
maintainerPATCH 4/6 accel/habanalabs: fix DRAM BAR base address calculation
In reply to Oded GabbayFrom: Tomer Tayar <[email protected]>
When the DRAM region size in the BAR is not a power of 2, calculating the corresponding BAR base address should be done using the offset from the DRAM start address, and not using directly the DRAM address.
--- drivers/accel/habanalabs/common/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/accel/habanalabs/common/device.c +2 -1
@@ -55,7 +55,8 @@ static u64 hl_set_dram_bar(struct hl_device *hdev, u64 addr, struct pci_mem_regiif (is_power_of_2 (prop->dram_pci_bar_size)) bar_base_addr = addr & ~(prop->dram_pci_bar_size -0x1ull );else - bar_base_addr =DIV_ROUND_DOWN_ULL (addr, prop->dram_pci_bar_size) * + bar_base_addr = region->region_base + +div64_u64 ((addr - region->region_base), prop->dram_pci_bar_size) * prop->dram_pci_bar_size; old_base = hdev->asic_funcs->set_dram_bar_base (hdev, bar_base_addr);
Signature · 1 line
2.34.1
Oded Gabbay
maintainerPATCH 5/6 accel/habanalabs/gaudi2: move HMMU page tables to device memory
In reply to Oded GabbayFrom: Farah Kassabri <[email protected]>
Currently the HMMU page tables reside in the host memory, which will cause host access from the device for every page walk. This can affect PCIe bandwidth in certain scenarios.
To prevent that problem, HMMU page tables will be moved to the device memory so the miss transaction will read the hops from there instead of going to the host.
--- drivers/accel/habanalabs/common/habanalabs.h | 26 ++ drivers/accel/habanalabs/common/hw_queue.c | 17 + drivers/accel/habanalabs/common/mmu/Makefile | 2 +- drivers/accel/habanalabs/common/mmu/mmu.c | 223 ++++++++++- drivers/accel/habanalabs/common/mmu/mmu_v1.c | 352 +++--------------- drivers/accel/habanalabs/common/mmu/mmu_v2.c | 338 +++++++++++++++++ drivers/accel/habanalabs/gaudi/gaudi.c | 1 + drivers/accel/habanalabs/gaudi2/gaudi2.c | 245 ++++++++---- drivers/accel/habanalabs/gaudi2/gaudi2P.h | 12 +- .../include/hw_ip/mmu/mmu_general.h | 2 + 10 files changed, 836 insertions(+), 382 deletions(-) create mode 100644 drivers/accel/habanalabs/common/mmu/mmu_v2.c
drivers/accel/habanalabs/common/habanalabs.h +26 -0
@@ -443,18 +443,22 @@ enum hl_collective_mode {* a CB handle can be provided for jobs on this queue. * Otherwise, a CB address must be provided. * @collective_mode: collective mode of current queue +* @q_dram_bd_address: PQ dram address, used when PQ need to reside in DRAM. * @driver_only: true if only the driver is allowed to send a job to this queue, * false otherwise. * @binned: True if the queue is binned out and should not be used * @supports_sync_stream: True if queue supports sync stream +* @dram_bd: True if the bd should be copied to dram, needed for PQ which has been allocated on dram */ struct hw_queue_properties {enum hl_queue_type type;enum queue_cb_alloc_flags cb_alloc_flags;enum hl_collective_mode collective_mode; +u64 q_dram_bd_address;u8 driver_only;u8 binned;u8 supports_sync_stream; +u8 dram_bd; };/**
@@ -1052,6 +1056,8 @@ struct hl_encaps_signals_mgr {* @collective_mode: collective mode of current queue * @kernel_address: holds the queue's kernel virtual address. * @bus_address: holds the queue's DMA address. +* @pq_dram_address: hold the dram address when the PQ is allocated, used when dram_bd is true in +* queue properites. * @pi: holds the queue's pi value. * @ci: holds the queue's ci value, AS CALCULATED BY THE DRIVER (not real ci). * @hw_queue_id: the id of the H/W queue.
@@ -1061,6 +1067,7 @@ struct hl_encaps_signals_mgr {* @valid: is the queue valid (we have array of 32 queues, not all of them * exist). * @supports_sync_stream: True if queue supports sync stream +* @dram_bd: True if the bd should be copied to dram, needed for PQ which has been allocated on dram */ struct hl_hw_queue {struct hl_cs_job **shadow_queue;
@@ -1069,6 +1076,7 @@ struct hl_hw_queue {enum hl_collective_mode collective_mode;void *kernel_address;dma_addr_t bus_address; +u64 pq_dram_address;u32 pi;atomic_t ci;u32 hw_queue_id;
@@ -1077,6 +1085,7 @@ struct hl_hw_queue {u16 int_queue_len;u8 valid;u8 supports_sync_stream; +u8 dram_bd; };/**
@@ -3889,6 +3898,7 @@ int hl_mmu_hr_get_tlb_info(struct hl_ctx *ctx, u64 virt_addr, struct hl_mmu_hop_ struct hl_hr_mmu_funcs *hr_func);int hl_mmu_if_set_funcs (struct hl_device *hdev);void hl_mmu_v1_set_funcs (struct hl_device *hdev,struct hl_mmu_funcs *mmu); +void hl_mmu_v2_set_funcs (struct hl_device *hdev,struct hl_mmu_funcs *mmu);void hl_mmu_v2_hr_set_funcs (struct hl_device *hdev,struct hl_mmu_funcs *mmu);int hl_mmu_va_to_pa (struct hl_ctx *ctx,u64 virt_addr,u64 *phys_addr); int hl_mmu_get_tlb_info(struct hl_ctx *ctx, u64 virt_addr,
@@ -3896,6 +3906,22 @@ int hl_mmu_get_tlb_info(struct hl_ctx *ctx, u64 virt_addr,u64 hl_mmu_scramble_addr (struct hl_device *hdev,u64 addr);u64 hl_mmu_descramble_addr (struct hl_device *hdev,u64 addr);bool hl_is_dram_va (struct hl_device *hdev,u64 virt_addr); +struct pgt_info *hl_mmu_dr_get_pgt_info (struct hl_ctx *ctx,u64 hop_addr); +void hl_mmu_dr_free_hop (struct hl_ctx *ctx,u64 hop_addr); +void hl_mmu_dr_free_pgt_node (struct hl_ctx *ctx,struct pgt_info *pgt_info); +u64 hl_mmu_dr_get_phys_hop0_addr (struct hl_ctx *ctx); +u64 hl_mmu_dr_get_hop0_addr (struct hl_ctx *ctx); +void hl_mmu_dr_write_pte (struct hl_ctx *ctx,u64 shadow_pte_addr,u64 val); +void hl_mmu_dr_write_final_pte (struct hl_ctx *ctx,u64 shadow_pte_addr,u64 val); +void hl_mmu_dr_clear_pte (struct hl_ctx *ctx,u64 pte_addr); +u64 hl_mmu_dr_get_phys_addr (struct hl_ctx *ctx,u64 shadow_addr); +void hl_mmu_dr_get_pte (struct hl_ctx *ctx,u64 hop_addr); +int hl_mmu_dr_put_pte (struct hl_ctx *ctx,u64 hop_addr); +u64 hl_mmu_dr_get_alloc_next_hop_addr (struct hl_ctx *ctx,u64 curr_pte,bool *is_new_hop); +u64 hl_mmu_dr_alloc_hop (struct hl_ctx *ctx); +void hl_mmu_dr_flush (struct hl_ctx *ctx); +int hl_mmu_dr_init (struct hl_device *hdev); +void hl_mmu_dr_fini (struct hl_device *hdev);int hl_fw_load_fw_to_device (struct hl_device *hdev,const char *fw_name,void __iomem *dst,u32 src_offset,u32 size);
drivers/accel/habanalabs/common/hw_queue.c +17 -0
@@ -84,6 +84,8 @@ void hl_hw_queue_submit_bd(struct hl_device *hdev, struct hl_hw_queue *q, u32 ctl, u32 len, u64 ptr) {struct hl_bd *bd; +u64 addr; +int i; bd = q->kernel_address; bd +=hl_pi_2_offset (q->pi);
@@ -91,7 +93,16 @@ void hl_hw_queue_submit_bd(struct hl_device *hdev, struct hl_hw_queue *q, bd->len =cpu_to_le32 (len); bd->ptr =cpu_to_le64 (ptr); +if (q->dram_bd) +for (i =0 ; i <2 ; i++) { + addr = q->pq_dram_address + + ((hl_pi_2_offset (q->pi) *sizeof (struct hl_bd )) + (i *sizeof (u64))); + hdev->asic_funcs->access_dev_mem (hdev,PCI_REGION_DRAM , addr, + (u64 *)(bd) + i,DEBUGFS_WRITE64 ); + } + q->pi =hl_queue_inc_ptr (q->pi); + hdev->asic_funcs->ring_doorbell (hdev, q->hw_queue_id, q->pi); }
@@ -1087,12 +1098,18 @@ int hl_hw_queues_create(struct hl_device *hdev) q->supports_sync_stream = asic->hw_queues_props[i].supports_sync_stream; q->collective_mode = asic->hw_queues_props[i].collective_mode; + q->dram_bd = asic->hw_queues_props[i].dram_bd; + rc =queue_init (hdev, q, i);if (rc) {dev_err (hdev->dev,"failed to initialize queue %d\n" , i); goto release_queues; } + +/* Set DRAM PQ address for the queue if it should be at DRAM */ +if (q->dram_bd) + q->pq_dram_address = asic->hw_queues_props[i].q_dram_bd_address; }return 0 ;
drivers/accel/habanalabs/common/mmu/Makefile +1 -1
@@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only HL_COMMON_MMU_FILES := common/mmu/mmu.o common/mmu/mmu_v1.o \ - common/mmu/mmu_v2_hr.o + common/mmu/mmu_v2.o common/mmu/mmu_v2_hr.o
drivers/accel/habanalabs/common/mmu/mmu.c +221 -2
238 lines not on this page · raw message
drivers/accel/habanalabs/common/mmu/mmu_v1.c +44 -308
518 lines not on this page · raw message
drivers/accel/habanalabs/common/mmu/mmu_v2.c new file +338 -0
338 lines not on this page · raw message
drivers/accel/habanalabs/gaudi/gaudi.c +1 -0
@@ -649,6 +649,7 @@ static int gaudi_set_fixed_properties(struct hl_device *hdev) prop->dmmu.start_addr = (VA_HOST_SPACE_START +VA_HOST_SPACE_SIZE /2 ); prop->dmmu.end_addr =VA_HOST_SPACE_END ; prop->dmmu.page_size =PAGE_SIZE_2MB ; + prop->dmmu.pgt_size = prop->mmu_pgt_size; prop->cfg_size =CFG_SIZE ; prop->max_asid =MAX_ASID ;
drivers/accel/habanalabs/gaudi2/gaudi2.c +182 -63
486 lines not on this page · raw message
drivers/accel/habanalabs/gaudi2/gaudi2P.h +4 -8
@@ -19,8 +19,6 @@#define GAUDI2_LINUX_FW_FILE "habanalabs/gaudi2/gaudi2-fit.itb"#define GAUDI2_BOOT_FIT_FILE "habanalabs/gaudi2/gaudi2-boot-fit.itb" -#define MMU_PAGE_TABLES_INITIAL_SIZE 0x10000000/* 256MB */ -#define GAUDI2_CPU_TIMEOUT_USEC 30000000/* 30s */ #define NUMBER_OF_PDMA_QUEUES 2
@@ -109,13 +107,11 @@/* DRAM Memory Map */ #define CPU_FW_IMAGE_SIZE 0x10000000/* 256MB */ - -/* This define should be used only when working in a debug mode without dram. -* When working with dram, the driver size will be calculated dynamically. -*/ -#define NIC_DEFAULT_DRV_SIZE 0x20000000/* 512MB */ -#define CPU_FW_IMAGE_ADDR DRAM_PHYS_BASE +#define PMMU_PAGE_TABLES_SIZE 0x10000000/* 256MB */ +#define EDMA_PQS_SIZE SZ_2M +#define EDMA_SCRATCHPAD_SIZE SZ_1M +#define HMMU_PAGE_TABLES_SIZE SZ_1M#define NIC_NUMBER_OF_PORTS NIC_NUMBER_OF_ENGINES
drivers/accel/habanalabs/include/hw_ip/mmu/mmu_general.h +2 -0
@@ -26,6 +26,8 @@#define LAST_MASK 0x0000000000800ull#define FLAGS_MASK 0x0000000000FFFull +#define MMU_ARCH_3_HOPS 3 +#define MMU_ARCH_4_HOPS 4#define MMU_ARCH_5_HOPS 5#define MMU_ARCH_6_HOPS 6
Signature · 1 line
2.34.1
kernel test robot
build botRe: [PATCH 5/6] accel/habanalabs/gaudi2: move HMMU page tables to device memory
kernel test robot noticed the following build warnings:
Hi Oded,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-tip/drm-tip]
[cannot apply to drm-misc/drm-misc-next linus/master v6.7-rc8 next-20240103] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Oded-Gabbay/accel-habanalabs-gaudi2-add-interrupt-affinity-for-user-interrupts/20240102-231007 base: git://anongit.freedesktop.org/drm/drm-tip drm-tip patch link: https://lore.kernel.org/r/20240102150654.522555-5-ogabbay%40kernel.org patch subject: [PATCH 5/6] accel/habanalabs/gaudi2: move HMMU page tables to device memory config: x86_64-randconfig-123-20240103 (https://download.01.org/0day-ci/archive/20240103/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240103/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/accel/habanalabs/gaudi2/gaudi2.c:2311:6: warning: no previous prototype for 'gaudi2_is_edma_queue_id' [-Wmissing-prototypes]
2311 | bool gaudi2_is_edma_queue_id(u32 queue_id)
| ^~~~~~~~~~~~~~~~~~~~~~~sparse warnings: (new ones prefixed by >>)
>> drivers/accel/habanalabs/gaudi2/gaudi2.c:2311:6: sparse: sparse: symbol 'gaudi2_is_edma_queue_id' was not declared. Should it be static?
vim +/gaudi2_is_edma_queue_id +2311 drivers/accel/habanalabs/gaudi2/gaudi2.c
2310
> 2311 bool gaudi2_is_edma_queue_id(u32 queue_id)
2312 {
2313
2314 switch (queue_id) {
2315 case GAUDI2_QUEUE_ID_DCORE0_EDMA_0_0...GAUDI2_QUEUE_ID_DCORE0_EDMA_1_3:
2316 case GAUDI2_QUEUE_ID_DCORE1_EDMA_0_0...GAUDI2_QUEUE_ID_DCORE1_EDMA_1_3:
2317 case GAUDI2_QUEUE_ID_DCORE2_EDMA_0_0...GAUDI2_QUEUE_ID_DCORE2_EDMA_1_3:
2318 case GAUDI2_QUEUE_ID_DCORE3_EDMA_0_0...GAUDI2_QUEUE_ID_DCORE3_EDMA_1_3:
2319 return true;
2320 default:
2321 return false;
2322 }
2323 }
2324
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 5/6] accel/habanalabs/gaudi2: move HMMU page tables to device memory
In reply to Oded Gabbaykernel test robot noticed the following build warnings:
Hi Oded,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-tip/drm-tip]
[cannot apply to drm-misc/drm-misc-next linus/master v6.7-rc8 next-20240104] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Oded-Gabbay/accel-habanalabs-gaudi2-add-interrupt-affinity-for-user-interrupts/20240102-231007 base: git://anongit.freedesktop.org/drm/drm-tip drm-tip patch link: https://lore.kernel.org/r/20240102150654.522555-5-ogabbay%40kernel.org patch subject: [PATCH 5/6] accel/habanalabs/gaudi2: move HMMU page tables to device memory config: x86_64-buildonly-randconfig-003-20240103 (https://download.01.org/0day-ci/archive/20240104/[email protected]/config) compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240104/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/accel/habanalabs/gaudi2/gaudi2.c:2311:6: warning: no previous prototype for function 'gaudi2_is_edma_queue_id' [-Wmissing-prototypes]
2311 | bool gaudi2_is_edma_queue_id(u32 queue_id)
| ^
drivers/accel/habanalabs/gaudi2/gaudi2.c:2311:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
2311 | bool gaudi2_is_edma_queue_id(u32 queue_id)
| ^
| static 1 warning generated.
vim +/gaudi2_is_edma_queue_id +2311 drivers/accel/habanalabs/gaudi2/gaudi2.c
2310
> 2311 bool gaudi2_is_edma_queue_id(u32 queue_id)
2312 {
2313
2314 switch (queue_id) {
2315 case GAUDI2_QUEUE_ID_DCORE0_EDMA_0_0...GAUDI2_QUEUE_ID_DCORE0_EDMA_1_3:
2316 case GAUDI2_QUEUE_ID_DCORE1_EDMA_0_0...GAUDI2_QUEUE_ID_DCORE1_EDMA_1_3:
2317 case GAUDI2_QUEUE_ID_DCORE2_EDMA_0_0...GAUDI2_QUEUE_ID_DCORE2_EDMA_1_3:
2318 case GAUDI2_QUEUE_ID_DCORE3_EDMA_0_0...GAUDI2_QUEUE_ID_DCORE3_EDMA_1_3:
2319 return true;
2320 default:
2321 return false;
2322 }
2323 }
2324
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Oded Gabbay
maintainerPATCH 6/6 accel/habanalabs: abort device reset for consecutive heartbeat failures
In reply to Oded GabbayFrom: Tomer Tayar <[email protected]>
The mechanism of aborting device reset for consecutive fatal errors is currently only for fatal errors that are reported by FW.
A non-responsive FW and consecutive heartbeat failures is also considered fatal, so add them as well to this mechanism to avoid recurring device reset in such a case.
--- drivers/accel/habanalabs/common/device.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/accel/habanalabs/common/device.c +8 -6
@@ -1769,14 +1769,16 @@ int hl_device_reset(struct hl_device *hdev, u32 flags) hdev->device_cpu_disabled = false; hdev->reset_info.hard_reset_pending = false; +/* +* Put the device in an unusable state if there are 2 back to back resets due to +* fatal errors. +*/ if (hdev->reset_info.reset_trigger_repeated && - (hdev->reset_info.prev_reset_trigger == -HL_DRV_RESET_FW_FATAL_ERR )) { -/* if there 2 back to back resets from FW, -* ensure driver puts the driver in a unusable state -*/ + (hdev->reset_info.prev_reset_trigger ==HL_DRV_RESET_FW_FATAL_ERR || + hdev->reset_info.prev_reset_trigger == +HL_DRV_RESET_HEARTBEAT )) {dev_crit (hdev->dev, -"%s Consecutive FW fatal errors received, stopping hard reset\n" , +"%s Consecutive fatal errors, stopping hard reset\n" ,dev_name (&(hdev)->pdev->dev)); rc = -EIO ; goto out_err;
Signature · 1 line
2.34.1