All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] physical memory address in guest (from his point of view)
@ 2015-04-24  8:46 Catalin Vasile
  2015-04-24  9:05 ` Paolo Bonzini
  2015-04-24  9:36 ` Peter Maydell
  0 siblings, 2 replies; 5+ messages in thread
From: Catalin Vasile @ 2015-04-24  8:46 UTC (permalink / raw
  To: qemu-devel

Does a physical memory address in a guest points to the same memory as qemu?
For example: if I have a physical pointer 0x34 in the guest, does it
point to the same location that qemu points with 0x34 address?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] physical memory address in guest (from his point of view)
  2015-04-24  8:46 [Qemu-devel] physical memory address in guest (from his point of view) Catalin Vasile
@ 2015-04-24  9:05 ` Paolo Bonzini
  2015-04-24 10:22   ` Catalin Vasile
  2015-04-24  9:36 ` Peter Maydell
  1 sibling, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2015-04-24  9:05 UTC (permalink / raw
  To: Catalin Vasile, qemu-devel



On 24/04/2015 10:46, Catalin Vasile wrote:
> Does a physical memory address in a guest points to the same memory as qemu?
> For example: if I have a physical pointer 0x34 in the guest, does it
> point to the same location that qemu points with 0x34 address?

No.  QEMU converts guest pointers (which are just uint64_t) to host
pointers using address_space_map/address_space_unmap.

Paolo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] physical memory address in guest (from his point of view)
  2015-04-24  8:46 [Qemu-devel] physical memory address in guest (from his point of view) Catalin Vasile
  2015-04-24  9:05 ` Paolo Bonzini
@ 2015-04-24  9:36 ` Peter Maydell
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2015-04-24  9:36 UTC (permalink / raw
  To: Catalin Vasile; +Cc: QEMU Developers

On 24 April 2015 at 09:46, Catalin Vasile <catalinvasile92@gmail.com> wrote:
> Does a physical memory address in a guest points to the same memory as qemu?
> For example: if I have a physical pointer 0x34 in the guest, does it
> point to the same location that qemu points with 0x34 address?

As an additional point to Paolo's answer, consider that:
 (1) a guest physical address alone may not be sufficient to identify
the host memory/device [consider ARM TrustZone where you also need
to know the Secure/NonSecure attribute]
 (2) a guest physical address may not map to anything on the host
 (3) a guest physical address may map to an emulated device, not
host RAM
 (4) multiple guest physical addresses may map to a single host
RAM address [if the RAM is aliased to multiple physaddrs]
 (5) host memory that is part of the machine model may not be
mapped to any guest physical address [consider a device with a
block of "ram" accessed via set-address/write-data commands, or
a PCI device with a BAR that has been temporarily unmapped by the guest]

There are a lot of odd cases that the memory system infrastructure
deals with for you...

-- PMM

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] physical memory address in guest (from his point of view)
  2015-04-24  9:05 ` Paolo Bonzini
@ 2015-04-24 10:22   ` Catalin Vasile
  2015-04-24 10:52     ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: Catalin Vasile @ 2015-04-24 10:22 UTC (permalink / raw
  To: Paolo Bonzini; +Cc: qemu-devel

On Fri, Apr 24, 2015 at 12:05 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 24/04/2015 10:46, Catalin Vasile wrote:
>> Does a physical memory address in a guest points to the same memory as qemu?
>> For example: if I have a physical pointer 0x34 in the guest, does it
>> point to the same location that qemu points with 0x34 address?
>
> No.  QEMU converts guest pointers (which are just uint64_t) to host
> pointers using address_space_map/address_space_unmap.
>
> Paolo
That being said. Does a message that passes from guest to a backend
need to pass through qemu everytime?
I'm trying to understand how virtio virtqueues work. Namely I'm trying
to pass as data itself a pointer in which the backend will write,
namely use copy_to_user() if the backend is a kernel module.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] physical memory address in guest (from his point of view)
  2015-04-24 10:22   ` Catalin Vasile
@ 2015-04-24 10:52     ` Paolo Bonzini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2015-04-24 10:52 UTC (permalink / raw
  To: Catalin Vasile; +Cc: qemu-devel



On 24/04/2015 12:22, Catalin Vasile wrote:
> > > Does a physical memory address in a guest points to the same memory as qemu?
> > > For example: if I have a physical pointer 0x34 in the guest, does it
> > > point to the same location that qemu points with 0x34 address?
> >
> > No.  QEMU converts guest pointers (which are just uint64_t) to host
> > pointers using address_space_map/address_space_unmap.
>
> That being said. Does a message that passes from guest to a backend
> need to pass through qemu everytime?
> I'm trying to understand how virtio virtqueues work. Namely I'm trying
> to pass as data itself a pointer in which the backend will write,
> namely use copy_to_user() if the backend is a kernel module.

vhost provides the infrastructure to do the same thing as
address_space_map/unmap.

Passing pointers inside a data buffer would be very weird for virtio
devices.  The way you do it typically, is that you pass a one descriptor
corresponding to a request or response header, and one or more
descriptors for the data buffers.

Paolo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-04-24 10:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-24  8:46 [Qemu-devel] physical memory address in guest (from his point of view) Catalin Vasile
2015-04-24  9:05 ` Paolo Bonzini
2015-04-24 10:22   ` Catalin Vasile
2015-04-24 10:52     ` Paolo Bonzini
2015-04-24  9:36 ` Peter Maydell

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.