History

habanalabs/gaudi: support CS with no completion

As part of the staged submission feature, we need Gaudi to support command submissions that will never get a completion.

Ofir Bitton committed 5 years ago

Commit ac6fdbf1 parent 8e39e753 files · +10 −3Browse files

Unified · Split

3 files
  1. drivers/misc/habanalabs/common/command_submission.c +1 −0
  2. drivers/misc/habanalabs/common/habanalabs.h +2 −0
  3. drivers/misc/habanalabs/gaudi/gaudi.c +7 −3
drivers/misc/habanalabs/common/command_submission.c+1−0
@@ -225,6 +225,7 @@ static int cs_parser(struct hl_fpriv *hpriv, struct hl_cs_job *job) · 224 unmodified lines
225225 parser.queue_type = job->queue_type;
226226 parser.is_kernel_allocated_cb = job->is_kernel_allocated_cb;
227227 job->patched_cb = NULL;
228+ parser.completion = true;
228229
229230 rc = hdev->asic_funcs->cs_parser(hdev, &parser);
230231
drivers/misc/habanalabs/common/habanalabs.h+2−0
@@ -1223,6 +1223,7 @@ struct hl_cs_job { · 1222 unmodified lines
12231223 * MSG_PROT packets. Relevant only for GAUDI as GOYA doesn't
12241224 * have streams so the engine can't be busy by another
12251225 * stream.
1226+ * @completion: true if we need completion for this CS.
12261227 */
12271228 struct hl_cs_parser {
12281229 struct hl_cb *user_cb;
@@ -1237,6 +1238,7 @@ struct hl_cs_parser { · 8 unmodified lines
12371238 u8 job_id;
12381239 u8 is_kernel_allocated_cb;
12391240 u8 contains_dma_pkt;
1241+ u8 completion;
12401242 };
12411243
12421244 /*
drivers/misc/habanalabs/gaudi/gaudi.c+7−3
@@ -5060,7 +5060,8 @@ static int gaudi_validate_cb(struct hl_device *hdev, · 5059 unmodified lines
50605060 * 1. A packet that will act as a completion packet
50615061 * 2. A packet that will generate MSI-X interrupt
50625062 */
5063− parser->patched_cb_size += sizeof(struct packet_msg_prot) * 2;
5063+ if (parser->completion)
5064+ parser->patched_cb_size += sizeof(struct packet_msg_prot) * 2;
50645065
50655066 return rc;
50665067 }
@@ -5287,8 +5288,11 @@ static int gaudi_parse_cb_mmu(struct hl_device *hdev, · 220 unmodified lines
52875288 * 1. A packet that will act as a completion packet
52885289 * 2. A packet that will generate MSI interrupt
52895290 */
5290− parser->patched_cb_size = parser->user_cb_size +
5291− sizeof(struct packet_msg_prot) * 2;
5291+ if (parser->completion)
5292+ parser->patched_cb_size = parser->user_cb_size +
5293+ sizeof(struct packet_msg_prot) * 2;
5294+ else
5295+ parser->patched_cb_size = parser->user_cb_size;
52925296
52935297 rc = hl_cb_create(hdev, &hdev->kernel_cb_mgr, hdev->kernel_ctx,
52945298 parser->patched_cb_size, false, false,