From nobody Mon Nov 17 12:05:04 2025 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=1603807067; cv=none; d=zohomail.com; s=zohoarc; b=EhqZOk53qlU3i3H71oSaIZCezAELLS1ELIVMD/M3Fv2HvIO6N4QQCohzlkJSEr7MwOgpu5CCEOIP8Yndcuvr0AqmiBOjfpo/0FACreMxeQ2eIxgzlDc8H9SoFZGeOQiSoyOza9hgIOfUFp0I9FUDQsNLvrarS2CPZiXmeIi0JLU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603807067; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=0Utic1r2QfB0RLxuIXWbW8/BZ/+Cux5YDi1b1KSr+AQ=; b=H117Q0Ji2jhT9L2Et/l254E4jVA5IHNNw/gBdWg5/k+W9MC2JCNtCOeOmri+ktbXaIzXyl4ewosnCwyOQZRCAVlvpJECWwBKMAt/pIZltWJr0RMp5Tst3ph4qlXVoXyMsQg0v8ONcotpKypsZAWh1xe40y4w8mNZg+RRfgtrN3I= 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 1603807067444453.76682435093903; Tue, 27 Oct 2020 06:57:47 -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-377-ZDQM1w6lNGSHsNTRuxLMOg-1; Tue, 27 Oct 2020 09:57:44 -0400 Received: by mail-ej1-f71.google.com with SMTP id c20so895773ejs.12 for ; Tue, 27 Oct 2020 06:57:44 -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 m25sm1014991edp.36.2020.10.27.06.57.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603807066; 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=0Utic1r2QfB0RLxuIXWbW8/BZ/+Cux5YDi1b1KSr+AQ=; b=GYidfso0Fs6V8pu9jz7RkdSWfsLRBpXnqezJqJw86p2TUuOBDDXfefSeLMwEb/a+Fx+sZ3 mqHhfWlg2l636Wbe3feta8828EQVQWbfJO/7MPj8dv4GKQsT1Z2Vn6GlU6A2kviMpmI5jw N9pvxSbLzeNgWNQwgR1hvB7lRlYzGXM= X-MC-Unique: ZDQM1w6lNGSHsNTRuxLMOg-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=0Utic1r2QfB0RLxuIXWbW8/BZ/+Cux5YDi1b1KSr+AQ=; b=eAHTKY12mapV1KJSCXEK6tUS7wSNAx9Z/m56McKB3vGsXZ3OPKBBpvXQlvCGwBedBQ CCABPm12Pri2oR+YPcOUWvqR0grwniq7LoDwxSgHrUdOrpxnHwK0BVQnBDeuI5RTABHe bQX6wE6Z2NMxtmwwsjNbdxTh9C6NV5BtwWJN2u/A2sAVkebswS2JY2DbKXJicmLFv/ZI OZae9Z9Tzu7CeVarYrA6Sn3B0ziqfnWbMpf1dK5HTqAyaoZZobZ9BtBXIKnNZ7CbtwQB pGwqam0PSncmARvSCR0mwvh3NPNaiirlWI8A5GiYg7cQYYMY/voU5SGU8c3sNjw6Gwzk jHWA== X-Gm-Message-State: AOAM531w6UnMmJZWQWut6lhioWPBYGcFjVB0mjWr8Wobn7KPH+RKDMLO 0YqM0TbcC3LoVyIC64uvTLHV0mK3f4QTMX0jwDWQF0JfqOgIP9NVphLYrJN6hV4NPRW7He9c3GA mHZ2SSQtEIkDUHA== X-Received: by 2002:a50:ab07:: with SMTP id s7mr2344440edc.287.1603807063641; Tue, 27 Oct 2020 06:57:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx52vu3HB69weFD17jCoA/z36Gtt2WNjlxz29VyUmlUG8o8YtK1ekcFZufUNtFYGFjTe0IueQ== X-Received: by 2002:a50:ab07:: with SMTP id s7mr2344420edc.287.1603807063451; Tue, 27 Oct 2020 06:57:43 -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 21/25] block/nvme: Change size and alignment of IDENTIFY response buffer Date: Tue, 27 Oct 2020 14:55:43 +0100 Message-Id: <20201027135547.374946-22-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 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 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- block/nvme.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index d2d57a287cc..ad70303c5c1 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -521,19 +521,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_cmd_sync(bs, &cmd)) { error_setg(errp, "Failed to identify controller"); @@ -555,7 +556,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_cmd_sync(bs, &cmd)) { --=20 2.26.2