From: Alexey Kardashevskiy <aik@ozlabs.ru> To: linuxppc-dev@lists.ozlabs.org Cc: David Gibson <david@gibson.dropbear.id.au>, kvm@vger.kernel.org, Alistair Popple <alistair@popple.id.au>, Alex Williamson <alex.williamson@redhat.com>, Oliver O'Halloran <oohall@gmail.com>, Alexey Kardashevskiy <aik@ozlabs.ru> Subject: [PATCH kernel RFC 4/4] vfio/spapr_tce: Advertise and allow a huge DMA windows at 4GB Date: Mon, 2 Dec 2019 12:59:53 +1100 Message-ID: <20191202015953.127902-5-aik@ozlabs.ru> (raw) In-Reply-To: <20191202015953.127902-1-aik@ozlabs.ru> So far the only option for a big 64big DMA window was a window located at 0x800.0000.0000.0000 (1<<59) which creates problems for devices supporting smaller DMA masks. This exploits a POWER9 PHB option to allow the second DMA window to map at 0 and advertises it with a 4GB offset to avoid overlap with the default 32bit window. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- This is an additional option and not inside vfio_iommu_spapr_tce_ddw_info as the new option gets a new flag and one would expect a new member in vfio_iommu_spapr_tce_info per a flag but can squash it into vfio_iommu_spapr_tce_ddw_info, should I? --- include/uapi/linux/vfio.h | 2 ++ drivers/vfio/vfio_iommu_spapr_tce.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h index 9e843a147ead..c7f89d47335a 100644 --- a/include/uapi/linux/vfio.h +++ b/include/uapi/linux/vfio.h @@ -831,9 +831,11 @@ struct vfio_iommu_spapr_tce_info { __u32 argsz; __u32 flags; #define VFIO_IOMMU_SPAPR_INFO_DDW (1 << 0) /* DDW supported */ +#define VFIO_IOMMU_SPAPR_INFO_DDW_START (1 << 1) /* DDW offset */ __u32 dma32_window_start; /* 32 bit window start (bytes) */ __u32 dma32_window_size; /* 32 bit window size (bytes) */ struct vfio_iommu_spapr_tce_ddw_info ddw; + __u64 dma64_window_start; }; #define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c index 26cef65b41e7..470008c3359f 100644 --- a/drivers/vfio/vfio_iommu_spapr_tce.c +++ b/drivers/vfio/vfio_iommu_spapr_tce.c @@ -691,7 +691,7 @@ static long tce_iommu_create_window(struct tce_container *container, container->tables[num] = tbl; /* Return start address assigned by platform in create_table() */ - *start_addr = tbl->it_offset << tbl->it_page_shift; + *start_addr = tbl->it_dmaoff << tbl->it_page_shift; return 0; @@ -842,7 +842,13 @@ static long tce_iommu_ioctl(void *iommu_data, info.ddw.levels = table_group->max_levels; } - ddwsz = offsetofend(struct vfio_iommu_spapr_tce_info, ddw); + ddwsz = offsetofend(struct vfio_iommu_spapr_tce_info, + dma64_window_start); + + if (info.argsz >= ddwsz) { + info.flags |= VFIO_IOMMU_SPAPR_INFO_DDW_START; + info.dma64_window_start = table_group->tce64_start; + } if (info.argsz >= ddwsz) minsz = ddwsz; -- 2.17.1
next prev parent reply index Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-02 1:59 [PATCH kernel RFC 0/4] powerpc/powenv/ioda: Allow huge DMA window " Alexey Kardashevskiy 2019-12-02 1:59 ` [PATCH kernel RFC 1/4] powerpc/powernv/ioda: Rework for " Alexey Kardashevskiy 2019-12-02 1:59 ` [PATCH kernel RFC 2/4] powerpc/powernv/ioda: Allow smaller TCE table levels Alexey Kardashevskiy 2019-12-02 1:59 ` [PATCH kernel RFC 3/4] powerpc/powernv/phb4: Add 4GB IOMMU bypass mode Alexey Kardashevskiy 2019-12-02 1:59 ` Alexey Kardashevskiy [this message] 2019-12-02 5:36 ` [PATCH kernel RFC 0/4] powerpc/powenv/ioda: Allow huge DMA window at 4GB Alistair Popple 2019-12-02 5:58 ` Alexey Kardashevskiy 2019-12-02 5:51 ` [PATCH kernel RFC 00/4] powerpc/powernv/ioda: Move TCE bypass base to PE Alexey Kardashevskiy 2020-01-10 4:18 ` [PATCH kernel RFC 0/4] powerpc/powenv/ioda: Allow huge DMA window at 4GB Alexey Kardashevskiy 2020-01-23 0:53 ` Alexey Kardashevskiy 2020-01-23 1:17 ` David Gibson 2020-01-23 8:42 ` Alexey Kardashevskiy
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=20191202015953.127902-5-aik@ozlabs.ru \ --to=aik@ozlabs.ru \ --cc=alex.williamson@redhat.com \ --cc=alistair@popple.id.au \ --cc=david@gibson.dropbear.id.au \ --cc=kvm@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=oohall@gmail.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
KVM Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/kvm/0 kvm/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 kvm kvm/ https://lore.kernel.org/kvm \ kvm@vger.kernel.org public-inbox-index kvm Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.kvm AGPL code for this site: git clone https://public-inbox.org/public-inbox.git