From: Alex Williamson <alex.williamson@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: chrisw@redhat.com, qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: [Qemu-devel] Re: [PATCH 4/8] pci: Replace used bitmap with capability byte map
Date: Thu, 11 Nov 2010 23:07:15 -0700 [thread overview]
Message-ID: <1289542035.2805.49.camel@x201> (raw)
In-Reply-To: <20101112054058.GD7631@redhat.com>
On Fri, 2010-11-12 at 07:40 +0200, Michael S. Tsirkin wrote:
> On Thu, Nov 11, 2010 at 07:55:43PM -0700, Alex Williamson wrote:
> > Capabilities are allocated in bytes, so we can track both whether
> > a byte is used and by what capability in the same structure.
> >
> > Remove pci_reserve_capability() as there are no users.
> >
> > Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
>
> I actually wanted to remove the used array completely and ask
> all users to add offsets directly.
> Will this be needed then?
Can you give an example, I don't understand what you mean by asking
users to add offsets directly. I think some kind of tracking what's
where in config space needs to be done somewhere and the common PCI code
seems like it'd be the place. Thanks,
Alex
> > ---
> >
> > hw/pci.c | 16 +++++-----------
> > hw/pci.h | 6 ++----
> > 2 files changed, 7 insertions(+), 15 deletions(-)
> >
> > diff --git a/hw/pci.c b/hw/pci.c
> > index 6b2b320..e1e8a77 100644
> > --- a/hw/pci.c
> > +++ b/hw/pci.c
> > @@ -730,7 +730,7 @@ static void pci_config_alloc(PCIDevice *pci_dev)
> > pci_dev->config = qemu_mallocz(config_size);
> > pci_dev->cmask = qemu_mallocz(config_size);
> > pci_dev->wmask = qemu_mallocz(config_size);
> > - pci_dev->used = qemu_mallocz(config_size);
> > + pci_dev->cap_map = qemu_mallocz(config_size);
> > }
> >
> > static void pci_config_free(PCIDevice *pci_dev)
> > @@ -738,7 +738,7 @@ static void pci_config_free(PCIDevice *pci_dev)
> > qemu_free(pci_dev->config);
> > qemu_free(pci_dev->cmask);
> > qemu_free(pci_dev->wmask);
> > - qemu_free(pci_dev->used);
> > + qemu_free(pci_dev->cap_map);
> > }
> >
> > /* -1 for devfn means auto assign */
> > @@ -1928,7 +1928,7 @@ static int pci_find_space(PCIDevice *pdev, uint8_t size)
> > int offset = PCI_CONFIG_HEADER_SIZE;
> > int i;
> > for (i = PCI_CONFIG_HEADER_SIZE; i < config_size; ++i)
> > - if (pdev->used[i])
> > + if (pdev->cap_map[i])
> > offset = i + 1;
> > else if (i - offset + 1 == size)
> > return offset;
> > @@ -2033,7 +2033,7 @@ int pci_add_capability_at_offset(PCIDevice *pdev, uint8_t cap_id,
> > config[PCI_CAP_LIST_ID] = cap_id;
> > config[PCI_CAP_LIST_NEXT] = pdev->config[PCI_CAPABILITY_LIST];
> > pdev->config[PCI_CAPABILITY_LIST] = offset;
> > - memset(pdev->used + offset, 0xFF, size);
> > + memset(pdev->cap_map + offset, cap_id, size);
> > /* Make capability read-only by default */
> > memset(pdev->wmask + offset, 0, size);
> > /* Check capability by default */
> > @@ -2068,7 +2068,7 @@ void pci_del_capability(PCIDevice *pdev, uint8_t cap_id, uint8_t size)
> > memset(pdev->wmask + offset, 0xff, size);
> > /* Clear cmask as device-specific registers can't be checked */
> > memset(pdev->cmask + offset, 0, size);
> > - memset(pdev->used + offset, 0, size);
> > + memset(pdev->cap_map + offset, 0, size);
> >
> > if (!pdev->config[PCI_CAPABILITY_LIST]) {
> > pdev->config[PCI_STATUS] &= ~PCI_STATUS_CAP_LIST;
> > @@ -2076,12 +2076,6 @@ void pci_del_capability(PCIDevice *pdev, uint8_t cap_id, uint8_t size)
> > }
> > }
> >
> > -/* Reserve space for capability at a known offset (to call after load). */
> > -void pci_reserve_capability(PCIDevice *pdev, uint8_t offset, uint8_t size)
> > -{
> > - memset(pdev->used + offset, 0xff, size);
> > -}
> > -
> > uint8_t pci_find_capability(PCIDevice *pdev, uint8_t cap_id)
> > {
> > return pci_find_capability_list(pdev, cap_id, NULL);
> > diff --git a/hw/pci.h b/hw/pci.h
> > index 0712e55..2265c70 100644
> > --- a/hw/pci.h
> > +++ b/hw/pci.h
> > @@ -151,8 +151,8 @@ struct PCIDevice {
> > /* Used to implement R/W bytes */
> > uint8_t *wmask;
> >
> > - /* Used to allocate config space for capabilities. */
> > - uint8_t *used;
> > + /* Used to allocate config space and track capabilities. */
> > + uint8_t *cap_map;
> >
> > /* the following fields are read only */
> > PCIBus *bus;
> > @@ -239,8 +239,6 @@ int pci_add_capability_at_offset(PCIDevice *pci_dev, uint8_t cap_id,
> >
> > void pci_del_capability(PCIDevice *pci_dev, uint8_t cap_id, uint8_t cap_size);
> >
> > -void pci_reserve_capability(PCIDevice *pci_dev, uint8_t offset, uint8_t size);
> > -
> > uint8_t pci_find_capability(PCIDevice *pci_dev, uint8_t cap_id);
> >
> > uint32_t pci_default_read_config(PCIDevice *d,
next prev parent reply other threads:[~2010-11-12 6:07 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-12 2:54 [Qemu-devel] [PATCH 0/8] PCI capability and device assignment improvements Alex Williamson
2010-11-12 2:55 ` [Qemu-devel] [PATCH 1/8] pci: pci_default_cap_write_config ignores wmask Alex Williamson
2010-11-12 5:22 ` [Qemu-devel] " Michael S. Tsirkin
2010-11-12 6:03 ` Alex Williamson
2010-11-12 8:48 ` Michael S. Tsirkin
2010-11-12 15:49 ` Alex Williamson
2010-11-16 16:12 ` Michael S. Tsirkin
2010-11-12 2:55 ` [Qemu-devel] [PATCH 2/8] pci: Remove pci_enable_capability_support() Alex Williamson
2010-11-12 2:55 ` [Qemu-devel] [PATCH 3/8] device-assignment: Use PCI capabilities support Alex Williamson
2010-11-12 2:55 ` [Qemu-devel] [PATCH 4/8] pci: Replace used bitmap with capability byte map Alex Williamson
2010-11-12 5:40 ` [Qemu-devel] " Michael S. Tsirkin
2010-11-12 6:07 ` Alex Williamson [this message]
2010-11-12 9:02 ` Michael S. Tsirkin
2010-11-12 15:32 ` Alex Williamson
2010-11-12 2:55 ` [Qemu-devel] [PATCH 5/8] pci: Remove cap.length, cap.start, cap.supported Alex Williamson
2010-11-12 2:56 ` [Qemu-devel] [PATCH 6/8] device-assignment: Move PCI capabilities to match physical hardware Alex Williamson
2010-11-12 9:20 ` [Qemu-devel] " Michael S. Tsirkin
2010-11-12 13:53 ` Alex Williamson
2010-11-12 2:56 ` [Qemu-devel] [PATCH 7/8] pci: Pass ID for capability read/write handlers Alex Williamson
2010-11-12 2:56 ` [Qemu-devel] [RFC PATCH 8/8] device-assignment: pass through and stub more PCI caps Alex Williamson
2010-11-12 5:36 ` [Qemu-devel] " Michael S. Tsirkin
2010-11-12 6:30 ` Alex Williamson
2010-11-12 9:11 ` Michael S. Tsirkin
2010-11-12 15:42 ` Alex Williamson
2010-11-16 16:08 ` Michael S. Tsirkin
2010-11-12 5:39 ` [Qemu-devel] Re: [PATCH 0/8] PCI capability and device assignment improvements Michael S. Tsirkin
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=1289542035.2805.49.camel@x201 \
--to=alex.williamson@redhat.com \
--cc=chrisw@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=qemu-devel@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).