From: "Michael S. Tsirkin" <mst@redhat.com>
To: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: skandasa@cisco.com, adnan@khaleel.us, etmartin@cisco.com,
qemu-devel@nongnu.org, wexu2@cisco.com
Subject: [Qemu-devel] Re: [PATCH v4 04/15] pci: record which is written into pci configuration space
Date: Mon, 18 Oct 2010 07:38:53 +0200 [thread overview]
Message-ID: <20101018053853.GC18366@redhat.com> (raw)
In-Reply-To: <7d5d92f508899391d060809e9a419c7556905379.1287371107.git.yamahata@valinux.co.jp>
On Mon, Oct 18, 2010 at 12:17:45PM +0900, Isaku Yamahata wrote:
> record which is written into pci configuration space.
> introduce helper function to zero PCIDevice::written.
> They will be used later.
>
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
This really exposes an internal variable.
I really dislike this, and I don't think it's needed
at all: just make the bit writeable.
Commented on appropriate patches.
> ---
> hw/pci.c | 10 ++++++++++
> hw/pci.h | 5 +++++
> 2 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/hw/pci.c b/hw/pci.c
> index 5954476..eca9324 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -627,6 +627,7 @@ static void pci_config_alloc(PCIDevice *pci_dev)
> pci_dev->cmask = qemu_mallocz(config_size);
> pci_dev->wmask = qemu_mallocz(config_size);
> pci_dev->w1cmask = qemu_mallocz(config_size);
> + pci_dev->written = qemu_mallocz(config_size);
> pci_dev->used = qemu_mallocz(config_size);
> }
>
> @@ -636,6 +637,7 @@ static void pci_config_free(PCIDevice *pci_dev)
> qemu_free(pci_dev->cmask);
> qemu_free(pci_dev->wmask);
> qemu_free(pci_dev->w1cmask);
> + qemu_free(pci_dev->written);
> qemu_free(pci_dev->used);
> }
>
> @@ -1002,6 +1004,8 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
> assert(!(wmask & w1cmask));
> d->config[addr + i] = (d->config[addr + i] & ~wmask) | (val & wmask);
> d->config[addr + i] &= ~(val & w1cmask); /* W1C: Write 1 to Clear */
> + d->written[addr + i] = val; /* record what is written for driver
> + specific code */
> }
> if (ranges_overlap(addr, l, PCI_BASE_ADDRESS_0, 24) ||
> ranges_overlap(addr, l, PCI_ROM_ADDRESS, 4) ||
> @@ -1013,6 +1017,12 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
> pci_update_irq_disabled(d, was_irq_disabled);
> }
>
> +void pci_clear_written_write_config(PCIDevice *d,
> + uint32_t addr, uint32_t val, int l)
> +{
> + memset(d->written + addr, 0, l);
> +}
> +
> /***********************************************************/
> /* generic PCI irq support */
>
> diff --git a/hw/pci.h b/hw/pci.h
> index eafa9f3..7097817 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> @@ -132,6 +132,9 @@ struct PCIDevice {
> /* Used to implement RW1C(Write 1 to Clear) bytes */
> uint8_t *w1cmask;
>
> + /* Used to record what value is written */
> + uint8_t *written;
> +
> /* Used to allocate config space for capabilities. */
> uint8_t *used;
>
> @@ -200,6 +203,8 @@ uint32_t pci_default_read_config(PCIDevice *d,
> uint32_t address, int len);
> void pci_default_write_config(PCIDevice *d,
> uint32_t address, uint32_t val, int len);
> +void pci_clear_written_write_config(PCIDevice *d,
> + uint32_t addr, uint32_t val, int l);
> void pci_device_save(PCIDevice *s, QEMUFile *f);
> int pci_device_load(PCIDevice *s, QEMUFile *f);
>
> --
> 1.7.1.1
next prev parent reply other threads:[~2010-10-18 5:45 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-18 3:17 [Qemu-devel] [PATCH v4 00/15] pcie port switch emulators Isaku Yamahata
2010-10-18 3:17 ` [Qemu-devel] [PATCH v4 01/15] pci: make pci_del_capability() update for w1cmask Isaku Yamahata
2010-10-18 6:06 ` [Qemu-devel] " Michael S. Tsirkin
2010-10-18 3:17 ` [Qemu-devel] [PATCH v4 02/15] pci: introduce helper functions to clear/set bits in configuration space Isaku Yamahata
2010-10-18 5:42 ` [Qemu-devel] " Michael S. Tsirkin
2010-10-18 6:32 ` Michael S. Tsirkin
2010-10-18 3:17 ` [Qemu-devel] [PATCH v4 03/15] pci: use pci_clear_bit_word() in pci_device_reset() Isaku Yamahata
2010-10-18 3:17 ` [Qemu-devel] [PATCH v4 04/15] pci: record which is written into pci configuration space Isaku Yamahata
2010-10-18 5:38 ` Michael S. Tsirkin [this message]
2010-10-18 7:17 ` [Qemu-devel] " Isaku Yamahata
2010-10-18 7:32 ` Michael S. Tsirkin
2010-10-18 3:17 ` [Qemu-devel] [PATCH v4 05/15] pci/bridge: fix pci_bridge_reset() Isaku Yamahata
2010-10-18 6:22 ` [Qemu-devel] " Michael S. Tsirkin
2010-10-18 7:10 ` Isaku Yamahata
2010-10-18 7:08 ` Michael S. Tsirkin
2010-10-18 7:44 ` Isaku Yamahata
2010-10-18 3:17 ` [Qemu-devel] [PATCH v4 06/15] msi: implements msi Isaku Yamahata
2010-10-18 3:17 ` [Qemu-devel] [PATCH v4 07/15] pcie: add pcie constants to pcie_regs.h Isaku Yamahata
2010-10-18 3:17 ` [Qemu-devel] [PATCH v4 08/15] pcie: helper functions for pcie capability and extended capability Isaku Yamahata
2010-10-18 5:38 ` [Qemu-devel] " Michael S. Tsirkin
2010-10-18 3:17 ` [Qemu-devel] [PATCH v4 09/15] pcie/aer: helper functions for pcie aer capability Isaku Yamahata
2010-10-18 5:45 ` [Qemu-devel] " Michael S. Tsirkin
2010-10-18 3:17 ` [Qemu-devel] [PATCH v4 10/15] pcie port: define struct PCIEPort/PCIESlot and helper functions Isaku Yamahata
2010-10-18 3:17 ` [Qemu-devel] [PATCH v4 11/15] ioh3420: pcie root port in X58 ioh Isaku Yamahata
2010-10-18 3:17 ` [Qemu-devel] [PATCH v4 12/15] x3130: pcie upstream port Isaku Yamahata
2010-10-18 4:59 ` [Qemu-devel] " Michael S. Tsirkin
2010-10-18 3:17 ` [Qemu-devel] [PATCH v4 13/15] x3130: pcie downstream port Isaku Yamahata
2010-10-18 3:17 ` [Qemu-devel] [PATCH v4 14/15] pcie/hotplug: introduce pushing attention button command Isaku Yamahata
2010-10-18 3:17 ` [Qemu-devel] [PATCH v4 15/15] pcie/aer: glue aer error injection into qemu monitor Isaku Yamahata
2010-10-18 6:24 ` [Qemu-devel] Re: [PATCH v4 00/15] pcie port switch emulators 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=20101018053853.GC18366@redhat.com \
--to=mst@redhat.com \
--cc=adnan@khaleel.us \
--cc=etmartin@cisco.com \
--cc=qemu-devel@nongnu.org \
--cc=skandasa@cisco.com \
--cc=wexu2@cisco.com \
--cc=yamahata@valinux.co.jp \
/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).