[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 03/19] block/nvme: Introduce device/iommu 'page_size_min'
From: |
Auger Eric |
Subject: |
Re: [PATCH v2 03/19] block/nvme: Introduce device/iommu 'page_size_min' variables |
Date: |
Mon, 26 Oct 2020 18:38:42 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
Hi Philippe,
On 10/26/20 11:54 AM, Philippe Mathieu-Daudé wrote:
> Introduce device/iommu 'page_size_min' variables to make
> the code clearer.
I am unclear how much the device and the iommu page size must equal. For
instance, in [RFC 0/5] NVMe passthrough: Support 64kB page host, I have
a 64kB host page and an MPS set to 4kB.
Thanks
Eric
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> block/nvme.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/block/nvme.c b/block/nvme.c
> index aa290996679..5abd7257cac 100644
> --- a/block/nvme.c
> +++ b/block/nvme.c
> @@ -690,6 +690,8 @@ static int nvme_init(BlockDriverState *bs, const char
> *device, int namespace,
> uint64_t deadline, now;
> Error *local_err = NULL;
> volatile NvmeBar *regs = NULL;
> + size_t device_page_size_min;
> + size_t iommu_page_size_min = 4096;
>
> qemu_co_mutex_init(&s->dma_map_lock);
> qemu_co_queue_init(&s->dma_flush_queue);
> @@ -724,7 +726,8 @@ static int nvme_init(BlockDriverState *bs, const char
> *device, int namespace,
> goto out;
> }
>
> - s->page_size = MAX(4096, 1u << (12 + NVME_CAP_MPSMIN(cap)));
> + device_page_size_min = 1u << (12 + NVME_CAP_MPSMIN(cap));
> + s->page_size = MAX(iommu_page_size_min, device_page_size_min);
> s->doorbell_scale = (4 << NVME_CAP_DSTRD(cap)) / sizeof(uint32_t);
> bs->bl.opt_mem_alignment = s->page_size;
> bs->bl.request_alignment = s->page_size;
>
- [PATCH v2 00/19] util/vfio-helpers: Allow using multiple MSIX IRQs, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 01/19] block/nvme: Correct minimum device page size, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 02/19] block/nvme: Set request_alignment at initialization, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 03/19] block/nvme: Introduce device/iommu 'page_size_min' variables, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 04/19] block/nvme: Trace controller capabilities, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 05/19] util/vfio-helpers: Improve reporting unsupported IOMMU type, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 07/19] util/vfio-helpers: Trace PCI BAR region info, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 06/19] util/vfio-helpers: Trace PCI I/O config accesses, Philippe Mathieu-Daudé, 2020/10/26
- [PATCH v2 08/19] util/vfio-helpers: Trace where BARs are mapped, Philippe Mathieu-Daudé, 2020/10/26