mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oded Gabbay <ogabbay@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Dani Liberman <dliberman@habana.ai>
Subject: [PATCH 10/20] habanalabs/gaudi2: add page fault notify event
Date: Thu, 17 Nov 2022 18:19:41 +0200	[thread overview]
Message-ID: <20221117161951.845454-10-ogabbay@kernel.org> (raw)
In-Reply-To: <20221117161951.845454-1-ogabbay@kernel.org>

From: Dani Liberman <dliberman@habana.ai>

Each time page fault happens, besides capturing its data, also notify
the user about it.

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
 drivers/misc/habanalabs/gaudi2/gaudi2.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/misc/habanalabs/gaudi2/gaudi2.c b/drivers/misc/habanalabs/gaudi2/gaudi2.c
index 61960fa059e0..65c9b535aa69 100644
--- a/drivers/misc/habanalabs/gaudi2/gaudi2.c
+++ b/drivers/misc/habanalabs/gaudi2/gaudi2.c
@@ -8253,7 +8253,8 @@ static void gaudi2_handle_hif_fatal(struct hl_device *hdev, u16 event_type, u64
 	}
 }
 
-static void gaudi2_handle_page_error(struct hl_device *hdev, u64 mmu_base, bool is_pmmu)
+static void gaudi2_handle_page_error(struct hl_device *hdev, u64 mmu_base, bool is_pmmu,
+					u64 *event_mask)
 {
 	u32 valid, val;
 	u64 addr;
@@ -8270,7 +8271,7 @@ static void gaudi2_handle_page_error(struct hl_device *hdev, u64 mmu_base, bool
 
 	dev_err_ratelimited(hdev->dev, "%s page fault on va 0x%llx\n",
 				is_pmmu ? "PMMU" : "HMMU", addr);
-	hl_capture_page_fault(hdev, addr, 0, is_pmmu);
+	hl_handle_page_fault(hdev, addr, 0, is_pmmu, event_mask);
 
 	WREG32(mmu_base + MMU_OFFSET(mmDCORE0_HMMU0_MMU_PAGE_ERROR_CAPTURE), 0);
 }
@@ -8296,7 +8297,7 @@ static void gaudi2_handle_access_error(struct hl_device *hdev, u64 mmu_base, boo
 }
 
 static void gaudi2_handle_mmu_spi_sei_generic(struct hl_device *hdev, const char *mmu_name,
-						u64 mmu_base, bool is_pmmu)
+						u64 mmu_base, bool is_pmmu, u64 *event_mask)
 {
 	u32 spi_sei_cause, interrupt_clr = 0x0;
 	int i;
@@ -8309,7 +8310,7 @@ static void gaudi2_handle_mmu_spi_sei_generic(struct hl_device *hdev, const char
 						mmu_name, gaudi2_mmu_spi_sei[i].cause);
 
 			if (i == 0)
-				gaudi2_handle_page_error(hdev, mmu_base, is_pmmu);
+				gaudi2_handle_page_error(hdev, mmu_base, is_pmmu, event_mask);
 			else if (i == 1)
 				gaudi2_handle_access_error(hdev, mmu_base, is_pmmu);
 
@@ -8381,7 +8382,7 @@ static bool gaudi2_handle_sm_err(struct hl_device *hdev, u8 sm_index)
 	return reset;
 }
 
-static void gaudi2_handle_mmu_spi_sei_err(struct hl_device *hdev, u16 event_type)
+static void gaudi2_handle_mmu_spi_sei_err(struct hl_device *hdev, u16 event_type, u64 *event_mask)
 {
 	bool is_pmmu = false;
 	char desc[32];
@@ -8439,7 +8440,7 @@ static void gaudi2_handle_mmu_spi_sei_err(struct hl_device *hdev, u16 event_type
 		return;
 	}
 
-	gaudi2_handle_mmu_spi_sei_generic(hdev, desc, mmu_base, is_pmmu);
+	gaudi2_handle_mmu_spi_sei_generic(hdev, desc, mmu_base, is_pmmu, event_mask);
 }
 
 
