diff mbox series

[10/14] bsd-user: Hard wire aarch64 to be 4k pages only

Message ID 20240722214313.89503-11-imp@bsdimp.com (mailing list archive)
State New, archived
Headers show
Series bsd-user: Misc changes for 9.1 (I hope) | expand

Commit Message

Warner Losh July 22, 2024, 9:43 p.m. UTC
Only support 4k pages for aarch64 binaries. The variable page size stuff
isn't working just yet, so put in this lessor-of-evils kludge until that
is complete.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 target/arm/cpu-param.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Richard Henderson July 23, 2024, 1:10 a.m. UTC | #1
On 7/23/24 07:43, Warner Losh wrote:
> Only support 4k pages for aarch64 binaries. The variable page size stuff
> isn't working just yet, so put in this lessor-of-evils kludge until that
> is complete.

Hmm.  In what way is it not working?

What if we limit this to bsd-user/main.c instead?

   set_preferred_target_page_bits(TARGET_PAGE_BITS_MIN);


r~
Warner Losh July 23, 2024, 5:01 a.m. UTC | #2
On Mon, Jul 22, 2024 at 7:10 PM Richard Henderson <
richard.henderson@linaro.org> wrote:

> On 7/23/24 07:43, Warner Losh wrote:
> > Only support 4k pages for aarch64 binaries. The variable page size stuff
> > isn't working just yet, so put in this lessor-of-evils kludge until that
> > is complete.
>
> Hmm.  In what way is it not working?
>
> What if we limit this to bsd-user/main.c instead?
>
>    set_preferred_target_page_bits(TARGET_PAGE_BITS_MIN);
>

It's a compile issue that this won't solve:
In file included from ../bsd-user/aarch64/signal.c:21:
../bsd-user/qemu.h:146:20: warning: variable length array used [-Wvla]
  146 |         void *page[MAX_ARG_PAGES];
      |                    ^~~~~~~~~~~~~
../bsd-user/qemu.h:138:23: note: expanded from macro 'MAX_ARG_PAGES'
  138 | #define MAX_ARG_PAGES (TARGET_ARG_MAX / TARGET_PAGE_SIZE)
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../bsd-user/qemu.h:146:20: note: initializer of 'target_page' is unknown
../bsd-user/qemu.h:138:41: note: expanded from macro 'MAX_ARG_PAGES'
  138 | #define MAX_ARG_PAGES (TARGET_ARG_MAX / TARGET_PAGE_SIZE)
      |                                         ^
/dune/imp/git/qemu/include/exec/cpu-all.h:152:37: note: expanded from macro
'TARGET_PAGE_SIZE'
  152 | # define TARGET_PAGE_SIZE    (-(int)TARGET_PAGE_MASK)
      |                                     ^
/dune/imp/git/qemu/include/exec/cpu-all.h:150:44: note: expanded from macro
'TARGET_PAGE_MASK'
  150 | #  define TARGET_PAGE_MASK   ((target_long)target_page.mask)
      |                                            ^
/dune/imp/git/qemu/include/exec/cpu-all.h:142:29: note: declared here
  142 | extern const TargetPageBits target_page;
      |                             ^
In file included from ../bsd-user/aarch64/signal.c:21:
../bsd-user/qemu.h:146:15: error: fields must have a constant size:
'variable length array in structure' extension will never be supported
  146 |         void *page[MAX_ARG_PAGES];
      |               ^
1 warning and 1 error generated.
ninja: build stopped: subcommand failed.
gmake: *** [Makefile:167: run-ninja] Error 1

that have a couple of additional levels after those issues are fixed...
It's fixable, but will take a fair amount more time that I have before the
deadline...

Warner
Richard Henderson July 23, 2024, 5:38 a.m. UTC | #3
On 7/23/24 15:01, Warner Losh wrote:
> It's a compile issue that this won't solve:
...
> It's fixable, but 
> will take a fair amount more time that I have before the deadline...

Ok, fair.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
diff mbox series

Patch

diff --git a/target/arm/cpu-param.h b/target/arm/cpu-param.h
index 2d5f3aa312c..fa6cae0e3aa 100644
--- a/target/arm/cpu-param.h
+++ b/target/arm/cpu-param.h
@@ -21,9 +21,13 @@ 
 #ifdef CONFIG_USER_ONLY
 # ifdef TARGET_AARCH64
 #  define TARGET_TAGGED_ADDRESSES
+# ifdef __FreeBSD__
+#  define TARGET_PAGE_BITS 12
+# else
 /* Allow user-only to vary page size from 4k */
 #  define TARGET_PAGE_BITS_VARY
 #  define TARGET_PAGE_BITS_MIN  12
+# endif
 # else
 #  define TARGET_PAGE_BITS 12
 # endif