mirror of
				https://xff.cz/git/u-boot/
				synced 2025-10-31 10:26:10 +01:00 
			
		
		
		
	arm: apple: Increase RTKit timeouts
Timeouts are not expected to happen and are handled as fatal errors. Increase all timeouts to 1 second as defensive measure to avoid relying on the timing behaviour of certain firmware versions or configurations. Signed-off-by: Janne Grunau <j@jannau.net> Reviewed-by: Mark Kettenis <kettenis@openbsd.org> Tested-by: Mark Kettenis <kettenis@openbsd.org>
This commit is contained in:
		| @@ -52,6 +52,8 @@ | |||||||
| #define APPLE_RTKIT_BUFFER_REQUEST_SIZE GENMASK(51, 44) | #define APPLE_RTKIT_BUFFER_REQUEST_SIZE GENMASK(51, 44) | ||||||
| #define APPLE_RTKIT_BUFFER_REQUEST_IOVA GENMASK(41, 0) | #define APPLE_RTKIT_BUFFER_REQUEST_IOVA GENMASK(41, 0) | ||||||
|  |  | ||||||
|  | #define TIMEOUT_1SEC_US 1000000 | ||||||
|  |  | ||||||
| struct apple_rtkit { | struct apple_rtkit { | ||||||
| 	struct mbox_chan *chan; | 	struct mbox_chan *chan; | ||||||
| 	void *cookie; | 	void *cookie; | ||||||
| @@ -168,7 +170,7 @@ int apple_rtkit_boot(struct apple_rtkit *rtk) | |||||||
| 		return ret; | 		return ret; | ||||||
|  |  | ||||||
| 	/* Wait for protocol version negotiation message. */ | 	/* Wait for protocol version negotiation message. */ | ||||||
| 	ret = mbox_recv(rtk->chan, &msg, 10000); | 	ret = mbox_recv(rtk->chan, &msg, TIMEOUT_1SEC_US); | ||||||
| 	if (ret < 0) | 	if (ret < 0) | ||||||
| 		return ret; | 		return ret; | ||||||
|  |  | ||||||
| @@ -210,7 +212,7 @@ int apple_rtkit_boot(struct apple_rtkit *rtk) | |||||||
|  |  | ||||||
| wait_epmap: | wait_epmap: | ||||||
| 	/* Wait for endpoint map message. */ | 	/* Wait for endpoint map message. */ | ||||||
| 	ret = mbox_recv(rtk->chan, &msg, 10000); | 	ret = mbox_recv(rtk->chan, &msg, TIMEOUT_1SEC_US); | ||||||
| 	if (ret < 0) | 	if (ret < 0) | ||||||
| 		return ret; | 		return ret; | ||||||
|  |  | ||||||
| @@ -275,7 +277,7 @@ wait_epmap: | |||||||
|  |  | ||||||
| 	pwrstate = APPLE_RTKIT_PWR_STATE_SLEEP; | 	pwrstate = APPLE_RTKIT_PWR_STATE_SLEEP; | ||||||
| 	while (pwrstate != APPLE_RTKIT_PWR_STATE_ON) { | 	while (pwrstate != APPLE_RTKIT_PWR_STATE_ON) { | ||||||
| 		ret = mbox_recv(rtk->chan, &msg, 100000); | 		ret = mbox_recv(rtk->chan, &msg, TIMEOUT_1SEC_US); | ||||||
| 		if (ret < 0) | 		if (ret < 0) | ||||||
| 			return ret; | 			return ret; | ||||||
|  |  | ||||||
| @@ -330,7 +332,7 @@ int apple_rtkit_shutdown(struct apple_rtkit *rtk, int pwrstate) | |||||||
| 	if (ret < 0) | 	if (ret < 0) | ||||||
| 		return ret; | 		return ret; | ||||||
|  |  | ||||||
| 	ret = mbox_recv(rtk->chan, &msg, 100000); | 	ret = mbox_recv(rtk->chan, &msg, TIMEOUT_1SEC_US); | ||||||
| 	if (ret < 0) | 	if (ret < 0) | ||||||
| 		return ret; | 		return ret; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user