From: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
qemu-devel@nongnu.org, agraf@suse.de, qemu-ppc@nongnu.org,
David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PATCH] pseries iommu: h_put_tce split to support more IOMMUs
Date: Tue, 10 Jul 2012 23:46:08 +1000 [thread overview]
Message-ID: <1341927973-5615-1-git-send-email-aik@ozlabs.ru> (raw)
In-Reply-To: <no>
sPAPR IOMMU RTAS handler is split to common h_put_tce() part and
emulated IOMMU implementation called put_tce_emu().
Further patches will extend h_put_tce() with put_tce_vfio() in
order to support other types of IOMMU such as VFIO.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
hw/spapr_iommu.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/hw/spapr_iommu.c b/hw/spapr_iommu.c
index 388ffa4..3021bfe 100644
--- a/hw/spapr_iommu.c
+++ b/hw/spapr_iommu.c
@@ -162,21 +162,25 @@ void spapr_tce_free(DMAContext *dma)
}
}
-static target_ulong put_tce_emu(sPAPRTCETable *tcet, target_ulong ioba,
- target_ulong tce)
+static int put_tce_emu(target_ulong liobn, target_ulong ioba, target_ulong tce)
{
+ sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn);
sPAPRTCE *tcep;
+ if (!tcet) {
+ return 1;
+ }
+
if (ioba >= tcet->window_size) {
hcall_dprintf("spapr_vio_put_tce on out-of-boards IOBA 0x"
TARGET_FMT_lx "\n", ioba);
- return H_PARAMETER;
+ return -1;
}
tcep = tcet->table + (ioba >> SPAPR_TCE_PAGE_SHIFT);
tcep->tce = tce;
- return H_SUCCESS;
+ return 0;
}
static target_ulong h_put_tce(CPUPPCState *env, sPAPREnvironment *spapr,
@@ -185,7 +189,7 @@ static target_ulong h_put_tce(CPUPPCState *env, sPAPREnvironment *spapr,
target_ulong liobn = args[0];
target_ulong ioba = args[1];
target_ulong tce = args[2];
- sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn);
+ int ret;
if (liobn & 0xFFFFFFFF00000000ULL) {
hcall_dprintf("spapr_vio_put_tce on out-of-boundsw LIOBN "
@@ -195,13 +199,14 @@ static target_ulong h_put_tce(CPUPPCState *env, sPAPREnvironment *spapr,
ioba &= ~(SPAPR_TCE_PAGE_SIZE - 1);
- if (tcet) {
- return put_tce_emu(tcet, ioba, tce);
+ ret = put_tce_emu(liobn, ioba, tce);
+ if (0 >= ret) {
+ return ret ? H_PARAMETER : H_SUCCESS;
}
#ifdef DEBUG_TCE
- fprintf(stderr, "%s on liobn=" TARGET_FMT_lx /*%s*/
- " ioba 0x" TARGET_FMT_lx " TCE 0x" TARGET_FMT_lx "\n",
- __func__, liobn, /*dev->qdev.id, */ioba, tce);
+ fprintf(stderr, "%s on liobn=" TARGET_FMT_lx
+ " ioba 0x" TARGET_FMT_lx " TCE 0x" TARGET_FMT_lx " ret=%d\n",
+ __func__, liobn, ioba, tce, ret);
#endif
return H_PARAMETER;
--
1.7.10
next parent reply other threads:[~2012-07-10 13:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <no>
2012-07-10 13:46 ` Alexey Kardashevskiy [this message]
2012-07-10 13:46 ` [Qemu-devel] [PATCH] pseries pci: removed cached qemu_irq from PCI host bus Alexey Kardashevskiy
2012-07-10 13:46 ` [Qemu-devel] [PATCH] pseries: added allocator for a block of IRQs Alexey Kardashevskiy
2012-07-10 13:46 ` [Qemu-devel] [PATCH] pseries pci: enable debugging with disabled emulated PCI bus Alexey Kardashevskiy
2012-07-10 13:46 ` [Qemu-devel] [PATCH] xics: added end-of-interrupt (EOI) handlers Alexey Kardashevskiy
2012-07-13 8:04 ` Alexey Kardashevskiy
2012-07-10 13:46 ` [Qemu-devel] [PATCH] pseries dma: DMA window params added to PHB and DT population changed Alexey Kardashevskiy
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=1341927973-5615-1-git-send-email-aik@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=agraf@suse.de \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/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).