From: Alexandru Elisei <alexandru.elisei@arm.com>
To: Andrew Jones <andrew.jones@linux.dev>
Cc: eric.auger@redhat.com, lvivier@redhat.com, thuth@redhat.com,
frankja@linux.ibm.com, imbrenda@linux.ibm.com, nrb@linux.ibm.com,
david@redhat.com, pbonzini@redhat.com, kvmarm@lists.linux.dev,
linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org,
linux-s390@vger.kernel.org, vladimir.murzin@arm.com
Subject: Re: [kvm-unit-tests PATCH v1 4/5] arm/arm64: Add support for --processor=max
Date: Tue, 14 Jan 2025 17:20:13 +0000 [thread overview]
Message-ID: <Z4aczXTAVxxkuOhA@arm.com> (raw)
In-Reply-To: <20250113-8711bc93ade1e8c83dfe3582@orel>
Hi Drew,
On Mon, Jan 13, 2025 at 04:21:45PM +0100, Andrew Jones wrote:
> On Fri, Jan 10, 2025 at 01:58:47PM +0000, Alexandru Elisei wrote:
> > For arm64, newer architecture features are supported only on newer CPUs.
> > Instead of expecting the user to know which CPU model supports which
> > feature when using the TCG accelerator for qemu, let's make it easier and
> > add support for the --processor 'max' value.
> >
> > The --processor value is passed to the compiler's -mcpu argument and to
> > qemu's -cpu argument. 'max' is a special value that only qemu understands -
> > it means that all CPU features that qemu implements are supported by the
> > guest CPU, and passing it to the compiler causes a build error. So omit the
> > -mcpu argument when $PROCESSOR=max.
> >
> > This affects only the TCG accelerator; when using KVM or HVF,
> > kvm-unit-tests sets the cpu model to 'host'.
> >
> > Note that using --processor=max with a 32 bit compiler will cause a build
> > error: the CPU model that the compiler defaults to when the -mcpu argument
> > is missing lacks support for some of the instructions that kvm-unit-tests
> > uses. The solution in the case is to specify a CPU model for the compiler
> > using --cflags:
> >
> > ./configure --arch=arm --processor=max --cflags=-mcpu=<cpu>
> >
> > This patch doesn't introduce a regression for arm when --processor=max is
> > used, it's only the error that changes: from an unknown processor type to
> > using instructions that are not available on the processor.
> >
> > Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
> > ---
> > arm/Makefile.common | 2 ++
> > configure | 5 ++++-
> > 2 files changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/arm/Makefile.common b/arm/Makefile.common
> > index a5d97bcf477a..b757250dc9ae 100644
> > --- a/arm/Makefile.common
> > +++ b/arm/Makefile.common
> > @@ -25,7 +25,9 @@ AUXFLAGS ?= 0x0
> > # stack.o relies on frame pointers.
> > KEEP_FRAME_POINTER := y
> >
> > +ifneq ($(PROCESSOR),max)
> > CFLAGS += -mcpu=$(PROCESSOR)
> > +endif
> > CFLAGS += -std=gnu99
> > CFLAGS += -ffreestanding
> > CFLAGS += -O2
> > diff --git a/configure b/configure
> > index 138840c3f76d..46964d36a7d8 100755
> > --- a/configure
> > +++ b/configure
> > @@ -67,7 +67,10 @@ usage() {
> > Options include:
> > --arch=ARCH architecture to compile for ($arch). ARCH can be one of:
> > arm, arm64/aarch64, i386, ppc64, riscv32, riscv64, s390x, x86_64
> > - --processor=PROCESSOR processor to compile for ($default_processor)
> > + --processor=PROCESSOR processor to compile for ($default_processor). For arm and arm64, the
> > + value 'max' is special and it will be passed directly to
> > + qemu, bypassing the compiler. In this case, --cflags can be
> > + used to compile for a specific processor.
> > --target=TARGET target platform that the tests will be running on (qemu or
> > kvmtool, default is qemu) (arm/arm64 only)
> > --cross-prefix=PREFIX cross compiler prefix
> > --
> > 2.47.1
> >
>
> I don't think we want to overload processor this way. While mcpu and QEMU
> could both understand the same cpu names, then it was mostly fine
> (although it probably shouldn't have been overloaded before either). Now
> that we want one name for compiling and another for running, then I think
> we need another configure parameter, something like --qemu-cpu.
I agree, that's a better approach than overloading --processor. I'll try that
for the next iteration.
Thanks,
Alex
next prev parent reply other threads:[~2025-01-14 17:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 13:58 [kvm-unit-tests PATCH v1 0/5] arm64: Change the default --processor to max Alexandru Elisei
2025-01-10 13:58 ` [kvm-unit-tests PATCH v1 1/5] configure: Document that the architecture name 'aarch64' is also supported Alexandru Elisei
2025-01-13 15:01 ` Andrew Jones
2025-01-14 17:03 ` Alexandru Elisei
2025-01-14 18:39 ` Andrew Jones
2025-01-15 9:56 ` Alexandru Elisei
2025-01-10 13:58 ` [kvm-unit-tests PATCH v1 2/5] configure: Display the default processor for arm and arm64 Alexandru Elisei
2025-01-13 15:11 ` Andrew Jones
2025-01-14 17:17 ` Alexandru Elisei
2025-01-14 18:51 ` Andrew Jones
2025-01-15 9:55 ` Alexandru Elisei
2025-01-15 11:47 ` Andrew Jones
2025-01-10 13:58 ` [kvm-unit-tests PATCH v1 3/5] arm64: Implement the ./configure --processor option Alexandru Elisei
2025-01-13 15:13 ` Andrew Jones
2025-01-10 13:58 ` [kvm-unit-tests PATCH v1 4/5] arm/arm64: Add support for --processor=max Alexandru Elisei
2025-01-13 15:21 ` Andrew Jones
2025-01-14 17:20 ` Alexandru Elisei [this message]
2025-01-10 13:58 ` [kvm-unit-tests PATCH v1 5/5] configure: arm64: Make 'max' the default for --processor Alexandru Elisei
2025-01-13 15:29 ` Andrew Jones
2025-01-14 17:20 ` Alexandru Elisei
2025-01-13 10:17 ` [kvm-unit-tests PATCH v1 0/5] arm64: Change the default --processor to max Vladimir Murzin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z4aczXTAVxxkuOhA@arm.com \
--to=alexandru.elisei@arm.com \
--cc=andrew.jones@linux.dev \
--cc=david@redhat.com \
--cc=eric.auger@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-s390@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lvivier@redhat.com \
--cc=nrb@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=thuth@redhat.com \
--cc=vladimir.murzin@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).