All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>,
	qemu-devel@nongnu.org, sarunkod@amd.com, pbonzini@redhat.com,
	richard.henderson@linaro.org
Subject: Re: [PATCH 2/2] amd_iommu: Fully initialize XT interrupt message state
Date: Tue, 23 Jun 2026 14:37:32 -0400	[thread overview]
Message-ID: <20260623143614-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAFEAcA8NKB6Wg-Gsbv_NXp72PLADS=h7p7KyLCW1gRCbywESfQ@mail.gmail.com>

On Tue, Jun 23, 2026 at 09:44:10AM +0100, Peter Maydell wrote:
> On Tue, 23 Jun 2026 at 01:58, Alejandro Jimenez
> <alejandro.j.jimenez@oracle.com> wrote:
> >
> > When IOMMU x2APIC interrupts generation (IntCapXTEn) is enabled,
> > amdvi_build_xt_msi_msg() builds an MSI message using the relevant values in
> > the XT IOMMU General Interrupt Control Register.
> >
> > Initialize the local X86IOMMUIrq structure with zero for all fields. This
> > ensures that X86IOMMUIrq fields not set in the XT register (e.g.
> > msi_addr_last_bits) are initialized before x86_iommu_irq_to_msi_message()
> > consumes them.
> >
> > Remove the redundant 'struct' keyword in X86IOMMUIrq irq declaration.
> >
> > CID: 1660056
> > Fixes: cf0210df65aa ("amd_iommu: Generate XT interrupts when xt support is enabled")
> > Reported-by: Peter Maydell <peter.maydell@linaro.org>
> > Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> > Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
> > ---
> >  hw/i386/amd_iommu.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
> > index 0d273fd33d..9005dc7aab 100644
> > --- a/hw/i386/amd_iommu.c
> > +++ b/hw/i386/amd_iommu.c
> > @@ -195,7 +195,7 @@ static void amdvi_assign_andq(AMDVIState *s, hwaddr addr, uint64_t val)
> >  static void amdvi_build_xt_msi_msg(AMDVIState *s, MSIMessage *msg)
> >  {
> >      union mmio_xt_intr xt_reg;
> > -    struct X86IOMMUIrq irq;
> > +    X86IOMMUIrq irq = { 0 };

Why don't we just initialize everything at the declaration site?

union mmio_xt_intr xt_reg = { .val = ... };
X86IOMMUIrq irq = { .... };

> This is fine for the Coverity problem, but you do also need to
> get rid of the bitfield-union as a separate issue.

Ideal task for AI actually.

> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> 
> thanks
> -- PMM




  reply	other threads:[~2026-06-23 18:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23  0:58 [PATCH 0/2] amd_iommu: Fix Coverity issues from 11.1 pull request Alejandro Jimenez
2026-06-23  0:58 ` [PATCH 1/2] amd_iommu: Return int from page walk status helpers Alejandro Jimenez
2026-06-23  8:43   ` Peter Maydell
2026-06-23  0:58 ` [PATCH 2/2] amd_iommu: Fully initialize XT interrupt message state Alejandro Jimenez
2026-06-23  8:44   ` Peter Maydell
2026-06-23 18:37     ` Michael S. Tsirkin [this message]
2026-06-23 21:57       ` Alejandro Jimenez

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=20260623143614-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=alejandro.j.jimenez@oracle.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sarunkod@amd.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 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.