From nobody Mon Feb 9 08:56:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603964096; cv=none; d=zohomail.com; s=zohoarc; b=LXdJPZkeWp9BrhIoKoRLJPGkW+9mdMLnQ/UdEisJYCDobm0zQ19HUmhyHGabse+d/hdQPcXusHnzAnMO5B0U3feFu9ZDw8tycsUd+G/9BrRJqIPVSbTJCYlMrh7gPv+dTkt4BtbBuFAFXdcNYa74tQHFwltoeo6CE+BBNBHFkQo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964096; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=rWiNSG2LUOKYVBwx8cuVrYTSHgZcY9BMn/MdeeoAo/g=; b=CBQ8Cnjjw1v0aZLvXchzXf7p8CxvDRMCReyvdpYdLtz7tKInc0EnR0178i42UWFdJ43h5ZHc+w1eVAbezee+4hyfYhIY3KJkYkAB9BpvcRLc6TXytYPqG/2EDamO3XZZmfnnWQJFd1TRgfEGt8EtghcS2tD3hK+zJCWaZ/SpoZc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964096596803.6206432380054; Thu, 29 Oct 2020 02:34:56 -0700 (PDT) Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-567-m-Uks3AhMvaMsHooHReuwA-1; Thu, 29 Oct 2020 05:34:52 -0400 Received: by mail-ej1-f71.google.com with SMTP id z18so955134eji.1 for ; Thu, 29 Oct 2020 02:34:52 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id qp17sm1125194ejb.111.2020.10.29.02.34.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:34:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964094; 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=rWiNSG2LUOKYVBwx8cuVrYTSHgZcY9BMn/MdeeoAo/g=; b=X8n1Lwbk7az2OE3tML/C1l7Ccj19DhsgWfXMEOEyG+tSLPs8xXHNXbsoJzmhcl7sRYkzIX tjUShEgsSzW5tgojxDbTsbBmCfty68fkuoAk+Id5D/Va3iHp1AupPdva4y9tBWQkv0lAOM CRylvibtIYLfkNVmyuujEbJuTFTk10M= X-MC-Unique: m-Uks3AhMvaMsHooHReuwA-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=rWiNSG2LUOKYVBwx8cuVrYTSHgZcY9BMn/MdeeoAo/g=; b=j27RB0IR33BFNSChldodFsjU57YDo0a9XAmcst1lt5dBPQg1FF065fXYsgKpxjCV5D 061IdaJbDTQrEbmymoHPrz6seQYdA2TTUOl0nIhAzZZRQGnYZSvxFNssqhcmmiGhmZxl zOW23QagvU4batXBaro2G3Yw87eKqMJ9ZgXl+ElMmvg5zyGsHz676W+Fq5hsCQJ77fMw qIVrxPIK/fCm7mg8lIMd0KtaahVnsVojh6qOFxsxVHTIwpWEXWDkOBhdS4CmoXJbfB79 g96RLK1cbjDgIh9Ne+7kkAitd2kD2t3rIytGb4hcwYDOCKKR5Wpx5qNgNmA3kk5rDtX+ CvEQ== X-Gm-Message-State: AOAM5307bj0XZtHvm35qY+SOQLGiqBNM1bfaEkWsGpIl00QqpOwBeGAx ST0Wohob/xhyE9e13oJg1ls1KIMfK5AG+8lw71nsSLJKtH7ptcmhRXd7BveBl+UYkITWBG6mOvy NREeffRdx8PV5pA== X-Received: by 2002:a17:906:268c:: with SMTP id t12mr2980898ejc.377.1603964091267; Thu, 29 Oct 2020 02:34:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2fplAeCmn4KjQvLFwcFetSv60We+HjuDBR+g03i54KhnKmwag5CQRx/3lJomd4K8fucH/4w== X-Received: by 2002:a17:906:268c:: with SMTP id t12mr2980881ejc.377.1603964091126; Thu, 29 Oct 2020 02:34:51 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 19/25] block/nvme: Change size and alignment of IDENTIFY response buffer Date: Thu, 29 Oct 2020 10:33:00 +0100 Message-Id: <20201029093306.1063879-20-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-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 IDENTIFY command response buffer so that the VFIO DMA MAP succeeds. We align on the host page size. Signed-off-by: Eric Auger Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi Tested-by: Eric Auger Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index bd3860ac4ef..7628623c05a 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -522,19 +522,20 @@ static bool nvme_identify(BlockDriverState *bs, int n= amespace, Error **errp) .opcode =3D NVME_ADM_CMD_IDENTIFY, .cdw10 =3D cpu_to_le32(0x1), }; + size_t id_size =3D QEMU_ALIGN_UP(sizeof(*id), qemu_real_host_page_size= ); =20 - id =3D qemu_try_memalign(s->page_size, sizeof(*id)); + id =3D qemu_try_memalign(qemu_real_host_page_size, id_size); if (!id) { error_setg(errp, "Cannot allocate buffer for identify response"); goto out; } - r =3D qemu_vfio_dma_map(s->vfio, id, sizeof(*id), true, &iova); + r =3D qemu_vfio_dma_map(s->vfio, id, id_size, true, &iova); if (r) { error_setg(errp, "Cannot map buffer for DMA"); goto out; } =20 - memset(id, 0, sizeof(*id)); + memset(id, 0, id_size); cmd.dptr.prp1 =3D cpu_to_le64(iova); if (nvme_admin_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to identify controller"); @@ -556,7 +557,7 @@ static bool nvme_identify(BlockDriverState *bs, int nam= espace, Error **errp) s->supports_write_zeroes =3D !!(oncs & NVME_ONCS_WRITE_ZEROES); s->supports_discard =3D !!(oncs & NVME_ONCS_DSM); =20 - memset(id, 0, sizeof(*id)); + memset(id, 0, id_size); cmd.cdw10 =3D 0; cmd.nsid =3D cpu_to_le32(namespace); if (nvme_admin_cmd_sync(bs, &cmd)) { --=20 2.26.2