summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-12-21 00:14:34 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-12-21 00:15:23 +0100
commit4d80a88b024ffbd8aa95b7cc8112f4b3a1b51bcb (patch)
tree13f1f8af60dceeb7c379c2f2f060f805a8e67032
parentaadb89752d077f101c3cb0cb69879fed3162908e (diff)
Work-around allocating with alignment larger than a page
* patches/vm_allocate_contiguous_align
-rw-r--r--debian/changelog2
-rw-r--r--debian/patches/series1
-rw-r--r--debian/patches/vm_allocate_contiguous_align32
3 files changed, 35 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index a84e6c90..67a98f2d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ rumpkernel (0~20211031+repack-4) UNRELEASED; urgency=medium
* source/lintian-overrides: Ignore spurious warning.
* Add po-debconf infrastructure.
* prune.sh: Avoid source-contains-prebuilt-ms-help-file warning.
+ * patches/vm_allocate_contiguous_align: Work-around allocating with
+ alignment larger than a page.
-- Samuel Thibault <sthibault@debian.org> Tue, 19 Sep 2023 18:29:43 +0200
diff --git a/debian/patches/series b/debian/patches/series
index b8fd8a7d..258d22ec 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -22,3 +22,4 @@ random
non-fhs-shell
clean_external
PAE
+vm_allocate_contiguous_align
diff --git a/debian/patches/vm_allocate_contiguous_align b/debian/patches/vm_allocate_contiguous_align
new file mode 100644
index 00000000..0525e491
--- /dev/null
+++ b/debian/patches/vm_allocate_contiguous_align
@@ -0,0 +1,32 @@
+---
+ pci-userspace/src-gnu/pci_user-gnu.c | 14 +++++++++++++-
+ 1 file changed, 13 insertions(+), 1 deletion(-)
+
+--- a/pci-userspace/src-gnu/pci_user-gnu.c
++++ b/pci-userspace/src-gnu/pci_user-gnu.c
+@@ -453,12 +453,24 @@ rumpcomp_pci_dmalloc(size_t size, size_t
+
+ pci_userspace_init();
+
++ if (align > PAGE_SIZE) {
++ // TODO: support larger alignment in kernel
++ fprintf(stderr,"warning: dmalloc(%ld) requested with %lx alignment, bumping up size\n", (long) size, (long) align);
++ fflush(stderr);
++ size += align;
++ }
++
+ if (vm_allocate_contiguous (master_host, mach_task_self(), &vma, &phys,
+- size, 0, 0x100000000, align)) {
++ size, 0, 0x100000000, PAGE_SIZE)) {
+ MACH_PRINT("vm_allocate_contiguous\n");
+ return 1;
+ }
+
++ if (align > PAGE_SIZE) {
++ vma = (vma + align-1) & ~(align-1);
++ phys = (phys + align-1) & ~(align-1);
++ }
++
+ *vap = (unsigned long)(vma);
+ *pap = (unsigned long long)(phys);
+