From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Alexander Graf <agraf@suse.de>,
Michael Roth <mdroth@linux.vnet.ibm.com>,
qemu-devel@nongnu.org,
Alex Williamson <alex.williamson@redhat.com>,
qemu-ppc@nongnu.org, Gavin Shan <gwshan@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH qemu v6 08/15] spapr_iommu: Introduce "enabled" state for TCE table
Date: Wed, 22 Apr 2015 19:10:14 +1000 [thread overview]
Message-ID: <55376576.2060408@ozlabs.ru> (raw)
In-Reply-To: <20150422061420.GN31815@voom.redhat.com>
On 04/22/2015 04:14 PM, David Gibson wrote:
> On Sat, Apr 11, 2015 at 01:24:37AM +1000, Alexey Kardashevskiy wrote:
>> Currently TCE tables are created once at start and their size never
>> changes. We are going to change that by introducing a Dynamic DMA windows
>> support where DMA configuration may change during the guest execution.
>>
>> This changes spapr_tce_new_table() to create an empty stub object. Only
>> LIOBN is assigned by the time of creation. It still will be called once
>> at the owner object (VIO or PHB) creation.
>>
>> This introduces an "enabled" state for TCE table objects with two
>> helper functions - spapr_tce_table_enable()/spapr_tce_table_disable().
>> spapr_tce_table_enable() receives TCE table parameters and allocates
>> a guest view of the TCE table (in the user space or KVM).
>> spapr_tce_table_disable() disposes the table.
>>
>> Follow up patches will disable+enable tables on reset (system reset
>> or DDW reset).
>>
>> No visible change in behaviour is expected except the actual table
>> will be reallocated every reset. We might optimize this later.
>>
>> The other way to implement this would be dynamically create/remove
>> the TCE table QOM objects but this would make migration impossible
>> as migration expects all QOM objects to exist at the receiver
>> so we have to have TCE table objects created when migration begins.
>>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> ---
>> Changes:
>> v6:
>> * got rid of set_props()
>> ---
>> hw/ppc/spapr_iommu.c | 104 +++++++++++++++++++++++++++++++-----------------
>> hw/ppc/spapr_pci.c | 16 +++++---
>> hw/ppc/spapr_pci_vfio.c | 10 ++---
>> hw/ppc/spapr_vio.c | 9 ++---
>> include/hw/ppc/spapr.h | 11 ++---
>> 5 files changed, 93 insertions(+), 57 deletions(-)
>>
>> diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
>> index a14cdc4..64f20f2 100644
>> --- a/hw/ppc/spapr_iommu.c
>> +++ b/hw/ppc/spapr_iommu.c
>> @@ -126,8 +126,47 @@ static MemoryRegionIOMMUOps spapr_iommu_ops = {
>> static int spapr_tce_table_realize(DeviceState *dev)
>> {
>> sPAPRTCETable *tcet = SPAPR_TCE_TABLE(dev);
>> +
>> + QLIST_INSERT_HEAD(&spapr_tce_tables, tcet, list);
>> +
>> + vmstate_register(DEVICE(tcet), tcet->liobn, &vmstate_spapr_tce_table,
>> + tcet);
>> +
>> + return 0;
>> +}
>> +
>> +sPAPRTCETable *spapr_tce_new_table(DeviceState *owner, uint32_t liobn)
>> +{
>> + sPAPRTCETable *tcet;
>> + char tmp[64];
>> +
>> + if (spapr_tce_find_by_liobn(liobn)) {
>> + fprintf(stderr, "Attempted to create TCE table with duplicate"
>> + " LIOBN 0x%x\n", liobn);
>> + return NULL;
>> + }
>> +
>> + tcet = SPAPR_TCE_TABLE(object_new(TYPE_SPAPR_TCE_TABLE));
>> + tcet->liobn = liobn;
>> +
>> + snprintf(tmp, sizeof(tmp), "tce-table-%x", liobn);
>> + object_property_add_child(OBJECT(owner), tmp, OBJECT(tcet), NULL);
>> +
>> + object_property_set_bool(OBJECT(tcet), true, "realized", NULL);
>> +
>> + trace_spapr_iommu_new_table(tcet->liobn, tcet, tcet->table, tcet->fd);
>> +
>> + return tcet;
>> +}
>> +
>> +static void spapr_tce_table_do_enable(sPAPRTCETable *tcet)
>
> AFAICT there's only one caller of this, so it's not clear why this
> isn't just open-coded in spapr_tce_table_enable().
There is another call in "[PATCH qemu v6 14/15] spapr_pci/spapr_pci_vfio:
Support Dynamic DMA Windows (DDW)", in spapr_tce_table_post_load().
Should I put a note in the commit log?
--
Alexey
next prev parent reply other threads:[~2015-04-22 9:10 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-10 15:24 [Qemu-devel] [PATCH qemu v6 00/15] spapr: vfio: Enable Dynamic DMA windows (DDW) Alexey Kardashevskiy
2015-04-10 15:24 ` [Qemu-devel] [PATCH qemu v6 01/15] linux headers update for DDW on SPAPR Alexey Kardashevskiy
2015-04-10 15:24 ` [Qemu-devel] [PATCH qemu v6 02/15] vmstate: Define VARRAY with VMS_ALLOC Alexey Kardashevskiy
2015-04-15 3:47 ` David Gibson
2015-04-10 15:24 ` [Qemu-devel] [PATCH qemu v6 03/15] spapr_pci: Make find_phb()/find_dev() public Alexey Kardashevskiy
2015-04-21 20:44 ` Michael Roth
2015-04-10 15:24 ` [Qemu-devel] [PATCH qemu v6 04/15] vfio: spapr: Move SPAPR-related code to a separate file Alexey Kardashevskiy
2015-04-16 7:50 ` Thomas Huth
2015-04-16 16:27 ` Alexey Kardashevskiy
2015-04-10 15:24 ` [Qemu-devel] [PATCH qemu v6 05/15] spapr_pci_vfio: Enable multiple groups per container Alexey Kardashevskiy
2015-04-22 5:34 ` David Gibson
2015-04-10 15:24 ` [Qemu-devel] [PATCH qemu v6 06/15] spapr_pci: Convert finish_realize() to dma_capabilities_update()+dma_init_window() Alexey Kardashevskiy
2015-04-22 5:39 ` David Gibson
2015-04-10 15:24 ` [Qemu-devel] [PATCH qemu v6 07/15] vfio: spapr: Add SPAPR IOMMU v2 support (DMA memory preregistering) Alexey Kardashevskiy
2015-04-16 10:07 ` Thomas Huth
2015-04-24 5:55 ` Alexey Kardashevskiy
2015-04-22 5:53 ` David Gibson
2015-04-22 9:38 ` Alexey Kardashevskiy
2015-04-29 5:58 ` David Gibson
2015-04-10 15:24 ` [Qemu-devel] [PATCH qemu v6 08/15] spapr_iommu: Introduce "enabled" state for TCE table Alexey Kardashevskiy
2015-04-16 10:59 ` Thomas Huth
2015-04-22 6:14 ` David Gibson
2015-04-22 9:10 ` Alexey Kardashevskiy [this message]
2015-04-10 15:24 ` [Qemu-devel] [PATCH qemu v6 09/15] spapr_iommu: Add root memory region Alexey Kardashevskiy
2015-04-10 15:24 ` [Qemu-devel] [PATCH qemu v6 10/15] spapr_pci_vfio: Remove unnecessary cast to sPAPRPHBVFIOState Alexey Kardashevskiy
2015-04-16 10:31 ` Thomas Huth
2015-04-17 1:55 ` Alexey Kardashevskiy
2015-04-22 6:33 ` David Gibson
2015-04-10 15:24 ` [Qemu-devel] [PATCH qemu v6 11/15] spapr_pci: Do complete reset of DMA config when resetting PHB Alexey Kardashevskiy
2015-04-22 6:39 ` David Gibson
2015-04-22 9:17 ` Alexey Kardashevskiy
2015-04-10 15:24 ` [Qemu-devel] [PATCH qemu v6 12/15] spapr_vfio_pci: Remove redundant spapr-pci-vfio-host-bridge Alexey Kardashevskiy
2015-04-22 6:47 ` David Gibson
2015-04-22 9:06 ` Alexey Kardashevskiy
2015-04-10 15:24 ` [Qemu-devel] [PATCH qemu v6 13/15] spapr: Add pseries-2.4 machine Alexey Kardashevskiy
2015-04-22 6:48 ` David Gibson
2015-04-10 15:24 ` [Qemu-devel] [PATCH qemu v6 14/15] spapr_pci/spapr_pci_vfio: Support Dynamic DMA Windows (DDW) Alexey Kardashevskiy
2015-04-10 15:24 ` [Qemu-devel] [PATCH qemu v6 15/15] vfio: Enable DDW ioctls to VFIO IOMMU driver 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=55376576.2060408@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=agraf@suse.de \
--cc=alex.williamson@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=gwshan@linux.vnet.ibm.com \
--cc=mdroth@linux.vnet.ibm.com \
--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 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.