qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Alexander Graf <agraf@suse.de>
Cc: qemu-devel@nongnu.org,
	Bharat Bhushan <Bharat.Bhushan@freescale.com>,
	qemu-ppc@nongnu.org, Avi Kivity <avi@redhat.com>,
	Bharat Bhushan <r65777@freescale.com>
Subject: Re: [Qemu-devel] [PATCH 2/3] e500: Adding CCSR memory region
Date: Tue, 09 Oct 2012 19:23:12 +0200	[thread overview]
Message-ID: <50745D80.2030004@suse.de> (raw)
In-Reply-To: <597774F2-1995-4CCF-8518-4F9509CD4DEF@suse.de>

Am 08.10.2012 20:58, schrieb Alexander Graf:
> 
> On 08.10.2012, at 19:21, Andreas Färber wrote:
> 
>> Am 08.10.2012 18:46, schrieb Bharat Bhushan:
>>> +    s = sysbus_from_qdev(dev);
>>
>> s = SYS_BUS_DEVICE(dev);
> 
> Mind to explain why? The rest of the code uses the above helper :).

SYS_BUS_DEVICE() is the QOM cast macro, relying on binary struct layout.

sysbus_from_qdev() is an old qdev helper, relying on container_of() and
field naming.

I'm lobbying for using the new constructs in new code. You can argue of
course that SysBus will go away some day so it doesn't matter much here.
But we had issues with PCIHostState not adhering to QOM layout
requirements (e.g., pSeries), so using the cast consistently helps to
avoid/detect such issues.

>>> +    memory_region_add_subregion(ccsr, MPC8544_PCI_REGS_OFFSET, s->mmio[0].memory);
>>
>> ... I wonder if fiddling with SysBus MMIO is a good idea.
>> s->mmio[0].addr is not getting assigned this way, which is checked as
>> condition for deleting the subregion. But sysbus_mmio_map() only adds to
>> / deletes from get_system_memory().
>> The alternative would be using a custom field rather than the
>> SysBus-internal one. Avi/Alex?
> 
> I honestly don't mind either way. We could
> 
>   a) add a new sysbus helper for maps in memory region containers
>   b) not use sysbus at all
>   c) do it this way
> 
> Anything else wouldn't improve the situation. I really don't care which way we go. To me, c) is fine.

b) is not that easily possible for the PHB, since we still haven't seen
a new round of i440fx patches (PCIHostState is based on SysBusDevice, so
all PHBs would need to get converted at once).

I'd also be in favor of c) with Avi's suggestion of using the accessor
function to obtain the MemoryRegion* (data caging).

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-10-09 17:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-08 16:46 [Qemu-devel] [PATCH 0/3] e500: creating CCSR region and registering bar0 Bharat Bhushan
2012-10-08 16:46 ` [Qemu-devel] [PATCH 1/3] e500: Fix serial initialization Bharat Bhushan
2012-10-08 17:00   ` Andreas Färber
2012-10-08 18:54   ` Alexander Graf
2012-10-08 16:46 ` [Qemu-devel] [PATCH 2/3] e500: Adding CCSR memory region Bharat Bhushan
2012-10-08 17:21   ` Andreas Färber
2012-10-08 18:58     ` Alexander Graf
2012-10-09 17:23       ` Andreas Färber [this message]
2012-10-09  9:04     ` Avi Kivity
2012-10-09 16:45       ` Bhushan Bharat-R65777
2012-10-09 16:53         ` Avi Kivity
2012-10-09 16:57           ` Bhushan Bharat-R65777
2012-10-09 17:01             ` Avi Kivity
2012-10-09 17:05               ` Bhushan Bharat-R65777
2012-10-08 17:26   ` Andreas Färber
2012-10-08 16:46 ` [Qemu-devel] [PATCH 3/3] Adding BAR0 for e500 PCI controller Bharat Bhushan
2012-10-08 18:00   ` Andreas Färber
2012-10-08 19:04     ` Alexander Graf
2012-10-08 20:23       ` Scott Wood
2012-10-09  1:55         ` Bhushan Bharat-R65777

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=50745D80.2030004@suse.de \
    --to=afaerber@suse.de \
    --cc=Bharat.Bhushan@freescale.com \
    --cc=agraf@suse.de \
    --cc=avi@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=r65777@freescale.com \
    /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).