diff mbox series

[1/3] classes/qemu: use tune to select QEMU_EXTRAOPTIONS, not package architecture

Message ID 20250110130116.894607-1-ross.burton@arm.com
State Accepted, archived
Commit 5e14a1b26cc77b35c3e36869021afae9455bb1a8
Headers show
Series [1/3] classes/qemu: use tune to select QEMU_EXTRAOPTIONS, not package architecture | expand

Commit Message

Ross Burton Jan. 10, 2025, 1:01 p.m. UTC
Using the package architecture to select the right qemu options to pass
to qemu-user is incorrect, and fails for recipes that set PACKAGE_ARCH
to MACHINE_ARCH (as the qemuppc workarounds suggest) because there are
not typically any options set for the machine name.

Solve this by using TUNE_PKGARCH instead: for the majority of recipes
this is the same value, but for machine-specific recipes it remains the
same instead of changing to the machine name.

This means we can remove the qemuppc workarounds, as they're obsolete.

Also update the gcc-testsuite recipe which uses the same pattern to use
TUNE_PKGARCH, and generalise the else codepath to avoid needing to
update the list of architectures.

[ YOCTO #15647 ]

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes-recipe/qemu.bbclass            | 8 ++------
 meta/recipes-devtools/gcc/gcc-testsuite.inc | 4 ++--
 2 files changed, 4 insertions(+), 8 deletions(-)

Comments

Ross Burton Jan. 10, 2025, 5:36 p.m. UTC | #1
This series breaks under nativesdk, please ignore for now.

Ross

> On 10 Jan 2025, at 13:01, Ross Burton via lists.openembedded.org <ross.burton=arm.com@lists.openembedded.org> wrote:
> 
> Using the package architecture to select the right qemu options to pass
> to qemu-user is incorrect, and fails for recipes that set PACKAGE_ARCH
> to MACHINE_ARCH (as the qemuppc workarounds suggest) because there are
> not typically any options set for the machine name.
> 
> Solve this by using TUNE_PKGARCH instead: for the majority of recipes
> this is the same value, but for machine-specific recipes it remains the
> same instead of changing to the machine name.
> 
> This means we can remove the qemuppc workarounds, as they're obsolete.
> 
> Also update the gcc-testsuite recipe which uses the same pattern to use
> TUNE_PKGARCH, and generalise the else codepath to avoid needing to
> update the list of architectures.
> 
> [ YOCTO #15647 ]
> 
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
> meta/classes-recipe/qemu.bbclass            | 8 ++------
> meta/recipes-devtools/gcc/gcc-testsuite.inc | 4 ++--
> 2 files changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/meta/classes-recipe/qemu.bbclass b/meta/classes-recipe/qemu.bbclass
> index dbb5ee0b666..8d7c82668b4 100644
> --- a/meta/classes-recipe/qemu.bbclass
> +++ b/meta/classes-recipe/qemu.bbclass
> @@ -60,8 +60,8 @@ def qemu_run_binary(data, rootfs_path, binary):
> # this dance). For others (e.g. arm) a -cpu option is not necessary, since the
> # qemu-arm default CPU supports all required architecture levels.
> 
> -QEMU_OPTIONS = "-r ${OLDEST_KERNEL} ${@d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('PACKAGE_ARCH')) or ""}"
> -QEMU_OPTIONS[vardeps] += "QEMU_EXTRAOPTIONS_${PACKAGE_ARCH}"
> +QEMU_OPTIONS = "-r ${OLDEST_KERNEL} ${@d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('TUNE_PKGARCH')) or ""}"
> +QEMU_OPTIONS[vardeps] += "QEMU_EXTRAOPTIONS_${TUNE_PKGARCH}"
> 
> QEMU_EXTRAOPTIONS_ppce500v2 = " -cpu e500v2"
> QEMU_EXTRAOPTIONS_ppce500mc = " -cpu e500mc"
> @@ -71,7 +71,3 @@ QEMU_EXTRAOPTIONS_ppce6500 = " -cpu e500mc"
> QEMU_EXTRAOPTIONS_ppc64e6500 = " -cpu e500mc"
> QEMU_EXTRAOPTIONS_ppc7400 = " -cpu 7400"
> QEMU_EXTRAOPTIONS_powerpc64le = " -cpu POWER9"
> -# Some packages e.g. fwupd sets PACKAGE_ARCH = MACHINE_ARCH and uses meson which
> -# needs right options to usermode qemu
> -QEMU_EXTRAOPTIONS_qemuppc = " -cpu 7400"
> -QEMU_EXTRAOPTIONS_qemuppc64 = " -cpu POWER9"
> diff --git a/meta/recipes-devtools/gcc/gcc-testsuite.inc b/meta/recipes-devtools/gcc/gcc-testsuite.inc
> index 0a950b6c9e6..af6c7ad5a98 100644
> --- a/meta/recipes-devtools/gcc/gcc-testsuite.inc
> +++ b/meta/recipes-devtools/gcc/gcc-testsuite.inc
> @@ -53,8 +53,8 @@ python check_prepare() {
>         #   - valid for x86*, powerpc, arm, arm64
>         if qemu_binary.endswith(("x86_64", "i386", "arm", "aarch64")):
>             args += ["-cpu", "max"]
> -        elif qemu_binary.endswith(("ppc", "mips", "mips64")):
> -            extra = d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('PACKAGE_ARCH'))
> +        else:
> +            extra = d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('TUNE_PKGARCH'))
>             if extra:
>                 args += extra.split()
>         # For mips64 we could set a maximal CPU (e.g. Loongson-3A4000) however they either have MSA
> -- 
> 2.43.0
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#209647): https://lists.openembedded.org/g/openembedded-core/message/209647
> Mute This Topic: https://lists.openembedded.org/mt/110533939/6875888
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ross.burton@arm.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Martin Jansa Jan. 10, 2025, 5:52 p.m. UTC | #2
Too late to easily ignore as it seems already in master, e.g.:
https://git.openembedded.org/openembedded-core/commit/?id=5e14a1b26cc77b35c3e36869021afae9455bb1a8
or do you mean some other changes?

On Fri, Jan 10, 2025 at 6:36 PM Ross Burton via lists.openembedded.org
<ross.burton=arm.com@lists.openembedded.org> wrote:
>
> This series breaks under nativesdk, please ignore for now.
>
> Ross
>
> > On 10 Jan 2025, at 13:01, Ross Burton via lists.openembedded.org <ross.burton=arm.com@lists.openembedded.org> wrote:
> >
> > Using the package architecture to select the right qemu options to pass
> > to qemu-user is incorrect, and fails for recipes that set PACKAGE_ARCH
> > to MACHINE_ARCH (as the qemuppc workarounds suggest) because there are
> > not typically any options set for the machine name.
> >
> > Solve this by using TUNE_PKGARCH instead: for the majority of recipes
> > this is the same value, but for machine-specific recipes it remains the
> > same instead of changing to the machine name.
> >
> > This means we can remove the qemuppc workarounds, as they're obsolete.
> >
> > Also update the gcc-testsuite recipe which uses the same pattern to use
> > TUNE_PKGARCH, and generalise the else codepath to avoid needing to
> > update the list of architectures.
> >
> > [ YOCTO #15647 ]
> >
> > Signed-off-by: Ross Burton <ross.burton@arm.com>
> > ---
> > meta/classes-recipe/qemu.bbclass            | 8 ++------
> > meta/recipes-devtools/gcc/gcc-testsuite.inc | 4 ++--
> > 2 files changed, 4 insertions(+), 8 deletions(-)
> >
> > diff --git a/meta/classes-recipe/qemu.bbclass b/meta/classes-recipe/qemu.bbclass
> > index dbb5ee0b666..8d7c82668b4 100644
> > --- a/meta/classes-recipe/qemu.bbclass
> > +++ b/meta/classes-recipe/qemu.bbclass
> > @@ -60,8 +60,8 @@ def qemu_run_binary(data, rootfs_path, binary):
> > # this dance). For others (e.g. arm) a -cpu option is not necessary, since the
> > # qemu-arm default CPU supports all required architecture levels.
> >
> > -QEMU_OPTIONS = "-r ${OLDEST_KERNEL} ${@d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('PACKAGE_ARCH')) or ""}"
> > -QEMU_OPTIONS[vardeps] += "QEMU_EXTRAOPTIONS_${PACKAGE_ARCH}"
> > +QEMU_OPTIONS = "-r ${OLDEST_KERNEL} ${@d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('TUNE_PKGARCH')) or ""}"
> > +QEMU_OPTIONS[vardeps] += "QEMU_EXTRAOPTIONS_${TUNE_PKGARCH}"
> >
> > QEMU_EXTRAOPTIONS_ppce500v2 = " -cpu e500v2"
> > QEMU_EXTRAOPTIONS_ppce500mc = " -cpu e500mc"
> > @@ -71,7 +71,3 @@ QEMU_EXTRAOPTIONS_ppce6500 = " -cpu e500mc"
> > QEMU_EXTRAOPTIONS_ppc64e6500 = " -cpu e500mc"
> > QEMU_EXTRAOPTIONS_ppc7400 = " -cpu 7400"
> > QEMU_EXTRAOPTIONS_powerpc64le = " -cpu POWER9"
> > -# Some packages e.g. fwupd sets PACKAGE_ARCH = MACHINE_ARCH and uses meson which
> > -# needs right options to usermode qemu
> > -QEMU_EXTRAOPTIONS_qemuppc = " -cpu 7400"
> > -QEMU_EXTRAOPTIONS_qemuppc64 = " -cpu POWER9"
> > diff --git a/meta/recipes-devtools/gcc/gcc-testsuite.inc b/meta/recipes-devtools/gcc/gcc-testsuite.inc
> > index 0a950b6c9e6..af6c7ad5a98 100644
> > --- a/meta/recipes-devtools/gcc/gcc-testsuite.inc
> > +++ b/meta/recipes-devtools/gcc/gcc-testsuite.inc
> > @@ -53,8 +53,8 @@ python check_prepare() {
> >         #   - valid for x86*, powerpc, arm, arm64
> >         if qemu_binary.endswith(("x86_64", "i386", "arm", "aarch64")):
> >             args += ["-cpu", "max"]
> > -        elif qemu_binary.endswith(("ppc", "mips", "mips64")):
> > -            extra = d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('PACKAGE_ARCH'))
> > +        else:
> > +            extra = d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('TUNE_PKGARCH'))
> >             if extra:
> >                 args += extra.split()
> >         # For mips64 we could set a maximal CPU (e.g. Loongson-3A4000) however they either have MSA
> > --
> > 2.43.0
> >
> >
> >
> >
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#209658): https://lists.openembedded.org/g/openembedded-core/message/209658
> Mute This Topic: https://lists.openembedded.org/mt/110533939/3617156
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [martin.jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Ross Burton Jan. 10, 2025, 6:10 p.m. UTC | #3
On 10 Jan 2025, at 17:52, Martin Jansa <martin.jansa@gmail.com> wrote:
> 
> Too late to easily ignore as it seems already in master, e.g.:
> https://git.openembedded.org/openembedded-core/commit/?id=5e14a1b26cc77b35c3e36869021afae9455bb1a8
> or do you mean some other changes?

Eek.

They’re not in poky/master so I wonder if RP has failed to sync poky, or the push to oe was accidental.

I did just send a v2 which appears to behave in my testing so if that passes the AB then we can fix fairly quickly.

Ross
Martin Jansa Jan. 10, 2025, 8:11 p.m. UTC | #4
Yes, probably by accident, now top 8 commits are gone from oe-core.

From git://git.openembedded.org/openembedded-core
 + 4e29551b15...599e0fbf7d master      -> git.oe.org/master  (forced update)

On Fri, Jan 10, 2025 at 7:10 PM Ross Burton <Ross.Burton@arm.com> wrote:
>
> On 10 Jan 2025, at 17:52, Martin Jansa <martin.jansa@gmail.com> wrote:
> >
> > Too late to easily ignore as it seems already in master, e.g.:
> > https://git.openembedded.org/openembedded-core/commit/?id=5e14a1b26cc77b35c3e36869021afae9455bb1a8
> > or do you mean some other changes?
>
> Eek.
>
> They’re not in poky/master so I wonder if RP has failed to sync poky, or the push to oe was accidental.
>
> I did just send a v2 which appears to behave in my testing so if that passes the AB then we can fix fairly quickly.
>
> Ross
Richard Purdie Jan. 11, 2025, 6:46 p.m. UTC | #5
On Fri, 2025-01-10 at 18:52 +0100, Martin Jansa via
lists.openembedded.org wrote:
> Too late to easily ignore as it seems already in master, e.g.:
> https://git.openembedded.org/openembedded-core/commit/?id=5e14a1b26cc77b35c3e36869021afae9455bb1a8
> or do you mean some other changes?

Sorry, I backed that out as it wasn't intended and there were issues
and untested changes in there too.

This series has merged now as an additional fix was added in.

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/classes-recipe/qemu.bbclass b/meta/classes-recipe/qemu.bbclass
index dbb5ee0b666..8d7c82668b4 100644
--- a/meta/classes-recipe/qemu.bbclass
+++ b/meta/classes-recipe/qemu.bbclass
@@ -60,8 +60,8 @@  def qemu_run_binary(data, rootfs_path, binary):
 # this dance). For others (e.g. arm) a -cpu option is not necessary, since the
 # qemu-arm default CPU supports all required architecture levels.
 
-QEMU_OPTIONS = "-r ${OLDEST_KERNEL} ${@d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('PACKAGE_ARCH')) or ""}"
-QEMU_OPTIONS[vardeps] += "QEMU_EXTRAOPTIONS_${PACKAGE_ARCH}"
+QEMU_OPTIONS = "-r ${OLDEST_KERNEL} ${@d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('TUNE_PKGARCH')) or ""}"
+QEMU_OPTIONS[vardeps] += "QEMU_EXTRAOPTIONS_${TUNE_PKGARCH}"
 
 QEMU_EXTRAOPTIONS_ppce500v2 = " -cpu e500v2"
 QEMU_EXTRAOPTIONS_ppce500mc = " -cpu e500mc"
@@ -71,7 +71,3 @@  QEMU_EXTRAOPTIONS_ppce6500 = " -cpu e500mc"
 QEMU_EXTRAOPTIONS_ppc64e6500 = " -cpu e500mc"
 QEMU_EXTRAOPTIONS_ppc7400 = " -cpu 7400"
 QEMU_EXTRAOPTIONS_powerpc64le = " -cpu POWER9"
-# Some packages e.g. fwupd sets PACKAGE_ARCH = MACHINE_ARCH and uses meson which
-# needs right options to usermode qemu
-QEMU_EXTRAOPTIONS_qemuppc = " -cpu 7400"
-QEMU_EXTRAOPTIONS_qemuppc64 = " -cpu POWER9"
diff --git a/meta/recipes-devtools/gcc/gcc-testsuite.inc b/meta/recipes-devtools/gcc/gcc-testsuite.inc
index 0a950b6c9e6..af6c7ad5a98 100644
--- a/meta/recipes-devtools/gcc/gcc-testsuite.inc
+++ b/meta/recipes-devtools/gcc/gcc-testsuite.inc
@@ -53,8 +53,8 @@  python check_prepare() {
         #   - valid for x86*, powerpc, arm, arm64
         if qemu_binary.endswith(("x86_64", "i386", "arm", "aarch64")):
             args += ["-cpu", "max"]
-        elif qemu_binary.endswith(("ppc", "mips", "mips64")):
-            extra = d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('PACKAGE_ARCH'))
+        else:
+            extra = d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('TUNE_PKGARCH'))
             if extra:
                 args += extra.split()
         # For mips64 we could set a maximal CPU (e.g. Loongson-3A4000) however they either have MSA