@@ -8969,7 +8970,7 @@ static void gaudi2_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_ent
 	case GAUDI2_EVENT_HMMU_0_AXI_ERR_RSP ... GAUDI2_EVENT_HMMU_12_AXI_ERR_RSP:
 	case GAUDI2_EVENT_PMMU0_PAGE_FAULT_WR_PERM ... GAUDI2_EVENT_PMMU0_SECURITY_ERROR:
 	case GAUDI2_EVENT_PMMU_AXI_ERR_RSP_0:
-		gaudi2_handle_mmu_spi_sei_err(hdev, event_type);
+		gaudi2_handle_mmu_spi_sei_err(hdev, event_type, &event_mask);
 		reset_flags |= HL_DRV_RESET_FW_FATAL_ERR;
 		event_mask |= HL_NOTIFIER_EVENT_USER_ENGINE_ERR;
 		break;
@@ -10206,7 +10207,7 @@ static void gaudi2_ack_mmu_error(struct hl_device *hdev, u64 mmu_id)
 	if (gaudi2_get_mmu_base(hdev, mmu_id, &mmu_base))
 		return;
 
-	gaudi2_handle_page_error(hdev, mmu_base, is_pmmu);
+	gaudi2_handle_page_error(hdev, mmu_base, is_pmmu, NULL);
 	gaudi2_handle_access_error(hdev, mmu_base, is_pmmu);
 }
 
-- 
2.25.1


  parent reply	other threads:[~2022-11-17 16:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17 16:19 [PATCH 01/20] habanalabs/gaudi2: add PCI revision 2 support Oded Gabbay
2022-11-17 16:19 ` [PATCH 02/20] habanalabs/gaudi: add razwi notify event Oded Gabbay
2022-11-17 16:19 ` [PATCH 03/20] habanalabs: use single threaded WQ for event handling Oded Gabbay
2022-11-17 16:19 ` [PATCH 04/20] habanalabs/gaudi: add page fault notify event Oded Gabbay
2022-11-17 16:19 ` [PATCH 05/20] habanalabs/gaudi2: implement fp32 not supported event Oded Gabbay
2022-11-17 16:19 ` [PATCH 06/20] habanalabs/gaudi2: add razwi notify event Oded Gabbay
2022-11-17 16:19 ` [PATCH 07/20] habanalabs: fix firmware descriptor copy operation Oded Gabbay
2022-11-17 16:19 ` [PATCH 08/20] habanalabs: skip events info ioctl if not supported Oded Gabbay
2022-11-17 16:19 ` [PATCH 09/20] habanalabs/gaudi2: classify power/thermal events as info Oded Gabbay
2022-11-17 16:19 ` Oded Gabbay [this message]
2022-11-17 16:19 ` [PATCH 11/20] habanalabs: fix print for out-of-sync and pkt-failure events Oded Gabbay
2022-11-17 16:19 ` [PATCH 12/20] habanalabs/gaudi: fix print for firmware-alive event Oded Gabbay
2022-11-17 16:19 ` [PATCH 13/20] habanalabs/gaudi2: remove redundant firmware version check Oded Gabbay
2022-11-17 16:19 ` [PATCH 14/20] habanalabs/gaudi2: don't enable entries in the MSIX_GW table Oded Gabbay
2022-11-17 16:19 ` [PATCH 15/20] habanalabs/gaudi2: return to reset upon SM SEI BRESP error Oded Gabbay
2022-11-17 16:19 ` [PATCH 16/20] habanalabs: reset device if still in use when released Oded Gabbay
2022-11-17 16:19 ` [PATCH 17/20] habanalabs: check schedule_hard_reset correctly Oded Gabbay
2022-11-17 16:19 ` [PATCH 18/20] habanalabs: extend process wait timeout in device fine Oded Gabbay
2022-11-17 16:19 ` [PATCH 19/20] habanalabs/gaudi2: change memory scrub mechanism Oded Gabbay
2022-11-17 16:19 ` [PATCH 20/20] habanalabs: increase the size of busy engines mask Oded Gabbay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221117161951.845454-10-ogabbay@kernel.org \
    --to=ogabbay@kernel.org \
    --cc=dliberman@habana.ai \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®