qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: agraf@suse.de
Cc: aik@ozlabs.ru, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org,
	qemu-ppc@nongnu.org, afaerber@suse.de,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PATCH 02/33] spapr_iommu: Disable in-kernel IOMMU tables for >4GB windows
Date: Thu,  7 May 2015 15:33:28 +1000	[thread overview]
Message-ID: <1430976839-13944-3-git-send-email-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <1430976839-13944-1-git-send-email-david@gibson.dropbear.id.au>

From: Alexey Kardashevskiy <aik@ozlabs.ru>

The existing KVM_CREATE_SPAPR_TCE ioctl only support 4G windows max as
the window size parameter to the kernel ioctl() is 32-bit so
there's no way of expressing a TCE window > 4GB.

We are going to add huge DMA windows support so this will create small
window and unexpectedly fail later.

This disables KVM_CREATE_SPAPR_TCE for windows bigger that 4GB.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc/spapr_iommu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index f3990fd..e19bf89 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -126,11 +126,11 @@ static MemoryRegionIOMMUOps spapr_iommu_ops = {
 static int spapr_tce_table_realize(DeviceState *dev)
 {
     sPAPRTCETable *tcet = SPAPR_TCE_TABLE(dev);
+    uint64_t window_size = (uint64_t)tcet->nb_table << tcet->page_shift;
 
-    if (kvm_enabled()) {
+    if (kvm_enabled() && !(window_size >> 32)) {
         tcet->table = kvmppc_create_spapr_tce(tcet->liobn,
-                                              tcet->nb_table <<
-                                              tcet->page_shift,
+                                              window_size,
                                               &tcet->fd,
                                               tcet->vfio_accel);
     }
-- 
2.1.0

  parent reply	other threads:[~2015-05-07  5:34 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-07  5:33 [Qemu-devel] [PATCH 00/33] Accumulated -machine pseries patches 2015-05-07 David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 01/33] spapr_pci: Fix unsafe signed/unsigned comparisons David Gibson
2015-05-07  5:33 ` David Gibson [this message]
2015-05-07  5:33 ` [Qemu-devel] [PATCH 03/33] spapr_iommu: Make H_PUT_TCE_INDIRECT endian-safe David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 04/33] spapr_pci: Introduce a liobn number generating macros David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 05/33] spapr_vio: " David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 06/33] spapr_pci: Define default DMA window size as a macro David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 07/33] spapr_iommu: Add separate trace points for PCI DMA operations David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 08/33] spapr_pci: Make find_phb()/find_dev() public David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 09/33] spapr_iommu: Make spapr_tce_find_by_liobn() public David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 10/33] spapr_pci: Rework device-tree rendering David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 11/33] spapr_iommu: Give unique QOM name to TCE table David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 12/33] hw/ppc/spapr_iommu: Fix the check for invalid upper bits in liobn David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 13/33] pseries: Add pseries-2.4 machine type David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 14/33] hw/ppc/spapr: Fix error message when firmware could not be loaded David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 15/33] hw/ppc/spapr: Use error_report() instead of hw_error() David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 16/33] docs: add sPAPR hotplug/dynamic-reconfiguration documentation David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 17/33] spapr_drc: initial implementation of sPAPRDRConnector device David Gibson
2015-05-07 22:39   ` Alexander Graf
2015-05-08  0:01     ` David Gibson
2015-05-11 21:02       ` Alexander Graf
2015-05-07  5:33 ` [Qemu-devel] [PATCH 18/33] spapr_rtas: add get/set-power-level RTAS interfaces David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 19/33] spapr_rtas: add set-indicator RTAS interface David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 20/33] spapr_rtas: add get-sensor-state " David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 21/33] spapr: add rtas_st_buffer_direct() helper David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 22/33] spapr_rtas: add ibm, configure-connector RTAS interface David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 23/33] spapr_events: re-use EPOW event infrastructure for hotplug events David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 24/33] spapr_events: event-scan RTAS interface David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 25/33] spapr_drc: add spapr_drc_populate_dt() David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 26/33] spapr_pci: add dynamic-reconfiguration option for spapr-pci-host-bridge David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 27/33] spapr_pci: create DRConnectors for each PCI slot during PHB realize David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 28/33] pci: make pci_bar useable outside pci.c David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 29/33] spapr_pci: enable basic hotplug operations David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 30/33] spapr_pci: emit hotplug add/remove events during hotplug David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 31/33] machine: add default_ram_size to machine class David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 32/33] spapr: override default ram size to 512MB David Gibson
2015-05-07  5:33 ` [Qemu-devel] [PATCH 33/33] pseries: Enable in-kernel H_LOGICAL_CI_{LOAD, STORE} implementations David Gibson
2015-05-07 22:24 ` [Qemu-devel] [PATCH 00/33] Accumulated -machine pseries patches 2015-05-07 Alexander Graf

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=1430976839-13944-3-git-send-email-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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 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).