qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: patches@linaro.org, qemu-devel@nongnu.org, Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] hw/pxa2xx.c: Fix handling of pxa2xx_i2c variable offset within region
Date: Fri, 09 Mar 2012 00:48:50 +0100	[thread overview]
Message-ID: <4F594562.3030001@suse.de> (raw)
In-Reply-To: <1331215088-28816-1-git-send-email-peter.maydell@linaro.org>

Am 08.03.2012 14:58, schrieb Peter Maydell:
> The pxa2xx I2C controller can be at an arbitrary offset within its
> region (this is used because one of the controllers starts at offset
> 0x1600 into an 0x10000 sized region). The previous implementation of this
> included an adjustment which worked around the fact that memory region
> read/write functions were passed an offset from the start of a page
> rather than from the start of the region. Since commit 5312bd8b3
> offsets are now from the start of the region and so we were applying
> an incorrect adjustment, resulting in warnings like
> "pxa2xx_i2c_read: Bad register 0xffffff90".
> 
> Retain the offset handling but remove the adjustment to the page
> boundary.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  hw/pxa2xx.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c
> index 1ab2701..d1efef4 100644
> --- a/hw/pxa2xx.c
> +++ b/hw/pxa2xx.c
> @@ -1507,8 +1507,7 @@ PXA2xxI2CState *pxa2xx_i2c_init(target_phys_addr_t base,
>  
>      i2c_dev = sysbus_from_qdev(qdev_create(NULL, "pxa2xx_i2c"));
>      qdev_prop_set_uint32(&i2c_dev->qdev, "size", region_size + 1);
> -    qdev_prop_set_uint32(&i2c_dev->qdev, "offset",
> -            base - (base & (~region_size) & TARGET_PAGE_MASK));
> +    qdev_prop_set_uint32(&i2c_dev->qdev, "offset", base & region_size);
>  
>      qdev_init_nofail(&i2c_dev->qdev);
>  

Sorry, but I don't immediately follow why this is correct. Thus someone
else will, too.

Are we talking about an offset of a to be added subregion or an offset
used within read/write ops? My understanding from previous threads was
the latter.

Judging by the "size" property it seems region_size is a misnomer and is
rather the size minus one, i.e. a mask to offset within an enclosing
region of size region_size + 1? An offset of "base & region_size" surely
reads wrong, especially when mentioning region size 0x10000.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2012-03-08 23:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08 13:58 [Qemu-devel] [PATCH] hw/pxa2xx.c: Fix handling of pxa2xx_i2c variable offset within region Peter Maydell
2012-03-08 23:48 ` Andreas Färber [this message]
2012-03-09  8:26   ` Peter Maydell
2012-03-14 12:45     ` Peter Maydell
2012-03-14 13:13       ` Andreas Färber
2012-03-14 13:56         ` Peter Maydell

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=4F594562.3030001@suse.de \
    --to=afaerber@suse.de \
    --cc=avi@redhat.com \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --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).