From: "Michael S. Tsirkin" <mst@redhat.com>
To: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Cc: peter.maydell@linaro.org, kevin.tian@intel.com,
drjones@redhat.com, marc.zyngier@arm.com, tn@semihalf.com,
will.deacon@arm.com, qemu-devel@nongnu.org,
eric.auger@redhat.com, alex.williamson@redhat.com,
qemu-arm@nongnu.org, robin.murphy@arm.com,
christoffer.dall@linaro.org, eric.auger.pro@gmail.com
Subject: Re: [Qemu-arm] [RFC PATCH 1/2] target/arm/kvm: Translate the MSI doorbell in kvm_arch_fixup_msi_route
Date: Thu, 13 Jul 2017 19:10:38 +0300 [thread overview]
Message-ID: <20170713190931-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1499927922-32303-2-git-send-email-Bharat.Bhushan@nxp.com>
On Thu, Jul 13, 2017 at 12:08:41PM +0530, Bharat Bhushan wrote:
> Fix-up MSI address if it translate via virtual iommu.
> This code is based on http://patchwork.ozlabs.org/patch/785951/
>
> Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Links go dead with time. And following links
is hard on reviewers. Please copy the full description
tweaking as appropriate and attribute in commit log.
> ---
> target/arm/kvm.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index 4555468..eff7e8f 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -22,6 +22,9 @@
> #include "cpu.h"
> #include "internals.h"
> #include "hw/arm/arm.h"
> +#include "hw/pci/pci.h"
> +#include "hw/pci/msi.h"
> +#include "hw/virtio/virtio-iommu.h"
> #include "exec/memattrs.h"
> #include "exec/address-spaces.h"
> #include "hw/boards.h"
> @@ -611,6 +614,24 @@ int kvm_arm_vgic_probe(void)
> int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
> uint64_t address, uint32_t data, PCIDevice *dev)
> {
> + AddressSpace *as = pci_device_iommu_address_space(dev);
> + IOMMUTLBEntry entry;
> + IOMMUDevice *sdev;
> + VirtIOIOMMU *s;
> +
> + if (as == &address_space_memory) {
> + return 0;
> + }
> +
> + /* MSI doorbell address is translated by an IOMMU */
> + sdev = container_of(as, IOMMUDevice, as);
> + s = sdev->viommu;
> +
> + entry = s->iommu_ops.translate(&sdev->iommu_mr, address, IOMMU_WO);
> +
> + route->u.msi.address_lo = entry.translated_addr;
> + route->u.msi.address_hi = entry.translated_addr >> 32;
> +
> return 0;
> }
>
> --
> 1.9.3
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Cc: eric.auger@redhat.com, eric.auger.pro@gmail.com,
peter.maydell@linaro.org, alex.williamson@redhat.com,
qemu-arm@nongnu.org, qemu-devel@nongnu.org, wei@redhat.com,
kevin.tian@intel.com, marc.zyngier@arm.com, tn@semihalf.com,
will.deacon@arm.com, drjones@redhat.com, robin.murphy@arm.com,
christoffer.dall@linaro.org
Subject: Re: [Qemu-devel] [RFC PATCH 1/2] target/arm/kvm: Translate the MSI doorbell in kvm_arch_fixup_msi_route
Date: Thu, 13 Jul 2017 19:10:38 +0300 [thread overview]
Message-ID: <20170713190931-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1499927922-32303-2-git-send-email-Bharat.Bhushan@nxp.com>
On Thu, Jul 13, 2017 at 12:08:41PM +0530, Bharat Bhushan wrote:
> Fix-up MSI address if it translate via virtual iommu.
> This code is based on http://patchwork.ozlabs.org/patch/785951/
>
> Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Links go dead with time. And following links
is hard on reviewers. Please copy the full description
tweaking as appropriate and attribute in commit log.
> ---
> target/arm/kvm.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index 4555468..eff7e8f 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -22,6 +22,9 @@
> #include "cpu.h"
> #include "internals.h"
> #include "hw/arm/arm.h"
> +#include "hw/pci/pci.h"
> +#include "hw/pci/msi.h"
> +#include "hw/virtio/virtio-iommu.h"
> #include "exec/memattrs.h"
> #include "exec/address-spaces.h"
> #include "hw/boards.h"
> @@ -611,6 +614,24 @@ int kvm_arm_vgic_probe(void)
> int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
> uint64_t address, uint32_t data, PCIDevice *dev)
> {
> + AddressSpace *as = pci_device_iommu_address_space(dev);
> + IOMMUTLBEntry entry;
> + IOMMUDevice *sdev;
> + VirtIOIOMMU *s;
> +
> + if (as == &address_space_memory) {
> + return 0;
> + }
> +
> + /* MSI doorbell address is translated by an IOMMU */
> + sdev = container_of(as, IOMMUDevice, as);
> + s = sdev->viommu;
> +
> + entry = s->iommu_ops.translate(&sdev->iommu_mr, address, IOMMU_WO);
> +
> + route->u.msi.address_lo = entry.translated_addr;
> + route->u.msi.address_hi = entry.translated_addr >> 32;
> +
> return 0;
> }
>
> --
> 1.9.3
next prev parent reply other threads:[~2017-07-13 16:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-13 6:38 [Qemu-devel] [RFC PATCH 0/2] VFIO integration Bharat Bhushan
2017-07-13 6:38 ` Bharat Bhushan
2017-07-13 6:38 ` [Qemu-arm] [RFC PATCH 1/2] target/arm/kvm: Translate the MSI doorbell in kvm_arch_fixup_msi_route Bharat Bhushan
2017-07-13 6:38 ` [Qemu-devel] " Bharat Bhushan
2017-07-13 16:10 ` Michael S. Tsirkin [this message]
2017-07-13 16:10 ` Michael S. Tsirkin
2017-07-13 6:38 ` [Qemu-arm] [RFC PATCH 2/2] virtio-iommu: vfio integration with virtio-iommu Bharat Bhushan
2017-07-13 6:38 ` [Qemu-devel] " Bharat Bhushan
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=20170713190931-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=Bharat.Bhushan@nxp.com \
--cc=alex.williamson@redhat.com \
--cc=christoffer.dall@linaro.org \
--cc=drjones@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=eric.auger@redhat.com \
--cc=kevin.tian@intel.com \
--cc=marc.zyngier@arm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=robin.murphy@arm.com \
--cc=tn@semihalf.com \
--cc=will.deacon@arm.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 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.