All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/passthrough:  Fix hvm_gsi_eoi() build with GCC 12
@ 2021-10-27 20:07 Andrew Cooper
  2021-10-28  7:31 ` Roger Pau Monné
  2021-11-02 12:39 ` Jan Beulich
  0 siblings, 2 replies; 18+ messages in thread
From: Andrew Cooper @ 2021-10-27 20:07 UTC (permalink / raw)
  To: Xen-devel
  Cc: Andrew Cooper, Jan Beulich, Roger Pau Monné, Wei Liu,
	Ian Jackson

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@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>
CC: Ian Jackson <iwj@xenproject.org>

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



^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-11-18  9:51 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-27 20:07 [PATCH] x86/passthrough: Fix hvm_gsi_eoi() build with GCC 12 Andrew Cooper
2021-10-28  7:31 ` Roger Pau Monné
2021-10-28 12:15   ` Andrew Cooper
2021-10-28 13:26     ` Roger Pau Monné
2021-10-29 18:06       ` Andrew Cooper
2021-10-30  8:18         ` Roger Pau Monné
2021-11-02 12:39 ` Jan Beulich
2021-11-03 16:13   ` [PATCH for-4.16] " Ian Jackson
2021-11-04  8:07     ` Jan Beulich
2021-11-04 10:48       ` Andrew Cooper
2021-11-04 12:17         ` Jan Beulich
2021-11-04 15:24           ` Roger Pau Monné
2021-11-04 15:30             ` Ian Jackson
2021-11-04 15:34             ` Jan Beulich
2021-11-18  8:33           ` Roger Pau Monné
2021-11-18  8:51             ` Jan Beulich
2021-11-18  9:34               ` Roger Pau Monné
2021-11-18  9:50                 ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.