From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Daniel Hoffman" <dhoff749@gmail.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Michael S. Tsirkin" <mst@redhat.com>,
Vasant.Hegde@amd.com,
"Richard Henderson" <richard.henderson@linaro.org>,
"Sairaj Kodilkar" <sarunkod@amd.com>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Santosh Shukla" <santosh.shukla@amd.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Phil Dennis-Jordan" <phil@philjordan.eu>
Subject: [PATCH-for-9.2] hw/i386/amd_iommu: Fix XTSup feature check when KVM is not available
Date: Fri, 29 Nov 2024 12:41:13 +0100 [thread overview]
Message-ID: <20241129114113.33215-1-philmd@linaro.org> (raw)
When building with debug on a host which doesn't provide KVM,
we get:
C compiler for the host machine: clang (clang 16.0.0 "Apple clang
version 16.0.0 (clang-1600.0.26.4)")
C linker for the host machine: clang ld64 1115.7.3
Host machine cpu family: aarch64
Host machine cpu: aarch64
Compilation
host CPU : aarch64
host endianness : little
C compiler : clang
Host C compiler : clang
C++ compiler : NO
Objective-C compiler : clang
Rust support : NO
CFLAGS : -g -O0
User defined options
optimization : 0
...
[1589/1590] Linking target qemu-system-x86_64-unsigned
Undefined symbols for architecture arm64:
"_kvm_enable_x2apic", referenced from:
_amdvi_sysbus_realize in hw_i386_amd_iommu.c.o
ld: symbol(s) not found for architecture arm64
In commit 9926cf34de5 ("target/i386: Allow elision of
kvm_enable_x2apic()") we removed this symbol stub globally
(debug and optimized build profiles). All code wanted to
access it must be protected by a check on kvm_enabled().
See the similar check in x86_cpus_init() added by commit
c04cfb4596a ("hw/i386: fix short-circuit logic with
non-optimizing builds").
In order to fix this linking error, protect the whole
block checking the XTSup feature with a check on whether
KVM is enabled.
Since x86_cpus_init() already checks APIC ID > 255 imply
kernel support for irqchip and X2APIC, remove the confuse
and unlikely reachable "AMD IOMMU xtsup=on requires support
on the KVM side" message.
Fix a type in "configuration" in error message.
Fixes: b12cb3819baf (amd_iommu: Check APIC ID > 255 for XTSup)
Reported-by: Phil Dennis-Jordan <phil@philjordan.eu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Alternative fix to:
- https://lore.kernel.org/qemu-devel/20241113144923.41225-1-phil@philjordan.eu/
- https://lore.kernel.org/qemu-devel/20241114114509.15350-1-sarunkod@amd.com/
---
hw/i386/amd_iommu.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 13af7211e11..39b6d6ef295 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -1652,13 +1652,8 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp)
memory_region_add_subregion_overlap(&s->mr_sys, AMDVI_INT_ADDR_FIRST,
&s->mr_ir, 1);
- /* AMD IOMMU with x2APIC mode requires xtsup=on */
- if (x86ms->apic_id_limit > 255 && !s->xtsup) {
- error_report("AMD IOMMU with x2APIC confguration requires xtsup=on");
- exit(EXIT_FAILURE);
- }
- if (s->xtsup && kvm_irqchip_is_split() && !kvm_enable_x2apic()) {
- error_report("AMD IOMMU xtsup=on requires support on the KVM side");
+ if (kvm_enabled() && x86ms->apic_id_limit > 255 && !s->xtsup) {
+ error_report("AMD IOMMU with x2APIC configuration requires xtsup=on");
exit(EXIT_FAILURE);
}
--
2.45.2
reply other threads:[~2024-11-29 11:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20241129114113.33215-1-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=Vasant.Hegde@amd.com \
--cc=dhoff749@gmail.com \
--cc=eduardo@habkost.net \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=phil@philjordan.eu \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=santosh.shukla@amd.com \
--cc=sarunkod@amd.com \
--cc=zhao1.liu@intel.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).