qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Brian Wheeler <bdwheele@indiana.edu>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3] Two-Level IOPort Lookup
Date: Mon, 13 Apr 2009 10:57:42 -0400	[thread overview]
Message-ID: <1239634662.27750.33.camel@nibbler.dlib.indiana.edu> (raw)
In-Reply-To: <Pine.LNX.4.64.0904131834590.2693@linmac.oyster.ru>

On Mon, 2009-04-13 at 18:40 +0400, malc wrote:
> On Mon, 13 Apr 2009, Brian Wheeler wrote:
> 
> > I've fixed a few things:
> > 	* my pointer arithmetic was gross looking, so I fixed it
> > 	* added an allocated page count for stats when debugging
> > 
> > 
> > On my platform (x86-64) the in-tree implementation allocates 3.5M for
> > the PC target.  With this implementation the PC target consumes 2K of
> > pointer table + 256K of malloc'd memory.
> > 
> > For the Alpha target, statically allocating all 24-bits worth of ioport
> > tables is about 1G of ram.  With this patch, it uses 32K for the pointer
> > table and 512K of malloc'd memory
> > 
> > Is there anything else I need to look at before this patch is worthy of
> > inclusion?
> > 
> > 
> > 
> > Signed-off-by: Brian Wheeler <bdwheele@indiana.edu>
> > 
> > Index: vl.c
> > ===================================================================
> > --- vl.c	(revision 7097)
> > +++ vl.c	(working copy)
> > @@ -168,8 +168,8 @@
> >  //#define DEBUG_IOPORT
> >  //#define DEBUG_NET
> >  //#define DEBUG_SLIRP
> > +//#define DEBUG_IOPORT_FIND
> >  
> > -
> >  #ifdef DEBUG_IOPORT
> >  #  define LOG_IOPORT(...) qemu_log_mask(CPU_LOG_IOPORT, ## __VA_ARGS__)
> >  #else
> > @@ -184,14 +184,31 @@
> >  /* Max number of bluetooth switches on the commandline.  */
> >  #define MAX_BT_CMDLINE 10
> >  
> > -/* XXX: use a two level table to limit memory usage */
> > -#define MAX_IOPORTS 65536
> > -
> >  const char *bios_dir = CONFIG_QEMU_SHAREDIR;
> >  const char *bios_name = NULL;
> > -static void *ioport_opaque[MAX_IOPORTS];
> > -static IOPortReadFunc *ioport_read_table[3][MAX_IOPORTS];
> > -static IOPortWriteFunc *ioport_write_table[3][MAX_IOPORTS];
> > +
> > +struct ioport {
> > +    void *opaque;
> > +    IOPortReadFunc *read[3];
> > +    IOPortWriteFunc *write[3];
> > +    void *pad;
> > +};
> > +typedef struct ioport ioport_t;
> 
> Please do not use _t.
> 

Ah, I missed that part in the CODING_STYLE document.  I've now called it
IOPort



> [..snip..]
> 
> > +static inline ioport_t *ioport_find(uint32_t address, int allocate) 
> > +{
> > +    uint32_t page = (address & IOPORT_PAGEMASK) >> IOPORT_PAGEBITS;
> > +    uint32_t entry = address & IOPORT_ENTRYMASK;
> > +#ifdef DEBUG_IOPORT_FIND
> > +    static int page_count = 0;
> > +    if (address >= (1<<IOPORT_MAXBITS)) {
> > +	hw_error("Maximum port # for this architecture is %d.  "
>                                                               ^ extra space?
> 
> [..snip..]
> 

Not really, since the next line is a continuation of the string (to meet
the 80-char-wide rule) and that ends a sentence.



> >      for(i = start; i < start + length; i += size) {
> > -        ioport_read_table[bsize][i] = func;
> > -        if (ioport_opaque[i] != NULL && ioport_opaque[i] != opaque)
> > +	ioport_t *p = ioport_find(i, 1);
> 
> Indentation appears messed up.
> 
> [..snip..]
> 

Sigh, yeah.  


A new patch is forthcoming.

Brian

      reply	other threads:[~2009-04-13 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-13 14:11 [Qemu-devel] [PATCH v3] Two-Level IOPort Lookup Brian Wheeler
2009-04-13 14:40 ` malc
2009-04-13 14:57   ` Brian Wheeler [this message]

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=1239634662.27750.33.camel@nibbler.dlib.indiana.edu \
    --to=bdwheele@indiana.edu \
    --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).