From patchwork Thu Oct 22 07:33:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 1386014 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=irrelevant.dk Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=irrelevant.dk header.i=@irrelevant.dk header.a=rsa-sha256 header.s=fm1 header.b=zC1VeCzZ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=UCyBX9kN; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CGzjL2q8fz9sTc for ; Thu, 22 Oct 2020 18:37:42 +1100 (AEDT) Received: from localhost ([::1]:42284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVVAK-0006X3-7P for incoming@patchwork.ozlabs.org; Thu, 22 Oct 2020 03:37:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVV6B-0005PN-ER; Thu, 22 Oct 2020 03:33:23 -0400 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:49615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVV68-0003fR-Ny; Thu, 22 Oct 2020 03:33:22 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 841CF6C2; Thu, 22 Oct 2020 03:33:17 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 22 Oct 2020 03:33:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm1; bh=NxYs9E2rs07+4QygczjJdAcbVJ ujuKT92+JfaEgUVSk=; b=zC1VeCzZZlO92Yul5k0IoQHUsazkhAt/hNx8EBiJFq 3iGkkSOgSI6MuPuvVFvFw00NroRkiwNHjX1gYwvJe3wRDeWTWOmkn21s4/MgAB53 uSolYM5RygKTJpDSWmT7u7DH3DqVzuVXfxeBLCVwbYOSdCEWS31Fvr6MN64CPNJj JDugBpWiyW3+7gtkDfkmNzokGRuOpX26qYgZ6xhVoPmupigysKXRY/TJyAoJaiDE BnURikqbqVh8ldamFaRvWHJmcjRGu/5gVAoU+XYWz7m2cN0WbJbWgPn790YUNjMN INkqqg9AbjN9mwkNWyym2LMlZSBkHr5Uv+GG47S7s/Ng== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=NxYs9E2rs07+4Qygc zjJdAcbVJujuKT92+JfaEgUVSk=; b=UCyBX9kNlYDp2wYPRePrFCuNbIU9wbtZB LxIguHssc+FhgZsaCKvAzDVK6pGWzBDbY+0wNgYyLVlTi9tNBwhvNnYGrztiD3JH csVgCrpqU8I0cSIDF3p8Dhr7RkNWY1xu8NmL5W09TeHQ9kHuUNQ6YHie7nKzyC7B Ejafjp3M4/y/fbT3VABbNykEEqV5M3N7htCbzsofWIsdj6DAHxHBaRmaa4K5KMuu QT31j4G7lLmQDSzDtcGNx76OtUzj19dI6uwi2re3hkppp9sDFD9b8RrpaW1sftoB Jtlfj9xKpeZWqE0QE4jBbEMgHA6cRiBpVkll7VPJD4CcyIpkf2nrA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrjeeigdduudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtqhertdertddtnecuhfhrohhmpefmlhgruhhsucfl vghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtthgvrh hnpefhjeffvddtueefkeelleettedufffhleeitddvgeduudfftdeuffekgfeugedtueen ucffohhmrghinhepihhrrhgvlhgvvhgrnhhtrdgukhenucfkphepkedtrdduieejrdelke drudeltdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehithhssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: Received: from apples.local (80-167-98-190-cable.dk.customer.tdc.net [80.167.98.190]) by mail.messagingengine.com (Postfix) with ESMTPA id 59F433064682; Thu, 22 Oct 2020 03:33:15 -0400 (EDT) From: Klaus Jensen To: qemu-devel@nongnu.org Subject: [PATCH v4 0/2] hw/block/nvme: dulbe and dsm support Date: Thu, 22 Oct 2020 09:33:11 +0200 Message-Id: <20201022073313.143794-1-its@irrelevant.dk> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Received-SPF: pass client-ip=64.147.123.24; envelope-from=its@irrelevant.dk; helo=wout1-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/22 03:33:18 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, Klaus Jensen , Max Reitz , Keith Busch , Klaus Jensen Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Klaus Jensen This adds support for the Deallocated or Unwritten Logical Block error recovery feature as well as the Dataset Management command. I wanted to add support for the NPDG and NPDA fields such that the host could get a hint on how many blocks to request deallocation of for the deallocation to actually happen, but I cannot find a realiable way to get the actual block size of the underlying device. If it is an image on a file system we could typically use the host page size, but if it is a raw device, we might have 512 byte sectors that we can issue discards on. And QEMU doesn't seem to provide this without root privileges at least. See the two patches for some gotchas. I also integrated this into my zoned proposal. I'll spare you the v4, nobody cares anyway. But I put it in my repo[1] for posterity. [1]: https://irrelevant.dk/g/pci-nvme.git/tag/?h=zoned-v4. v4: - Removed mixed declaration and code (Keith) - Set NPDG and NPDA and account for the blockdev cluster size. Klaus Jensen (2): hw/block/nvme: add dulbe support hw/block/nvme: add the dataset management command hw/block/nvme-ns.h | 4 + hw/block/nvme.h | 2 + include/block/nvme.h | 12 ++- hw/block/nvme-ns.c | 40 +++++++-- hw/block/nvme.c | 183 +++++++++++++++++++++++++++++++++++++++++- hw/block/trace-events | 4 + 6 files changed, 236 insertions(+), 9 deletions(-)