qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Rob Herring <rob.herring@linaro.org>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Claudio Fontana <claudio.fontana@huawei.com>,
	Alvise Rigo <a.rigo@virtualopensystems.com>,
	Stuart Yoder <stuart.yoder@freescale.com>,
	Alexander Graf <agraf@suse.de>,
	pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 1/4] pci: Split pcie_host_mmcfg_map()
Date: Tue, 27 Jan 2015 16:24:57 +0200	[thread overview]
Message-ID: <20150127142457.GA9335@redhat.com> (raw)
In-Reply-To: <CAFEAcA8j0Z4n5K4yXzk2MZSM1Jq0K7PG8Sc9sNybbp5S7FSxhw@mail.gmail.com>

On Tue, Jan 27, 2015 at 01:55:32PM +0000, Peter Maydell wrote:
> On 21 January 2015 at 16:18, Alexander Graf <agraf@suse.de> wrote:
> > The mmcfg space is a memory region that allows access to PCI config space
> > in the PCIe world. To maintain abstraction layers, I would like to expose
> > the mmcfg space as a sysbus mmio region rather than have it mapped straight
> > into the system's memory address space though.
> >
> > So this patch splits the initialization of the mmcfg space from the actual
> > mapping, allowing us to only have an mmfg memory region without the map.
> >
> > Signed-off-by: Alexander Graf <agraf@suse.de>
> > Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
> > Tested-by: Claudio Fontana <claudio.fontana@huawei.com>
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> ...as far as it goes, but:
> 
> Really the pcie_host_mmcfg_map/unmap/update() function is just totally
> misguided. This functionality should be pushed upwards into
> hw/pci-host/q35.c which can handle its own mapping of the MMIO region
> into the system address space at the appropriate location/size.
> 
> In particular, at the moment q35.c will leak a bunch of stuff
> every time the guest unmaps and remaps the mmcfg space, because
> we call memory_region_init_io() over and over again on the same
> MMIO object (which isn't valid).

I used to be fine before the QOM conversion I think?

Take a look at this one (and previous patch):

commit 469b046ead0671932ff3af8d6f95045b19b186ef
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Wed Jun 11 12:50:43 2014 +0200

    memory: remove memory_region_destroy
    
    The function is empty after the previous patch, so remove it.
    
    Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

> 
> Any time you see a device with its own base address in its
> device struct it's a red flag that the design's probably wrong...

I suspect this is not the only device that leaks memory now.
Paolo?

> The size of the MMCFG region should probably be a device property.
> Then the subclass realize could just rely on the baseclass realize
> to always create the mmio region, rather than having to explicitly
> call a function to get it to do the right thing.
> 
> thanks
> -- PMM

-- 
MST

  reply	other threads:[~2015-01-27 14:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-21 16:18 [Qemu-devel] [PATCH v2 0/4] ARM: Add support for a generic PCI Express host bridge Alexander Graf
2015-01-21 16:18 ` [Qemu-devel] [PATCH v2 1/4] pci: Split pcie_host_mmcfg_map() Alexander Graf
2015-01-27 13:55   ` Peter Maydell
2015-01-27 14:24     ` Michael S. Tsirkin [this message]
2015-01-27 14:40       ` Paolo Bonzini
2015-01-21 16:18 ` [Qemu-devel] [PATCH v2 2/4] pci: Add generic PCIe host bridge Alexander Graf
2015-01-22 16:32   ` B02008
2015-01-27 15:31   ` Peter Maydell
2015-01-29 13:59     ` Alexander Graf
2015-01-29 14:25       ` Peter Maydell
2015-01-30 10:25         ` Paolo Bonzini
2015-01-21 16:18 ` [Qemu-devel] [PATCH v2 3/4] arm: Add PCIe host bridge in virt machine Alexander Graf
2015-01-22 15:28   ` Claudio Fontana
2015-01-22 15:52     ` Alexander Graf
2015-01-27  9:24       ` Claudio Fontana
2015-01-27 10:09         ` Peter Maydell
2015-01-27 14:37           ` Claudio Fontana
2015-01-27 16:52   ` Peter Maydell
2015-01-29 14:31     ` Alexander Graf
2015-01-29 14:34       ` Peter Maydell
2015-01-29 14:37         ` Alexander Graf
2015-01-29 14:45           ` Peter Maydell
2015-01-29 14:49             ` Alexander Graf
2015-01-21 16:18 ` [Qemu-devel] [PATCH v2 4/4] pci: Move PCI VGA to pci.mak Alexander Graf

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=20150127142457.GA9335@redhat.com \
    --to=mst@redhat.com \
    --cc=a.rigo@virtualopensystems.com \
    --cc=agraf@suse.de \
    --cc=ard.biesheuvel@linaro.org \
    --cc=claudio.fontana@huawei.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rob.herring@linaro.org \
    --cc=stuart.yoder@freescale.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).