From: Alex Williamson <alex.williamson@redhat.com>
To: Lan Tianyu <tianyu.lan@intel.com>
Cc: qemu-devel@nongnu.org, kevin.tian@intel.com, mst@redhat.com,
jan.kiszka@siemens.com, jasowang@redhat.com, peterx@redhat.com,
david@gibson.dropbear.id.au, yi.l.liu@intel.com
Subject: Re: [Qemu-devel] [Resend RFC PATCH 3/4] Intel iommu: Add Intel IOMMU fault event callback
Date: Mon, 20 Feb 2017 14:08:56 -0700 [thread overview]
Message-ID: <20170220140856.2cd275e5@t450s.home> (raw)
In-Reply-To: <1487554087-15347-4-git-send-email-tianyu.lan@intel.com>
On Mon, 20 Feb 2017 09:28:06 +0800
Lan Tianyu <tianyu.lan@intel.com> wrote:
> This patch is to deal with fault event reported from IOMMU driver.
>
> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
> ---
> hw/i386/intel_iommu.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
> index 9b1ba1b..79507d2 100644
> --- a/hw/i386/intel_iommu.c
> +++ b/hw/i386/intel_iommu.c
> @@ -2286,6 +2286,30 @@ static void vtd_iommu_notify_flag_changed(MemoryRegion *iommu,
> }
> }
>
> +static void vtd_iommu_notify_fault_event(MemoryRegion *iommu,
> + IOMMUFaultInfo *info)
> +{
> + VTDAddressSpace *vtd_as = container_of(iommu, VTDAddressSpace, iommu);
> + IntelIOMMUState *s = vtd_as->iommu_state;
> + bool is_fpd_set = false;
> + uint8_t bus_num = pci_bus_num(vtd_as->bus);
> + uint8_t devfn = vtd_as->devfn;
> + VTDContextEntry ce;
> +
> + /* Replace source id with device's vbdf */
> + info->sid = vtd_make_source_id(bus_num, devfn);
> +
> + if (!vtd_dev_to_context_entry(s, bus_num, devfn, &ce)) {
> + is_fpd_set = ce.lo & VTD_CONTEXT_ENTRY_FPD;
> + if (is_fpd_set) {
> + trace_vtd_fault_disabled();
> + } else {
> + vtd_report_dmar_fault(s, info->sid, info->addr,
> + info->fault_reason, info->is_write);
Convenient that the error structure exactly matches the function
parameters here. Is fault_reason going to be standardized across all
IOMMU vendors? If not, how does QEMU know whether the type1 container
is backed by VT-d, AMD-Vi, ARM SMMU, etc?
> + }
> + }
> +}
> +
> static const VMStateDescription vtd_vmstate = {
> .name = "iommu-intel",
> .version_id = 1,
> @@ -2816,6 +2840,7 @@ static void vtd_init(IntelIOMMUState *s)
>
> s->iommu_ops.translate = vtd_iommu_translate;
> s->iommu_ops.notify_flag_changed = vtd_iommu_notify_flag_changed;
> + s->iommu_ops.notify_fault_event = vtd_iommu_notify_fault_event;
> s->iommu_ops.replay = vtd_iommu_replay;
> s->root = 0;
> s->root_extended = false;
next prev parent reply other threads:[~2017-02-20 21:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-20 1:28 [Qemu-devel] [Resend RFC PATCH 0/4] VT-d: Inject fault event from IOMMU hardware Lan Tianyu
2017-02-20 1:28 ` [Qemu-devel] [Resend RFC PATCH 1/4] VFIO: Set eventfd for IOMMU fault event via new vfio cmd Lan Tianyu
2017-02-20 21:08 ` Alex Williamson
2017-02-20 1:28 ` [Qemu-devel] [Resend RFC PATCH 3/4] Intel iommu: Add Intel IOMMU fault event callback Lan Tianyu
2017-02-20 21:08 ` Alex Williamson [this message]
2017-02-20 1:28 ` [Qemu-devel] [Resend RFC PATCH 4/4] VFIO: Read IOMMU fault info from kernel space when get fault event Lan Tianyu
2017-02-20 21:09 ` Alex Williamson
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=20170220140856.2cd275e5@t450s.home \
--to=alex.williamson@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=jan.kiszka@siemens.com \
--cc=jasowang@redhat.com \
--cc=kevin.tian@intel.com \
--cc=mst@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=tianyu.lan@intel.com \
--cc=yi.l.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).