diff --git a/meta/conf/machine/include/riscv/README b/meta/conf/machine/include/riscv/README
index ef7a484f25..c66925eb83 100644
--- a/meta/conf/machine/include/riscv/README
+++ b/meta/conf/machine/include/riscv/README
@@ -93,7 +93,8 @@ RISCVPKGARCH - This is the package arch actually used.  As with ARMPKGARCH
                on arm, each tune sets it as a literal in
                RISCVPKGARCH:tune-<name>, so that it only changes when
                deliberately changed.  Tunes that don't set it fall back to
-               TUNE_RISCV_PKGARCH.
+               TUNE_RISCV_PKGARCH, which is an error if that is longer
+               than 64 characters.
 
 The standard variables are defined as:
 
diff --git a/meta/conf/machine/include/riscv/arch-riscv.inc b/meta/conf/machine/include/riscv/arch-riscv.inc
index ff14f94deb..cde35ce56d 100644
--- a/meta/conf/machine/include/riscv/arch-riscv.inc
+++ b/meta/conf/machine/include/riscv/arch-riscv.inc
@@ -301,7 +301,13 @@ TUNE_ARCH = "${TUNE_RISCV_ARCH}"
 # Tunes that don't set it fall back to TUNE_RISCV_PKGARCH, which is built from
 # TUNE_FEATURES above, e.g.:
 #    riscv32imac
-RISCVPKGARCH = "${@d.getVar('RISCVPKGARCH:tune-${DEFAULTTUNE}') or d.getVar('TUNE_RISCV_PKGARCH')}"
+# However, TUNE_RISCV_PKGARCH grows with every extension the tune enables, so to
+# keep build and sstate paths manageable, RISCVPKGARCH:tune-<name> should be set
+# for a custom tune. For TUNE_RISCV_PKGARCH longer than 64 characters, throw an
+# error.
+RISCVPKGARCH = "${@d.getVar('RISCVPKGARCH:tune-${DEFAULTTUNE}') or \
+    ('${TUNE_RISCV_PKGARCH}' if len('${TUNE_RISCV_PKGARCH}') <= 64 else \
+     bb.fatal('The package arch for tune ${DEFAULTTUNE} would be ${TUNE_RISCV_PKGARCH}, which is longer than 64 characters. Set RISCVPKGARCH:tune-${DEFAULTTUNE} to a shorter name.'))}"
 TUNE_PKGARCH = "${RISCVPKGARCH}"
 
 # Misc settings
