From patchwork Mon Jul 19 20:07:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 1507252 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=irrelevant.dk header.i=@irrelevant.dk header.a=rsa-sha256 header.s=fm3 header.b=dwAGjQJA; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=CURnhIl4; 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 4GTCsQ3sC7z9sS8 for ; Tue, 20 Jul 2021 06:20:57 +1000 (AEST) Received: from localhost ([::1]:47324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5Zl1-0004bs-4l for incoming@patchwork.ozlabs.org; Mon, 19 Jul 2021 16:20:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5ZYF-00014S-N1; Mon, 19 Jul 2021 16:07:43 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:37305) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5ZYD-0001U6-BU; Mon, 19 Jul 2021 16:07:43 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 6B41C58165C; Mon, 19 Jul 2021 16:07:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 19 Jul 2021 16:07:39 -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-type :content-transfer-encoding; s=fm3; bh=GTZ4EFcE18KimFQmsUxbae3nfz mykYr1HT9wDwZ+NO0=; b=dwAGjQJAJ9gVpJ9BmXDSmZ3Fj9Exqny1Szbf553BsA LD64/fVJHoNoTMIl6fp6HWGS5a4qxKGubtAJnSYgOuGzJkRgruVbdfGk+cS4AdvQ vOOQTHUj5wyjM1F5xFQ2U1aKMmdQXahQI6KSNBTtVsar2YFt0SNF/x588J/mlc2C PmwI58/uxfglLU/X7cDuZxqC2nGmfVvPT7emNqgMOGGyrWTzf0Hny6VJ5u+ZVPqM VDI5EZd5T8wVk0ENumP8iWA6MovPVSGZXcejuIeyN3/KOrq9GZyFwthaB0C7x60B g8PRJfOnTfS1HRdutoSL61IKPhMyNEnl9otWoKM/G49w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=GTZ4EF cE18KimFQmsUxbae3nfzmykYr1HT9wDwZ+NO0=; b=CURnhIl4IWacD0NNHoVdKv hWNj0CEVtq+Qe7enYpfOTnpS+Y5P/QVTp5ndOSmSvf6BaJ/d8Tc8I5qPvI8KMZ7z nER657kckPphYrF+bUsB/SbQu0uqIAF97i6Hr6omFHacZCcXBFs9/Lt5Y5qEyRBT hsLxYCATu+jjhDU6E0i7ucBAmqdOqMFkFZzaCJr1ibUa5ndC/gEfpRp+iRM6eUI4 b3onsS4bqvibwz02R6A+VBzU6GNJFPHqB85jJvlyVZ80pfskvBAsFYqpZ3KjCPxs vphCIk7PyWxuIwpmELfnF1KRYdWSJSGVjiyO/WWE9mRoQDYdIGJ0fRcz34Ha0CXQ == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfedtgddugedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffogggtgfesthhqredtredtjeenucfhrhhomhepmfhlrghushcu lfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrdgukheqnecuggftrfgrthhtvg hrnhepfeduheefudfghfdutdetffefleeutddttefgudeludduudfguefhleeuueeugffg necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhtsh esihhrrhgvlhgvvhgrnhhtrdgukh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 19 Jul 2021 16:07:36 -0400 (EDT) From: Klaus Jensen To: qemu-devel@nongnu.org Subject: [PATCH v4 0/5] hw/nvme: fix mmio read Date: Mon, 19 Jul 2021 22:07:28 +0200 Message-Id: <20210719200733.28502-1-its@irrelevant.dk> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Received-SPF: pass client-ip=66.111.4.221; envelope-from=its@irrelevant.dk; helo=new1-smtp.messagingengine.com 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_H3=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: Laurent Vivier , Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Klaus Jensen , Gollu Appalanaidu , Max Reitz , Klaus Jensen , Stefan Hajnoczi , Keith Busch , Paolo Bonzini , Fam Zheng , Kevin Wolf , =?utf-8?q?Philip?= =?utf-8?q?pe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Klaus Jensen Fix mmio read issues on big-endian hosts. The core issue is that values in the BAR is not stored in little endian as required. Fix that and add a regression test for this. This required a bit of cleanup, so it blew up into a series. v4: * "hw/nvme: split pmrmsc register into upper and lower" - Fix missing left-shift (Peter) * "hw/nvme: fix mmio read" - Remove unnecessary masking (Peter) - Keep existing behaviour and do not zero the register fields doing initialization (Peter) v3: * "hw/nvme: use symbolic names for registers" Use offsetof(NvmeBar, reg) instead of explicit offsets (Philippe) * "hw/nvme: fix mmio read" Use the st/ld API instead of cpu_to_X (Philippe) Klaus Jensen (5): hw/nvme: split pmrmsc register into upper and lower hw/nvme: use symbolic names for registers hw/nvme: fix out-of-bounds reads hw/nvme: fix mmio read tests/qtest/nvme-test: add mmio read test include/block/nvme.h | 60 +++++-- hw/nvme/ctrl.c | 352 ++++++++++++++++++++++------------------ tests/qtest/nvme-test.c | 26 +++ 3 files changed, 265 insertions(+), 173 deletions(-)