From: Jason Baron <jbaron@redhat.com>
To: anthony@codemonkey.ws, benh@kernel.crashing.org
Cc: mst@redhat.com, jan.kiszka@siemens.com, armbru@redhat.com,
qemu-devel@nongnu.org, yamahata@valinux.co.jp,
alex.williamson@redhat.com, ddutile@redhat.com, afaerber@suse.de
Subject: [Qemu-devel] [PATCH 3/3] iommu: add generic mapping support for the isa bus
Date: Wed, 20 Jun 2012 16:11:14 -0400 [thread overview]
Message-ID: <cb52bd793f8f2253179b986b2dee94cf4a0f1914.1340220655.git.jbaron@redhat.com> (raw)
In-Reply-To: <cover.1340220655.git.jbaron@redhat.com>
Introduce 'isa_setup_iommu()' to allow chipsets to associate an iommu mapping
function with the isa bus. This allows isa devices which sit behind an iommu
to be correctly configured. This is based on Benjamin Herrenschmidt's iommu
series. It has no consumers for now.
Signed-off-by: Jason Baron <jbaron@redhat.com>
---
hw/isa-bus.c | 11 +++++++++++
hw/isa.h | 5 +++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index cfd7501..0232799 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -118,10 +118,17 @@ void isa_register_portio_list(ISADevice *dev, uint16_t start,
portio_list_add(piolist, isabus->address_space_io, start);
}
+void isa_setup_iommu(ISABus *bus, ISADMAContextFunc fn, void *opaque)
+{
+ bus->dma_context_fn = fn;
+ bus->dma_context_opaque = opaque;
+}
+
static int isa_qdev_init(DeviceState *qdev)
{
ISADevice *dev = ISA_DEVICE(qdev);
ISADeviceClass *klass = ISA_DEVICE_GET_CLASS(dev);
+ ISABus *isabus;
dev->isairq[0] = -1;
dev->isairq[1] = -1;
@@ -132,6 +139,10 @@ static int isa_qdev_init(DeviceState *qdev)
/* iommu setup */
dev->dma = NULL;
+ isabus = FROM_QBUS(ISABus, qdev_get_parent_bus(qdev));
+ if (isabus->dma_context_fn) {
+ dev->dma = isabus->dma_context_fn(isabus, isabus->dma_context_opaque);
+ }
return 0;
}
diff --git a/hw/isa.h b/hw/isa.h
index a1c3f25..e6a0bb1 100644
--- a/hw/isa.h
+++ b/hw/isa.h
@@ -26,10 +26,15 @@ typedef struct ISADeviceClass {
int (*init)(ISADevice *dev);
} ISADeviceClass;
+typedef DMAContext *(*ISADMAContextFunc)(ISABus *, void *);
+void isa_setup_iommu(ISABus *bus, ISADMAContextFunc fn, void *opaque);
+
struct ISABus {
BusState qbus;
MemoryRegion *address_space_io;
qemu_irq *irqs;
+ ISADMAContextFunc dma_context_fn;
+ void *dma_context_opaque;
};
struct ISADevice {
--
1.7.1
prev parent reply other threads:[~2012-06-20 20:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-20 20:11 [Qemu-devel] [PATCH 0/3] iommu: isa dma engine support Jason Baron
2012-06-20 20:11 ` [Qemu-devel] [PATCH 1/3] iommu: remove extra 'typedef struct DMAContext' Jason Baron
2012-06-22 2:02 ` Benjamin Herrenschmidt
2012-06-20 20:11 ` [Qemu-devel] [PATCH 2/3] iommu: add support for the isa dma engine Jason Baron
2012-06-20 20:11 ` Jason Baron [this message]
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=cb52bd793f8f2253179b986b2dee94cf4a0f1914.1340220655.git.jbaron@redhat.com \
--to=jbaron@redhat.com \
--cc=afaerber@suse.de \
--cc=alex.williamson@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=armbru@redhat.com \
--cc=benh@kernel.crashing.org \
--cc=ddutile@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yamahata@valinux.co.jp \
/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).