Skip to contentSkip to conversation

firmare: arm_sdei: Extras for v5.8

PATCH Applied James Morse 2 participants 5 messages May 19, 2020 – May 20, 2020 Software delegated exception interface (sdei)

lore
Share & tools
lore

James Morse

author maintainer
#0 lore raw

cover firmare: arm_sdei: Extras for v5.8

Hi Will, Catalin,

Some extra patches for SDEI if you're still willing to add to your tree.

Hanjun's patch to cleanup some ACPI table handling conflicts with Sudeep's patch that you already have queued.

Based on arm64's for-next/sdei branch: v5.7-rc3-1-gcaf2cd610dbb

For the tag, I'd describe all four patches as:
---
Cleanup the driver probing, remove some unused module exports and document the reason behind a set_fs() call.
---

Thanks,

James

Christoph Hellwig (1):
firmware: arm_sdei: remove unused interfaces

Hanjun Guo (1):
firmware: arm_sdei: Put the SDEI table after using it

James Morse (1):
firmware: arm_sdei: Document the motivation behind these set_fs()
calls

 drivers/firmware/arm_sdei.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
Signature · 7 lines
2.19.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#1 lore raw

PATCH 1/3 firmware: arm_sdei: Put the SDEI table after using it

From: Hanjun Guo <[email protected]>

The acpi_get_table() should be coupled with acpi_put_table() if the mapped table is not used for runtime after the initialization to release the table mapping, put the SDEI table after using it.

---
 drivers/firmware/arm_sdei.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/firmware/arm_sdei.c +2 -0
index 5afd7409e6fa..a33b701ab2b0 100644
@@ -1096,6 +1096,8 @@ static bool __init sdei_present_acpi(void)
 	if (ACPI_FAILURE(status))
 		return false;
 
+	acpi_put_table(sdei_table_header);
+
 	return true;
 }
 
Signature · 7 lines
2.19.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#2 lore raw

PATCH 2/3 firmware: arm_sdei: remove unused interfaces

In reply to James Morse

From: Christoph Hellwig <[email protected]>

The export symbols to register/unregister and enable/disable events aren't used upstream, remove them.

[ dropped the parts of Christoph's patch that made the API static too ]
---
 drivers/firmware/arm_sdei.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/firmware/arm_sdei.c +0 -4
index a33b701ab2b0..b12b99a19f66 100644
@@ -429,7 +429,6 @@ int sdei_event_enable(u32 event_num)
 
 	return err;
 }
-EXPORT_SYMBOL(sdei_event_enable);
 
 static int sdei_api_event_disable(u32 event_num)
 {
@@ -471,7 +470,6 @@ int sdei_event_disable(u32 event_num)
 
 	return err;
 }
-EXPORT_SYMBOL(sdei_event_disable);
 
 static int sdei_api_event_unregister(u32 event_num)
 {
@@ -533,7 +531,6 @@ int sdei_event_unregister(u32 event_num)
 
 	return err;
 }
-EXPORT_SYMBOL(sdei_event_unregister);
 
 /*
  * unregister events, but don't destroy them as they are re-registered by
@@ -643,7 +640,6 @@ int sdei_event_register(u32 event_num, sdei_event_callback *cb, void *arg)
 
 	return err;
 }
-EXPORT_SYMBOL(sdei_event_register);
 
 static int sdei_reregister_event_llocked(struct sdei_event *event)
 {
Signature · 7 lines
2.19.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#3 lore raw

PATCH 3/3 firmware: arm_sdei: Document the motivation behind these set_fs() calls

In reply to James Morse

The SDEI handler save/restores the addr_limit using set_fs(). It isn't very clear why. The reason is to mirror the arch code's entry assembly. The arch code does this because perf may access user-space, and inheriting the addr_limit may be a problem.

Add a comment explaining why this is here.

---
 drivers/firmware/arm_sdei.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/firmware/arm_sdei.c +8 -0
index b12b99a19f66..e7e36aab2386 100644
@@ -1128,6 +1128,14 @@ int sdei_event_handler(struct pt_regs *regs,
 	mm_segment_t orig_addr_limit;
 	u32 event_num = arg->event_num;
 
+	/*
+	 * Save restore 'fs'.
+	 * The architecture's entry code save/restores 'fs' when taking an
+	 * exception from the kernel. This ensures addr_limit isn't inherited
+	 * if you interrupted something that allowed the uaccess routines to
+	 * access kernel memory.
+	 * Do the same here because this doesn't come via the same entry code.
+	*/
 	orig_addr_limit = get_fs();
 	set_fs(USER_DS);
 
Signature · 7 lines
2.19.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Applied
#4 lore raw
In reply to James Morse
Quoted 8 lines · James Morse

Some extra patches for SDEI if you're still willing to add to your tree.

Hanjun's patch to cleanup some ACPI table handling conflicts with Sudeep's patch that you already have queued.

Based on arm64's for-next/sdei branch: v5.7-rc3-1-gcaf2cd610dbb

[...]

Applied to arm64 (for-next/sdei), thanks!

[1/3] firmware: arm_sdei: Put the SDEI table after using it

      https://git.kernel.org/arm64/c/70e6352aefb1
[2/3] firmware: arm_sdei: remove unused interfaces
      https://git.kernel.org/arm64/c/82b2077afccd
[3/3] firmware: arm_sdei: Document the motivation behind these set_fs() calls
      https://git.kernel.org/arm64/c/472de63b0b83

Cheers,

Signature · 10 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel