From: Paolo Bonzini <pbonzini@redhat.com>
To: "Ефимов Василий" <real@ispras.ru>, qemu-devel@nongnu.org
Cc: Kirill Batuzov <batuzovk@ispras.ru>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/3] PAM: make PAM emulation closer to documentation
Date: Thu, 16 Jul 2015 13:10:15 +0200 [thread overview]
Message-ID: <55A79117.2020300@redhat.com> (raw)
In-Reply-To: <55A78C99.5040504@ispras.ru>
On 16/07/2015 12:51, Ефимов Василий wrote:
> The rest of code looks up destination or source region or child region
> offset in memory sub-tree which root is PCI or RAM region provided on
> PAM creation. We cannon use common address_space_translate because it
> searches from address space root and will return current PAM region.
> To summarize, I suggest to move the code to exec.c. It is generic
> enough.
All these mechanism are extremely low level. They are encapsulated
within exec.c, and copying code to pam.c is not a good idea because you
already have all the AddressSpaces and RAM MemoryRegions you need.
>> Could you use an IOMMU memory region instead? Then a single region can
>> be used to implement all four modes, and you don't hit the "trying to
>> execute code outside RAM or RAM".
> Did you mean MemoryRegion.iommu_ops ? The feature does not allow to
> change destination memory region.
It does. You're right about this:
> exec.c: address_space_translate_for_iotlb:
> assert(!section->mr->iommu_ops);
... but an IOMMU region is not needed, and I think you can do everything
without touching exec.c at all.
+ /* Read from RAM and write to PCI */
+ memory_region_init_io(&pam->region[1], OBJECT(dev), &pam_ops, pam,
+ "pam-r-ram-w-pci", size);
This can be done with memory_region_set_readonly on the RAM region. You
need to set mr->ops in order to point to pam_ops; for a first proof of
concept you can just set the field directly.
Writes to the PCI memory space can use the PCI address space, with
address_space_st*.
+ /* Read from PCI and write to RAM */
+ memory_region_init_io(&pam->region[2], OBJECT(dev), &pam_ops, pam,
+ "pam-r-pci-w-ram", size);
Here you cannot run code from ROM, so it can be a pure MMIO region.
Reads can use address_space_ld*, while writes can use
memory_region_get_ram_ptr.
Paolo
next prev parent reply other threads:[~2015-07-16 11:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-16 8:35 [Qemu-devel] [PATCH 0/3] PAM emulation improvement Efimov Vasily
2015-07-16 8:35 ` [Qemu-devel] [PATCH 1/3] memory: make function invalidate_and_set_dirty public Efimov Vasily
2015-07-16 8:35 ` [Qemu-devel] [PATCH 2/3] memory: make function memory_access_is_direct public Efimov Vasily
2015-07-16 8:35 ` [Qemu-devel] [PATCH 3/3] PAM: make PAM emulation closer to documentation Efimov Vasily
2015-07-16 9:05 ` Paolo Bonzini
2015-07-16 10:51 ` Ефимов Василий
2015-07-16 11:10 ` Paolo Bonzini [this message]
2015-07-16 14:41 ` Ефимов Василий
2015-07-16 17:52 ` Paolo Bonzini
2015-07-17 9:50 ` Ефимов Василий
2015-07-17 10:10 ` Paolo Bonzini
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=55A79117.2020300@redhat.com \
--to=pbonzini@redhat.com \
--cc=batuzovk@ispras.ru \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=real@ispras.ru \
/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).