From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vtq86-000212-On for qemu-devel@nongnu.org; Thu, 19 Dec 2013 21:48:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vtq80-0003df-03 for qemu-devel@nongnu.org; Thu, 19 Dec 2013 21:47:58 -0500 Received: from mail-pb0-f44.google.com ([209.85.160.44]:60922) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vtq7z-0003cq-No for qemu-devel@nongnu.org; Thu, 19 Dec 2013 21:47:51 -0500 Received: by mail-pb0-f44.google.com with SMTP id rq2so1976070pbb.31 for ; Thu, 19 Dec 2013 18:47:51 -0800 (PST) Message-ID: <52B3AFD1.90008@ozlabs.ru> Date: Fri, 20 Dec 2013 13:47:45 +1100 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1384925988-11398-1-git-send-email-aik@ozlabs.ru> <52A049E0.3000701@ozlabs.ru> In-Reply-To: <52A049E0.3000701@ozlabs.ru> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] spapr-iommu: extend SPAPR_TCE_TABLE class List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , qemu-ppc@nongnu.org, Alexander Graf On 12/05/2013 08:39 PM, Alexey Kardashevskiy wrote: > On 11/20/2013 04:39 PM, Alexey Kardashevskiy wrote: >> This adds a put_tce() callback to the SPAPR TCE TABLE device class. >> The new callback allows to have different IOMMU types such as upcoming >> VFIO IOMMU and it will be used more by the upcoming Multi-TCE support. >> >> This reworks the H_PUT_TCE handler to make use of the new put_tce() >> callback. > > > Ping? Ping? > >> >> Signed-off-by: Alexey Kardashevskiy >> --- >> hw/ppc/spapr_iommu.c | 21 +++++++++++++++++---- >> include/hw/ppc/spapr.h | 13 +++++++++++++ >> 2 files changed, 30 insertions(+), 4 deletions(-) >> >> diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c >> index ef45f4f..0016c13 100644 >> --- a/hw/ppc/spapr_iommu.c >> +++ b/hw/ppc/spapr_iommu.c >> @@ -207,7 +207,7 @@ static target_ulong put_tce_emu(sPAPRTCETable *tcet, target_ulong ioba, >> IOMMUTLBEntry entry; >> >> if (ioba >= tcet->window_size) { >> - hcall_dprintf("spapr_vio_put_tce on out-of-bounds IOBA 0x" >> + hcall_dprintf("spapr put_tce_emu on out-of-bounds IOBA 0x" >> TARGET_FMT_lx "\n", ioba); >> return H_PARAMETER; >> } >> @@ -232,12 +232,21 @@ static target_ulong h_put_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr, >> target_ulong tce = args[2]; >> target_ulong ret = H_PARAMETER; >> sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn); >> + sPAPRTCETableClass *info; >> + >> + if (!tcet) { >> + return H_PARAMETER; >> + } >> + >> + info = SPAPR_TCE_TABLE_GET_CLASS(tcet); >> + if (!info || !info->put_tce) { >> + return H_PARAMETER; >> + } >> >> ioba &= ~(SPAPR_TCE_PAGE_SIZE - 1); >> >> - if (tcet) { >> - ret = put_tce_emu(tcet, ioba, tce); >> - } >> + ret = info->put_tce(tcet, ioba, tce); >> + >> trace_spapr_iommu_put(liobn, ioba, tce, ret); >> >> return ret; >> @@ -287,9 +296,12 @@ int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname, >> static void spapr_tce_table_class_init(ObjectClass *klass, void *data) >> { >> DeviceClass *dc = DEVICE_CLASS(klass); >> + sPAPRTCETableClass *stc = SPAPR_TCE_TABLE_CLASS(klass); >> + >> dc->vmsd = &vmstate_spapr_tce_table; >> dc->init = spapr_tce_table_realize; >> dc->reset = spapr_tce_reset; >> + stc->put_tce = put_tce_emu; >> >> QLIST_INIT(&spapr_tce_tables); >> >> @@ -302,6 +314,7 @@ static TypeInfo spapr_tce_table_info = { >> .parent = TYPE_DEVICE, >> .instance_size = sizeof(sPAPRTCETable), >> .class_init = spapr_tce_table_class_init, >> + .class_size = sizeof(sPAPRTCETableClass), >> .instance_finalize = spapr_tce_table_finalize, >> }; >> >> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h >> index fdaab2d..827cda2 100644 >> --- a/include/hw/ppc/spapr.h >> +++ b/include/hw/ppc/spapr.h >> @@ -367,12 +367,25 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr, >> >> #define RTAS_ERROR_LOG_MAX 2048 >> >> +typedef struct sPAPRTCETableClass sPAPRTCETableClass; >> typedef struct sPAPRTCETable sPAPRTCETable; >> >> #define TYPE_SPAPR_TCE_TABLE "spapr-tce-table" >> #define SPAPR_TCE_TABLE(obj) \ >> OBJECT_CHECK(sPAPRTCETable, (obj), TYPE_SPAPR_TCE_TABLE) >> >> +#define SPAPR_TCE_TABLE_CLASS(klass) \ >> + OBJECT_CLASS_CHECK(sPAPRTCETableClass, (klass), TYPE_SPAPR_TCE_TABLE) >> +#define SPAPR_TCE_TABLE_GET_CLASS(obj) \ >> + OBJECT_GET_CLASS(sPAPRTCETableClass, (obj), TYPE_SPAPR_TCE_TABLE) >> + >> +struct sPAPRTCETableClass { >> + DeviceClass parent_class; >> + >> + target_ulong (*put_tce)(sPAPRTCETable *tcet, target_ulong ioba, >> + target_ulong tce); >> +}; >> + >> struct sPAPRTCETable { >> DeviceState parent; >> uint32_t liobn; >> > > -- Alexey