[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 37/61] pci: add helper function for pci config w
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] Re: [PATCH 37/61] pci: add helper function for pci config write function to check address. |
Date: |
Wed, 30 Sep 2009 13:50:19 +0200 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
On Wed, Sep 30, 2009 at 07:18:13PM +0900, Isaku Yamahata wrote:
> add helper function for pci config write function to check address.
> Those function will be used later.
>
> Signed-off-by: Isaku Yamahata <address@hidden>
> ---
> hw/pci.h | 14 ++++++++++++++
> 1 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/hw/pci.h b/hw/pci.h
> index 5cd882c..26c15c5 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> @@ -406,6 +406,20 @@ pci_config_get_quad(PCIDevice *d, uint32_t addr)
> return pci_get_quad(&d->config[addr]);
> }
>
> +static inline int pci_config_changed(uint32_t addr, uint32_t len,
> + uint32_t base, uint32_t end)
> +{
> + /* check if [addr, addr + len] intersects [base, end] */
> + return base <= addr + len && addr <= end;
> +}
> +
> +static inline int pci_config_changed_with_size(uint32_t addr, uint32_t len,
> + uint32_t base, uint32_t size)
> +{
> + /* check if [addr, addr + len] intersects [base, base + size] */
> + return base <= addr + len && addr <= base + size;
> +}
> +
This does not really check whether the value was changed:
just that transaction touched it, the new value could be same
as old.
What I think we should do, is on each config access,
store the previous config inside pci device structure.
Then to see whether something changed, you just do
a memcpy, or pci_get_word(d->orig) != pci_get_word(d->config),
or anything you like, and no need for wrappers.
> typedef int (*pci_qdev_initfn)(PCIDevice *dev);
> typedef struct {
> DeviceInfo qdev;
> --
> 1.6.0.2
>
>
- [Qemu-devel] [PATCH 56/61] ioapic: clean up of #ifdef DEBUG_IOAPIC., (continued)
- [Qemu-devel] [PATCH 56/61] ioapic: clean up of #ifdef DEBUG_IOAPIC., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 03/61] acpi: add acpi constants from linux header files and use them., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 49/61] pci hot add: pass opaque argument to callback., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 01/61] acpi: split out pc smbus routines from acpi.c into pc_smbus.c, Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 61/61] pc_q35: apic mode for pci interrupt routing., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 11/61] pc: introduce a function to allocate cpu irq., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 51/61] vmstate: add a macro for pointer to struct, VMSTATE_STRUCT_POINTER., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 54/61] pci: add opaque argument to pci_map_irq_fn()., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 30/61] pci_host.h: split non-inline static function in pci_host.h into pci_host_c.h, Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 37/61] pci: add helper function for pci config write function to check address., Isaku Yamahata, 2009/09/30
- [Qemu-devel] Re: [PATCH 37/61] pci: add helper function for pci config write function to check address.,
Michael S. Tsirkin <=
- [Qemu-devel] [PATCH 36/61] pci: use QLIST_ macro instead of direct list manipulation., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 22/61] pci: use appropriate PRIs in PCI_DPRINTF()., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 43/61] pci: add helper function to initialize wmask., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 39/61] pci: factor out config update logic., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 55/61] ioapic: make ioapic_set_irq() static., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 53/61] pc q35 based chipset emulator, Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 38/61] pci: fix pci_default_write_config(), Isaku Yamahata, 2009/09/30