From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from ws5-mx01.kavi.com (ws5-mx01.kavi.com [34.193.7.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04914C76195 for ; Mon, 27 Mar 2023 20:55:20 +0000 (UTC) Received: from lists.oasis-open.org (oasis.ws5.connectedcommunity.org [10.110.1.242]) by ws5-mx01.kavi.com (Postfix) with ESMTP id BE5F6676F8 for ; Mon, 27 Mar 2023 20:54:49 +0000 (UTC) Received: from lists.oasis-open.org (oasis-open.org [10.110.1.242]) by lists.oasis-open.org (Postfix) with ESMTP id A8EAB986405 for ; Mon, 27 Mar 2023 20:54:49 +0000 (UTC) Received: from host09.ws5.connectedcommunity.org (host09.ws5.connectedcommunity.org [10.110.1.97]) by lists.oasis-open.org (Postfix) with QMQP id 9BF81986318; Mon, 27 Mar 2023 20:54:49 +0000 (UTC) Mailing-List: contact virtio-dev-help@lists.oasis-open.org; run by ezmlm List-ID: Sender: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Received: from lists.oasis-open.org (oasis-open.org [10.110.1.242]) by lists.oasis-open.org (Postfix) with ESMTP id BA66E986652; Mon, 27 Mar 2023 20:54:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at kavi.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lrsq7lD6W68XEy3mLN1W54HaVbni9sSmO3IbiEjRlOrdTJ2KRzXdVOoWzF6oMo/r40mqzmDi9rxnhR+BghpdVHUpFy0Q7FIKkPne+6swJIyl3s0G1r3kQZjLUYRMDBVNX95GGUaYwNPVD/iHP1+XR4XhVDc9Vysn3PZyoK8qv+V1Q2MmveGFbgRULXHUhCm1K72ZvAowL4IwFrSzfF6oTNYVVyInychgLA3+N+Cfr1DmG2gVZqJ86HSR84QJUY2GLmA1UZ7HijWyPHw5hghSxfxQoRbPFldD0HlMpP4DhiJ526MJFx1hIhKKuGwwVk//xzolTBCgq2s9mWYv/TA0FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=H/y2yHD9+eaIc+KixlneYCSkG+JIP/pzXy9DSNAAr7c=; b=MStgU/afvlm/VUpC3dPZeupm06nr/sWS8IR8U4qwvCjWj2Dm/fIUmaYfAGO+EoOcSwxqg9SpKZ/JLjtDwy68RghtLMTXaKPMPXc68EwtXEof/D3Ywq6cVseY6ZfzNfCCMehaJ0yNrJSXFX2iI1xcIl1B+MdwZ+uw99fRSoUK83wjJLolNAJaBj4JsdUMNeFVvlcyycGCJ6jqAk5N1Fu22t3F+/9nTXQ2BOVFEruLo5XCiH6J710sIJAcxWR+8OjkSoyUu3vGZSIrVmIQUJxJvbrxihaUZnmAStyCyLxuvrBav6JmDXvSYZ7jZ9RKU5iQtuW+cpWxjd+FTrbtbicMaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C From: Parav Pandit To: , , , CC: , , Parav Pandit , Jiri Pirko Date: Mon, 27 Mar 2023 23:53:54 +0300 Message-ID: <20230327205359.406605-4-parav@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20230327205359.406605-1-parav@nvidia.com> References: <20230327205359.406605-1-parav@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E632:EE_|PH7PR12MB6881:EE_ X-MS-Office365-Filtering-Correlation-Id: 407f850a-6965-48f7-1f22-08db2f057163 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xeELzY21EzzQIz45B7MQjKItETRoyBVaJ5CfD4fRSgRGwFKzs7XrrPHx6Nb8FSdU5sTM1+HsTa7g74CbrMV0b9SLuR8xqrqXO2uBeUYJK2yoXHJH/Ujlon8x3YBFqNp4KRXhc8/nr7ZPFkc8lxzWf8ebdXmKjibB5ln9i1L9kVpN5T/LIZWoi1QT1qPSGbSf0N2mfcTo7hDReumIvhgsfEKy7NaTlmk+4zS9GqBrWuFgzMdXzoTF9zz6pqAGCTFBaOnxE6hYhZ2SK0F/8Ead33LMVfqa3TpKtrbnfluQKfjVoD3rJqZ4icxFMfvWmb+P4NhNpW0ZYE44iPoGW7EBiFoKxWF57IIG8QY7N8jal/pzHrJ99t8Pu/JiMRaMiknT+LAkacJ04X8rf4l/JmzIRzffeMcf4/MVKAUfojIWEQIssMRfY7muazyPL1E5Pw1WkX8CdVcjEgDl7dDASkI2rzZXh4nROdbPFt8er4b2M0oi9cbwH8JzMOuU8OXzMlMGU2o/MliFit0P+JPKtTFNnMagFjYzvm2WYOHvjPRHZgeUro+OmtDdUu4qJiELLYP7NZvjOFNDc+SCK2TaG3HyD9sIC8RzDM4PEi2yzMCucxYQ8dp/IKbZ2aT1JUo+w+uxu/FqOJrxxAfUdAh131wk0itNepLqwznxG6yBH2F77nEaPX2GFJ3I+9iTSLIveOs0B8zBq4ykso6v30lcbNgZih0YE78AhYFB2YQ0xN0G1JFqN9Mam7iACw/8rX/V96s34u6g7f/qY/3q3EffyqhYAlnvL9v/BZzRIo+t/0kVms8= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(39860400002)(376002)(346002)(451199021)(40470700004)(36840700001)(46966006)(40460700003)(8676002)(70206006)(4326008)(36860700001)(70586007)(316002)(5660300002)(8936002)(82740400003)(186003)(7636003)(41300700001)(54906003)(16526019)(1076003)(47076005)(2616005)(426003)(966005)(26005)(336012)(107886003)(83380400001)(6666004)(110136005)(478600001)(40480700001)(86362001)(356005)(2906002)(82310400005)(36756003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2023 20:54:22.5158 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 407f850a-6965-48f7-1f22-08db2f057163 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000E632.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6881 Subject: [virtio-dev] [PATCH v7 3/8] transport-mmio: Rename QueueNum register Currently specification uses virtqueue index and number interchangeably to refer to the virtqueue. It is better to always refer to it the virtqueue in consistent manner. Two registers QueueNumMax and QueueNum actually reflects the queue size or queue depth indicating max and actual number of entries in the queue. These are further named differently between pci and mmio transport. PCI transport indicates queue size as queue_size. To bring consistency between pci and mmio transport, and to avoid confusion between number and index, rename the QueueNumMax and QueueNum registers to QueueSizeMax and QueueSize respectively. Fixes: https://github.com/oasis-tcs/virtio-spec/issues/163 Reviewed-by: Jiri Pirko Signed-off-by: Parav Pandit --- changelog: v0->v1: - replaced references of QueueNumMax to QueueSizeMax - replaced references of QueueNum to QueueSize - added note for renamed fields old name suggested by @Michael Tsirkin --- transport-mmio.tex | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/transport-mmio.tex b/transport-mmio.tex index f884a2c..3047633 100644 --- a/transport-mmio.tex +++ b/transport-mmio.tex @@ -110,24 +110,31 @@ \subsection{MMIO Device Register Layout}\label{sec:Virtio Transport Options / Vi \hline \mmioreg{QueueSel}{Virtual queue index}{0x030}{W}{% Writing to this register selects the virtual queue that the - following operations on \field{QueueNumMax}, \field{QueueNum}, \field{QueueReady}, + following operations on \field{QueueSizeMax}, + \field{QueueSize}, \field{QueueReady}, \field{QueueDescLow}, \field{QueueDescHigh}, \field{QueueDriverlLow}, \field{QueueDriverHigh}, \field{QueueDeviceLow}, \field{QueueDeviceHigh} and \field{QueueReset} apply to. The index number of the first queue is zero (0x0). } \hline - \mmioreg{QueueNumMax}{Maximum virtual queue size}{0x034}{R}{% + \mmioreg{QueueSizeMax}{Maximum virtual queue size}{0x034}{R}{% Reading from the register returns the maximum size (number of elements) of the queue the device is ready to process or zero (0x0) if the queue is not available. This applies to the queue selected by writing to \field{QueueSel}. + \begin{note} + \field{QueueSizeMax} was previously known as QueueNumMax. + \end{note} } \hline - \mmioreg{QueueNum}{Virtual queue size}{0x038}{W}{% + \mmioreg{QueueSize}{Virtual queue size}{0x038}{W}{% Queue size is the number of elements in the queue. Writing to this register notifies the device what size of the queue the driver will use. This applies to the queue selected by writing to \field{QueueSel}. + \begin{note} + \field{QueueSize} was previously known as QueueNum. + \end{note} } \hline \mmioreg{QueueReady}{Virtual queue ready bit}{0x044}{RW}{% @@ -308,11 +315,11 @@ \subsection{MMIO Device Register Layout}\label{sec:Virtio Transport Options / Vi Before writing to the \field{DriverFeatures} register, the driver MUST write a value to the \field{DriverFeaturesSel} register. -The driver MUST write a value to \field{QueueNum} which is less than -or equal to the value presented by the device in \field{QueueNumMax}. +The driver MUST write a value to \field{QueueSize} which is less than +or equal to the value presented by the device in \field{QueueSizeMax}. When \field{QueueReady} is not zero, the driver MUST NOT access -\field{QueueNum}, \field{QueueDescLow}, \field{QueueDescHigh}, +\field{QueueSize}, \field{QueueDescLow}, \field{QueueDescHigh}, \field{QueueDriverLow}, \field{QueueDriverHigh}, \field{QueueDeviceLow}, \field{QueueDeviceHigh}. To stop using the queue the driver MUST write zero (0x0) to this @@ -363,14 +370,14 @@ \subsubsection{Virtqueue Configuration}\label{sec:Virtio Transport Options / Vir and expect a returned value of zero (0x0). \item Read maximum queue size (number of elements) from - \field{QueueNumMax}. If the returned value is zero (0x0) the + \field{QueueSizeMax}. If the returned value is zero (0x0) the queue is not available. \item Allocate and zero the queue memory, making sure the memory is physically contiguous. \item Notify the device about the queue size by writing the size to - \field{QueueNum}. + \field{QueueSize}. \item Write physical addresses of the queue's Descriptor Area, Driver Area and Device Area to (respectively) the @@ -465,25 +472,32 @@ \subsection{Legacy interface}\label{sec:Virtio Transport Options / Virtio Over M \hline \mmioreg{QueueSel}{Virtual queue index}{0x030}{W}{% Writing to this register selects the virtual queue that the - following operations on the \field{QueueNumMax}, \field{QueueNum}, \field{QueueAlign} + following operations on the \field{QueueSizeMax}, + \field{QueueSize}, \field{QueueAlign} and \field{QueuePFN} registers apply to. The index number of the first queue is zero (0x0). . } \hline - \mmioreg{QueueNumMax}{Maximum virtual queue size}{0x034}{R}{% + \mmioreg{QueueSizeMax}{Maximum virtual queue size}{0x034}{R}{% Reading from the register returns the maximum size of the queue the device is ready to process or zero (0x0) if the queue is not available. This applies to the queue selected by writing to \field{QueueSel} and is allowed only when \field{QueuePFN} is set to zero (0x0), so when the queue is not actively used. + \begin{note} + \field{QueueSizeMax} was previously known as QueueNumMax. + \end{note} } \hline - \mmioreg{QueueNum}{Virtual queue size}{0x038}{W}{% + \mmioreg{QueueSize}{Virtual queue size}{0x038}{W}{% Queue size is the number of elements in the queue. Writing to this register notifies the device what size of the queue the driver will use. This applies to the queue selected by writing to \field{QueueSel}. + \begin{note} + \field{QueueSize} was previously known as QueueNum. + \end{note} } \hline \mmioreg{QueueAlign}{Used Ring alignment in the virtual queue}{0x03c}{W}{% @@ -543,16 +557,16 @@ \subsection{Legacy interface}\label{sec:Virtio Transport Options / Virtio Over M expecting a returned value of zero (0x0). \item Read maximum queue size (number of elements) from - \field{QueueNumMax}. If the returned value is zero (0x0) the + \field{QueueSizeMax}. If the returned value is zero (0x0) the queue is not available. \item Allocate and zero the queue pages in contiguous virtual memory, aligning the Used Ring to an optimal boundary (usually page size). The driver should choose a queue size smaller than or - equal to \field{QueueNumMax}. + equal to \field{QueueSizeMax}. \item Notify the device about the queue size by writing the size to - \field{QueueNum}. + \field{QueueSize}. \item Notify the device about the used alignment by writing its value in bytes to \field{QueueAlign}. -- 2.26.2 --------------------------------------------------------------------- To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org