From: Peter Xu <peterx@redhat.com>
To: David Kiarie <davidkiarie4@gmail.com>
Cc: qemu-devel@nongnu.org, jan.kiszka@web.de, mst@redhat.com,
rkrcmar@redhat.com, ehabkost@redhat.com, pbonzini@redhat.com,
alex.williamson@redhat.com
Subject: Re: [Qemu-devel] [v4 4/6] hw/iommu: AMD IOMMU interrupt remapping
Date: Mon, 12 Sep 2016 19:34:50 +0800 [thread overview]
Message-ID: <20160912113450.GH3776@pxdev.xzpeter.org> (raw)
In-Reply-To: <1473674889-2727-5-git-send-email-davidkiarie4@gmail.com>
On Mon, Sep 12, 2016 at 01:08:07PM +0300, David Kiarie wrote:
[...]
> /* configure MMIO registers at startup/reset */
> static void amdvi_set_quad(AMDVIState *s, hwaddr addr, uint64_t val,
> uint64_t romask, uint64_t w1cmask)
> @@ -641,6 +667,11 @@ static void amdvi_inval_inttable(AMDVIState *s, CMDInvalIntrTable *inval)
> amdvi_log_illegalcom_error(s, inval->type, s->cmdbuf + s->cmdbuf_head);
> return;
> }
> +
> + if (s->ir_cache) {
Here, we notify IEC only if ir_cache == true, while...
[...]
> +static int amdvi_int_remap(X86IOMMUState *iommu, MSIMessage *src,
> + MSIMessage *dst, uint16_t sid)
> +{
> + trace_amdvi_ir_request(src->data, src->address, sid);
> +
> + AMDVIState *s = AMD_IOMMU_DEVICE(iommu);
> + int ret = 0;
> + uint64_t dte[4];
> + uint32_t bitpos;
> + IRTE irte;
> +
> + amdvi_get_dte(s, sid, dte);
> +
> + /* interrupt remapping disabled */
> + if (!(dte[2] & AMDVI_IR_VALID)) {
> + memcpy(dst, src, sizeof(*src));
> + return ret;
> + }
> +
> + ret = amdvi_irte_get(s, src, &irte, dte, sid);
> + if (ret < 0) {
> + goto no_remap;
> + }
> + switch (src->data & AMDVI_IR_TYPE_MASK) {
> + case AMDVI_MT_FIXED:
> + case AMDVI_MT_ARBIT:
> + ret = amdvi_remap_ir_intctl(dte[2], irte, src, dst);
> + if (ret < 0) {
> + goto no_remap;
> + } else {
> + s->ir_cache = true;
Here we set it only if the interrupts are triggered.
Shouldn't we notify IEC in all cases? Since the caches are setup
during configuration, not the first time the interrupt is triggered,
no?
> + trace_amdvi_ir_remap(dst->data, dst->address, sid);
> + return ret;
> + }
> + /* not handling SMI currently */
> + case AMDVI_MT_SMI:
> + error_report("SMI interrupts not currently handled");
> + goto no_remap;
> + case AMDVI_MT_NMI:
> + bitpos = AMDVI_DTE_NMIPASS_LSHIFT;
> + break;
> + case AMDVI_MT_INIT:
> + bitpos = AMDVI_DTE_INTPASS_LSHIFT;
> + break;
> + case AMDVI_MT_EXTINT:
> + bitpos = AMDVI_DTE_EINTPASS_LSHIFT;
> + break;
> + case AMDVI_MT_LINT1:
> + bitpos = AMDVI_DTE_LINT1PASS_LSHIFT;
> + break;
> + case AMDVI_MT_LINT0:
> + bitpos = AMDVI_DTE_LINT0PASS_LSHIFT;
> + default:
> + goto no_remap;
> + }
> +
> + ret = amdvi_ir_handle_non_vectored(src, dst, bitpos, dte[2]);
> + if (ret < 0){
> + goto no_remap;
> + }
> + s->ir_cache = true;
> + trace_amdvi_ir_remap(dst->data, dst->address, sid);
> + return ret;
> +no_remap:
> + memcpy(dst, src, sizeof(*src));
Shall we drop it and report when the remapping failed in some way?
I'm totally okay that we just drop it here, and we can do the
reporting in the future. But using the old is not a good one, since if
someone injects fault interrupts, it will be delivered just like
without IOMMU. So we have no protection at all.
Thanks,
-- peterx
next prev parent reply other threads:[~2016-09-12 11:35 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-12 10:08 [Qemu-devel] [v4 0/6] AMD IOMMU Interrupt remapping David Kiarie
2016-09-12 10:08 ` [Qemu-devel] [v4 1/6] hw/msi: Allow platform devices to use explicit SID David Kiarie
2016-09-12 11:02 ` Peter Xu
2016-09-12 11:26 ` David Kiarie
2016-09-12 11:54 ` Peter Xu
2016-09-12 10:08 ` [Qemu-devel] [v4 2/6] hw/i386: enforce SID verification David Kiarie
2016-09-12 11:09 ` Peter Xu
2016-09-12 11:12 ` David Kiarie
2016-09-12 11:13 ` Peter Xu
2016-09-12 10:08 ` [Qemu-devel] [v4 3/6] hw/iommu: Prepare for AMD IOMMU interrupt remapping David Kiarie
2016-09-12 10:08 ` [Qemu-devel] [v4 4/6] hw/iommu: " David Kiarie
2016-09-12 11:34 ` Peter Xu [this message]
2016-09-12 11:51 ` David Kiarie
2016-09-12 12:11 ` Peter Xu
2016-09-12 12:45 ` David Kiarie
2016-09-13 7:38 ` Peter Xu
2016-09-13 14:11 ` Michael S. Tsirkin
2016-09-13 14:13 ` Michael S. Tsirkin
2016-09-14 10:12 ` David Kiarie
2016-09-12 10:08 ` [Qemu-devel] [v4 5/6] hw/acpi: report IOAPIC on IVRS David Kiarie
2016-09-12 10:08 ` [Qemu-devel] [v4 6/6] hw/iommu: share common code between IOMMUs David Kiarie
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=20160912113450.GH3776@pxdev.xzpeter.org \
--to=peterx@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=davidkiarie4@gmail.com \
--cc=ehabkost@redhat.com \
--cc=jan.kiszka@web.de \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rkrcmar@redhat.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.