asahi: bind zero-page

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33682>
This commit is contained in:
Alyssa Rosenzweig
2025-01-28 11:09:22 -05:00
committed by Marge Bot
parent 3adbf53ed6
commit 04eb91c68b
2 changed files with 21 additions and 0 deletions
+6
View File
@@ -19,3 +19,9 @@
#define AGX_ABI_FOUT_S (6)
#define AGX_ABI_FOUT_WRITE_SAMPLES (7)
#define AGX_ABI_FOUT_COLOUR(rt) (2 * (4 + (4 * rt)))
/* This address is in our reservation, and can be
* addressed with only small integers in the low/high. That lets us do some
* robustness optimization even without soft fault.
*/
#define AGX_ZERO_PAGE_ADDRESS (1ull << 32)
+15
View File
@@ -11,6 +11,7 @@
#include "util/macros.h"
#include "util/ralloc.h"
#include "util/timespec.h"
#include "agx_abi.h"
#include "agx_bo.h"
#include "agx_compile.h"
#include "agx_device_virtio.h"
@@ -680,6 +681,20 @@ agx_open_device(void *memctx, struct agx_device *dev)
dev->chip = AGX_CHIP_G13G;
}
/* Bind read-only zero page at 2^32. This is in our reservation, and can be
* addressed with only small integers in the low/high. That lets us do some
* robustness optimization even without soft fault.
*/
{
void *bo = agx_bo_create(dev, 16384, 0, 0, "Zero page");
int ret = dev->ops.bo_bind(dev, bo, AGX_ZERO_PAGE_ADDRESS, 16384, 0,
ASAHI_BIND_READ, false);
if (ret) {
fprintf(stderr, "Failed to bind zero page");
return false;
}
}
void *bo = agx_bo_create(dev, LIBAGX_PRINTF_BUFFER_SIZE, 0, AGX_BO_WRITEBACK,
"Printf/abort");