@@ -334,15 +334,23 @@ static int gve_alloc_notify_blocks(struct gve_priv *priv)
334334 dev_err (& priv -> pdev -> dev , "Did not receive management vector.\n" );
335335 goto abort_with_msix_enabled ;
336336 }
337- priv -> ntfy_blocks =
337+ priv -> irq_db_indices =
338338 dma_alloc_coherent (& priv -> pdev -> dev ,
339339 priv -> num_ntfy_blks *
340- sizeof (* priv -> ntfy_blocks ),
341- & priv -> ntfy_block_bus , GFP_KERNEL );
342- if (!priv -> ntfy_blocks ) {
340+ sizeof (* priv -> irq_db_indices ),
341+ & priv -> irq_db_indices_bus , GFP_KERNEL );
342+ if (!priv -> irq_db_indices ) {
343343 err = - ENOMEM ;
344344 goto abort_with_mgmt_vector ;
345345 }
346+
347+ priv -> ntfy_blocks = kvzalloc (priv -> num_ntfy_blks *
348+ sizeof (* priv -> ntfy_blocks ), GFP_KERNEL );
349+ if (!priv -> ntfy_blocks ) {
350+ err = - ENOMEM ;
351+ goto abort_with_irq_db_indices ;
352+ }
353+
346354 /* Setup the other blocks - the first n-1 vectors */
347355 for (i = 0 ; i < priv -> num_ntfy_blks ; i ++ ) {
348356 struct gve_notify_block * block = & priv -> ntfy_blocks [i ];
@@ -361,6 +369,7 @@ static int gve_alloc_notify_blocks(struct gve_priv *priv)
361369 }
362370 irq_set_affinity_hint (priv -> msix_vectors [msix_idx ].vector ,
363371 get_cpu_mask (i % active_cpus ));
372+ block -> irq_db_index = & priv -> irq_db_indices [i ].index ;
364373 }
365374 return 0 ;
366375abort_with_some_ntfy_blocks :
@@ -372,10 +381,13 @@ static int gve_alloc_notify_blocks(struct gve_priv *priv)
372381 NULL );
373382 free_irq (priv -> msix_vectors [msix_idx ].vector , block );
374383 }
375- dma_free_coherent (& priv -> pdev -> dev , priv -> num_ntfy_blks *
376- sizeof (* priv -> ntfy_blocks ),
377- priv -> ntfy_blocks , priv -> ntfy_block_bus );
384+ kvfree (priv -> ntfy_blocks );
378385 priv -> ntfy_blocks = NULL ;
386+ abort_with_irq_db_indices :
387+ dma_free_coherent (& priv -> pdev -> dev , priv -> num_ntfy_blks *
388+ sizeof (* priv -> irq_db_indices ),
389+ priv -> irq_db_indices , priv -> irq_db_indices_bus );
390+ priv -> irq_db_indices = NULL ;
379391abort_with_mgmt_vector :
380392 free_irq (priv -> msix_vectors [priv -> mgmt_msix_idx ].vector , priv );
381393abort_with_msix_enabled :
@@ -403,10 +415,12 @@ static void gve_free_notify_blocks(struct gve_priv *priv)
403415 free_irq (priv -> msix_vectors [msix_idx ].vector , block );
404416 }
405417 free_irq (priv -> msix_vectors [priv -> mgmt_msix_idx ].vector , priv );
406- dma_free_coherent (& priv -> pdev -> dev ,
407- priv -> num_ntfy_blks * sizeof (* priv -> ntfy_blocks ),
408- priv -> ntfy_blocks , priv -> ntfy_block_bus );
418+ kvfree (priv -> ntfy_blocks );
409419 priv -> ntfy_blocks = NULL ;
420+ dma_free_coherent (& priv -> pdev -> dev , priv -> num_ntfy_blks *
421+ sizeof (* priv -> irq_db_indices ),
422+ priv -> irq_db_indices , priv -> irq_db_indices_bus );
423+ priv -> irq_db_indices = NULL ;
410424 pci_disable_msix (priv -> pdev );
411425 kvfree (priv -> msix_vectors );
412426 priv -> msix_vectors = NULL ;
@@ -428,7 +442,7 @@ static int gve_setup_device_resources(struct gve_priv *priv)
428442 err = gve_adminq_configure_device_resources (priv ,
429443 priv -> counter_array_bus ,
430444 priv -> num_event_counters ,
431- priv -> ntfy_block_bus ,
445+ priv -> irq_db_indices_bus ,
432446 priv -> num_ntfy_blks );
433447 if (unlikely (err )) {
434448 dev_err (& priv -> pdev -> dev ,
0 commit comments