From nobody Mon Nov 17 12:05:02 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1603807078; cv=none; d=zohomail.com; s=zohoarc; b=E+PSBxB1Qt9m52/TIqWy73Hhf7lG6IDhVf1O3uxPTJflAofC4Wf0MvuJnO/TaZDrWwTbhMpanwPingzRte7Jce9cZnF7vZTt+UAznb/1CJScMWIwfeqyKzOCBBnXg2d8svc92uMU6A47v7WPaaEYPwXRLOl1A6okGSTuVNYYw6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603807078; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=NAlvgmTt63VVhwmPwsffm7y53PiDjihV7pQ2MmamgE4=; b=e3k/8dCFuV53qk6xu2p+o9EMxcxTCGIadPutFytZTa0fDtRxwMk6xBrZmZfcbqJm302c7rO/bGStshcF5szgQ6XaSRXsWKMZ9d8toDmEICt95RvP90Hk6WNEwxRORap9nUkYe3cEePzHW1YdXaEmBpYyH8Z4PCqGpHMBUYnxeek= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1603807078131297.21052542698567; Tue, 27 Oct 2020 06:57:58 -0700 (PDT) Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-270--oCOj3MDMDy4MqRDMmYxgg-1; Tue, 27 Oct 2020 09:57:55 -0400 Received: by mail-ej1-f72.google.com with SMTP id z8so942329ejw.3 for ; Tue, 27 Oct 2020 06:57:55 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id i5sm1086357ejs.121.2020.10.27.06.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NAlvgmTt63VVhwmPwsffm7y53PiDjihV7pQ2MmamgE4=; b=C1op0+tGH1Ki4Z5YcRgXi8B3tJVZEoxB4pmPt2vIluFsRsGYDe4sRnXIYqWW8Iqs9jFYdU DFMnS5Qjh4jPZhNnypzybRzgk80leIhPgwzrwqiOSr9udEcqID2mmiMIqCEqWYTo3YI8+x /cFWYZei6/0/4kD+8v07+Hox4SrMwCU= X-MC-Unique: -oCOj3MDMDy4MqRDMmYxgg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NAlvgmTt63VVhwmPwsffm7y53PiDjihV7pQ2MmamgE4=; b=FJoszm5XA8ygjY4BwNbm+3FX1pPqO2GOD8ufREl3l/ZPRVgp0eqC8KZmEgi8tYEEqS HWD5hnxyGg7L9cr8tfNxBtfhzDRxkZSrqrAnCjx8Q+PofiujSEpfu7iNMMyC/FWARWoF W5rNHXyOLIJLV0Gg8tZXuJw3l+pexebKRs36OkxbaUF39mcyqoLgRVYibYJ0OPAFbeyF xWOHTxC7UhsYgtPsDWZRjSfh7IdInIXW24cPrcqAn4VngvL/hAK39cslxVUDKUVNDfFs Ej+C/UGvmMg5xOJsTwH1ujgxrVuPXl1E4qJvVmTaA6O5Q3pJ/+lRqYncFvBmqA6DZLat 8HoA== X-Gm-Message-State: AOAM532SKg1L8gMKvcJSYAfmdf58fdraBcuYdtw+hmY4ZDQEtQgrH3t1 B+EaQVtZb0IS8sRrSloBH3h5L+RJ7/EKGbsfV3aSHA2qaKVQfK+2mIHQEVeuxABp9javYmfyq7l /TtjOjmKiU699DA== X-Received: by 2002:a17:906:b0d7:: with SMTP id bk23mr2685809ejb.103.1603807074318; Tue, 27 Oct 2020 06:57:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyINoOPF8wNVWokkj+IKWIMIktCGQC5/gJ7yK7HdRpYJqPJ0+waXXQhdA3r2TV4/fs/s5Gn6A== X-Received: by 2002:a17:906:b0d7:: with SMTP id bk23mr2685783ejb.103.1603807074086; Tue, 27 Oct 2020 06:57:54 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Klaus Jensen , qemu-block@nongnu.org, Fam Zheng , Keith Busch , Eric Auger , Stefan Hajnoczi , Kevin Wolf , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 23/25] block/nvme: Change size and alignment of prp_list_pages Date: Tue, 27 Oct 2020 14:55:45 +0100 Message-Id: <20201027135547.374946-24-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027135547.374946-1-philmd@redhat.com> References: <20201027135547.374946-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Eric Auger In preparation of 64kB host page support, let's change the size and alignment of the prp_list_pages so that the VFIO DMA MAP succeeds with 64kB host page size. We align on the host page size. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- block/nvme.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 941f96b4c92..e3626045565 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -214,6 +214,7 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeSt= ate *s, int i, r; NVMeQueuePair *q; uint64_t prp_list_iova; + size_t bytes; =20 q =3D g_try_new0(NVMeQueuePair, 1); if (!q) { @@ -221,19 +222,19 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMe= State *s, } trace_nvme_create_queue_pair(idx, q, size, aio_context, event_notifier_get_fd(s->irq_notifier)); - q->prp_list_pages =3D qemu_try_memalign(s->page_size, - s->page_size * NVME_NUM_REQS); + bytes =3D QEMU_ALIGN_UP(s->page_size * NVME_NUM_REQS, + qemu_real_host_page_size); + q->prp_list_pages =3D qemu_try_memalign(qemu_real_host_page_size, byte= s); if (!q->prp_list_pages) { goto fail; } - memset(q->prp_list_pages, 0, s->page_size * NVME_NUM_REQS); + memset(q->prp_list_pages, 0, bytes); qemu_mutex_init(&q->lock); q->s =3D s; q->index =3D idx; qemu_co_queue_init(&q->free_req_queue); q->completion_bh =3D aio_bh_new(aio_context, nvme_process_completion_b= h, q); - r =3D qemu_vfio_dma_map(s->vfio, q->prp_list_pages, - s->page_size * NVME_NUM_REQS, + r =3D qemu_vfio_dma_map(s->vfio, q->prp_list_pages, bytes, false, &prp_list_iova); if (r) { goto fail; --=20 2.26.2