|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] x86/passthrough: Fix hvm_gsi_eoi() build with GCC 12
GCC master (nearly version 12) complains:
hvm.c: In function 'hvm_gsi_eoi':
hvm.c:905:10: error: the comparison will always evaluate as 'true' for the
address of 'dpci' will never be NULL [-Werror=address]
905 | if ( !pirq_dpci(pirq) )
| ^
In file included from /local/xen.git/xen/include/xen/irq.h:73,
from /local/xen.git/xen/include/xen/pci.h:13,
from /local/xen.git/xen/include/asm/hvm/io.h:22,
from /local/xen.git/xen/include/asm/hvm/domain.h:27,
from /local/xen.git/xen/include/asm/domain.h:7,
from /local/xen.git/xen/include/xen/domain.h:8,
from /local/xen.git/xen/include/xen/sched.h:11,
from /local/xen.git/xen/include/xen/event.h:12,
from hvm.c:20:
/local/xen.git/xen/include/asm/irq.h:140:34: note: 'dpci' declared here
140 | struct hvm_pirq_dpci dpci;
| ^~~~
The location marker is unhelpfully positioned and upstream may get around to
fixing it. The complaint is intended to be:
if ( !((pirq) ? &(pirq)->arch.hvm.dpci : NULL) )
^~~~~~~~~~~~~~~~~~~~~~
which is a hint that the code is should be simplified to just:
if ( !pirq )
Do so.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Ian Jackson <iwj@xxxxxxxxxxxxxx>
Request for 4.16, as being very low risk.
This is a build problem with a soon-to-be-released compiler, but the issue it
highlights is real and the fix is a clear improvement in code quality. There
is no difference in the compiled binary as a result of this change.
$ diff -u dis-before dis-after
--- dis-before 2021-10-27 21:00:07.512530321 +0100
+++ dis-after 2021-10-27 21:00:25.996752544 +0100
@@ -1,5 +1,5 @@
-xen-syms-before: file format elf64-x86-64
+xen-syms-after: file format elf64-x86-64
Disassembly of section .text:
If this does not get taken at this point, it will need backporting after the
release, when GCC 12 is released.
---
xen/drivers/passthrough/x86/hvm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/drivers/passthrough/x86/hvm.c
b/xen/drivers/passthrough/x86/hvm.c
index 351daafdc9bf..22bf84639f22 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -902,7 +902,7 @@ static void hvm_gsi_eoi(struct domain *d, unsigned int gsi)
struct pirq *pirq = pirq_info(d, gsi);
/* Check if GSI is actually mapped. */
- if ( !pirq_dpci(pirq) )
+ if ( !pirq )
return;
hvm_gsi_deassert(d, gsi);
--
2.11.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |