qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: mtosatti@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com
Subject: [Qemu-devel] Re: [PATCH 3/4] pci: pci_default_config_write() clean up.
Date: Mon, 25 May 2009 10:09:47 +0300	[thread overview]
Message-ID: <20090525070947.GA424@redhat.com> (raw)
In-Reply-To: <1242786334-32752-4-git-send-email-yamahata@valinux.co.jp>

On Wed, May 20, 2009 at 11:25:33AM +0900, Isaku Yamahata wrote:
> diff --git a/hw/pci.h b/hw/pci.h
> index 7f7842f..6bb1c5c 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> +struct PCIConfigReg {
> +    uint8_t wmask;
> +    uint8_t shift;

I am not sure I understand what shift is.
Document fields in this structure?

> +    pci_config_written_t callback;
> +};
>  
>  struct PCIDevice {
>      DeviceState qdev;
>      /* PCI config space */
>      uint8_t config[PCI_CONFIG_SPACE_SIZE];
> -
> -    /* Used to implement R/W bytes */
> -    uint8_t mask[PCI_CONFIG_SPACE_SIZE];
> +    struct PCIConfigReg config_regs[PCI_CONFIG_SPACE_SIZE];

I think that life will be much easier if you'll keep
separate arrays of masks and an array of callbacks.
Then two simple memset calls can initialize a range or registers
to a sane default (readonly, no side effects for head,
writeable, no side effects for the rest of config space),
and you'll only need to set up callbacks and masks for when
something special is needed.

-- 
MST

  reply	other threads:[~2009-05-25  7:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-20  2:25 [Qemu-devel] [PATCH 0/4] pci config space emulation clean up TAKE 4 Isaku Yamahata
2009-05-20  2:25 ` [Qemu-devel] [PATCH 1/4] vmware_vga: clean up Isaku Yamahata
2009-05-20  2:25 ` [Qemu-devel] [PATCH 2/4] qemu: make default_write_config use mask table Isaku Yamahata
2009-05-20  2:25 ` [Qemu-devel] [PATCH 3/4] pci: pci_default_config_write() clean up Isaku Yamahata
2009-05-25  7:09   ` Michael S. Tsirkin [this message]
2009-05-26  2:31     ` [Qemu-devel] " Isaku Yamahata
2009-05-20  2:25 ` [Qemu-devel] [PATCH 4/4] pci/config: convert pci configuration space handler to use callback Isaku Yamahata
2009-05-25  1:56 ` [Qemu-devel] [PATCH 0/4] pci config space emulation clean up TAKE 4 Isaku Yamahata

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=20090525070947.GA424@redhat.com \
    --to=mst@redhat.com \
    --cc=armbru@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --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).