All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] s390x: initialize virtio dev region
Date: Fri, 11 Nov 2011 17:24:55 +0100	[thread overview]
Message-ID: <4EBD4C57.1080709@suse.de> (raw)
In-Reply-To: <CAFEAcA8DMx-e5iBqiC3eLu87TNG8hON3QrZ3t0-VCJd0U18Qgg@mail.gmail.com>

On 11/11/2011 05:11 PM, Peter Maydell wrote:
> On 11 November 2011 15:59, Alexander Graf<agraf@suse.de>  wrote:
>> This is the machine init function. The s390 virtio machine's ram layout is
>> defined to be exactly as I posted in the previous post. So there won't be
>> any ram starts at != 0 or multiple mappings :).
> That's the layout of the RAM in target_phys_addr_t space.
> The layout of the ram in ram_addr_t space is not guaranteed
> to be the same, it just happens to be in this case.
>
>>>> On 10.11.2011, at 02:36, Peter Maydell wrote:
>>> In summary, either:
>>> (1) you need to ask the memory region for its ram_addr_t
>>> [there doesn't seem to be an API for this at the moment],
>>> do arithmetic on ram_addr_t's and use qemu_get_ram_ptr() to
>>> get a host pointer corresponding to that ram_addr_t
>>> or (2) you need to do your arithmetic in target_phys_addr_t's
>>> (and then you can say your RAM starts at physaddr 0, which
>>> is guaranteed, rather than at ram_addr_t 0, which isn't)
>>> and use cpu_physical_memory_map/unmap().
>> I still don't get it. What I want is:
>>
>>   for (i = ram_size; i<  my_ram_size; i++)
>>     stb_phys(env, i, 0);
>>
>> cpu_physical_memory_map gives me a pointer to the memory region between
>> ram_size and my_ram_size. I memset(0) it. I don't see how I could possibly
>> have different offsets anywhere. If cpu_physical_memory_map would take
>> anything different than physical address, a lot of assumptions in QEMU code
>> would break.
> Yes, so that's option (2) and you need to be using a target_phys_addr_t.

But ram_size is ram_addr_t and is the ram size that I have available to 
use, so it's exactly the address that I want. I don't see your point. 
Should go jump through random useless hoops of doing

   target_phys_addr_t ram_end = ram_size;

just because there are some subtile semantic differences between the two 
variables? They're integers at the end of the day. Both of them.


Alex

  reply	other threads:[~2011-11-11 16:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10  1:19 [Qemu-devel] [PATCH] s390x: initialize virtio dev region Alexander Graf
2011-11-10  1:36 ` Peter Maydell
2011-11-10  1:45   ` Alexander Graf
2011-11-10  2:19     ` Peter Maydell
2011-11-11 15:59       ` Alexander Graf
2011-11-11 16:11         ` Peter Maydell
2011-11-11 16:24           ` Alexander Graf [this message]
2011-11-11 16:44             ` Peter Maydell
2011-11-11 16:46               ` Alexander Graf
2011-11-11 17:38               ` Alexander Graf
2011-11-11 17:40               ` Alexander Graf
2011-11-11 18:01                 ` Peter Maydell
2011-11-11 22:43                 ` Andreas Färber

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=4EBD4C57.1080709@suse.de \
    --to=agraf@suse.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.