From nobody Tue Feb 10 11:12:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1640260823; cv=none; d=zohomail.com; s=zohoarc; b=npVj/JSXKXdVn+sqjyNOCpGPRepZzBh2RNjO9uWwolGA1ranZFyt90eaOXR5YH/jneQebE3rZJKGkf1Zkr7/GwPxUurcqwe8eWXJm9gv5HHUsY4XGjBG2ZFMMQXG7I/U1QsTXyJ8K8NIbG2+e+qcyjz2JJByJuP/h4LWynK1/8E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640260823; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=oOieGHzt55TTLrMgE6y82ndRao5o7/HgB++E/ZPWN8c=; b=Y9YS7km87hO6FFWGFEvI5anYAXOiXTq+fKcj7dWrgohvKSqxjIyJQW0/FOWugJCmfBv2+dudE+j97hdhIh2LSWgenbEIeFFc5QTeXFk9KfeiaBa8lctyrN1yvZIIziW3/nke2/MV63iZvMWbPvOg8jqA5a+SKR6NfCNjvb0jwyQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1640260823314584.0335341866585; Thu, 23 Dec 2021 04:00:23 -0800 (PST) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-463-kaIRZHycMTq02YNH8f1eaA-1; Thu, 23 Dec 2021 07:00:21 -0500 Received: by mail-wm1-f72.google.com with SMTP id ay41-20020a05600c1e2900b00345a568e6b2so1867330wmb.4 for ; Thu, 23 Dec 2021 04:00:20 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (33.red-193-152-124.dynamicip.rima-tde.net. [193.152.124.33]) by smtp.gmail.com with ESMTPSA id s189sm9632538wme.0.2021.12.23.04.00.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Dec 2021 04:00:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640260822; 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=oOieGHzt55TTLrMgE6y82ndRao5o7/HgB++E/ZPWN8c=; b=A8UdgYPmwJT39N7vx5IQidJHfrbwYNHi2QytnIToXxlfwlWNptD6Y6IzeJ3Ey7KJF6T7ea fBYg8iZnIlr8VqOnP2HpFDnvPuhBno878AcA5M1FqDnLp2uSkec3Q7aFnQMAG68Z5lT7dT Kv1lVUVx/qDz9U1DfmT/ffNYldfJH+k= X-MC-Unique: kaIRZHycMTq02YNH8f1eaA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oOieGHzt55TTLrMgE6y82ndRao5o7/HgB++E/ZPWN8c=; b=cCbm1iE2+NsgQ9GWCPia+ukHyvVrWDhOSMYWM9+DJ8Rxbc/dPGHDmBYCM9KlvlB20H vZOc7YpFA/BqDeYElxEM6cACqVp/Vom9sRHXcXZ+3br7h6bQ/NVfSDL5eDgU4Ndi6Ft3 2uaHJacpWcMBLY5euUMHZJMxZUU5JpaJasBpxVL+NNn+Yv432WjUn4QRINrA1YmoWWAn KrpGMXvjgR5xFQijjHMs8gWYpmwCA4CcIy9GOEvcEtTPdaw8xNVR+vWRzve3+0hw6JMd NAywIDDKKcnogFizDNVuc2+LR0TC0GH6F7OS86aIApsWzEHG0H2ZLscfsIi24ZWvW74j 7i3w== X-Gm-Message-State: AOAM532kTcHNRwhAQ2ATJEHsteyUkJm/vxNuzhvU7TmIT0nrFFV9p3tX FxJufG+LQw5j8uyHAOlAirECnPKpG7AzCcigJj1zuKXVpyqJYY1CzE/cVqywX2gyFT040NX+NC6 CTDTWKCy1zNmVYQ== X-Received: by 2002:adf:dc12:: with SMTP id t18mr1594661wri.566.1640260818908; Thu, 23 Dec 2021 04:00:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGfYn4yd0fXb5c1xYbseXF9g+iDrur+UWaKtsUx6dlZQeu/i7TrlfCzyVN9bsHr2TL9HY27w== X-Received: by 2002:adf:dc12:: with SMTP id t18mr1594625wri.566.1640260818723; Thu, 23 Dec 2021 04:00:18 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , Richard Henderson , qemu-block@nongnu.org, Jason Wang , Keith Busch , "Michael S. Tsirkin" , Fam Zheng , Alistair Francis , David Hildenbrand , Eduardo Habkost , Havard Skinnemoen , Sven Schnelle , Tyrone Ting , Gerd Hoffmann , Peter Maydell , Beniamino Galvani , Daniel Henrique Barboza , Dmitry Fleytman , John Snow , Bin Meng , Greg Kurz , Eric Auger , Mark Cave-Ayland , "Edgar E. Iglesias" , Andrew Jeffery , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Andrew Baumann , Hannes Reinecke , Paolo Bonzini , Peter Xu , qemu-arm@nongnu.org, Klaus Jensen , Stefan Weil , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Jan Kiszka , David Gibson Subject: [PATCH v2 19/23] hw/scsi/megasas: Use uint32_t for reply queue head/tail values Date: Thu, 23 Dec 2021 12:55:50 +0100 Message-Id: <20211223115554.3155328-20-philmd@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211223115554.3155328-1-philmd@redhat.com> References: <20211223115554.3155328-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) X-ZM-MESSAGEID: 1640260824726100001 While the reply queue values fit in 16-bit, they are accessed as 32-bit: 661: s->reply_queue_head =3D ldl_le_pci_dma(pcid, s->producer_pa); 662: s->reply_queue_head %=3D MEGASAS_MAX_FRAMES; 663: s->reply_queue_tail =3D ldl_le_pci_dma(pcid, s->consumer_pa); 664: s->reply_queue_tail %=3D MEGASAS_MAX_FRAMES; Having: 41:#define MEGASAS_MAX_FRAMES 2048 /* Firmware limit at 65535 */ In order to update the ld/st*_pci_dma() API to pass the address of the value to access, it is simpler to have the head/tail declared as 32-bit values. Replace the uint16_t by uint32_t, wasting 4 bytes in the MegasasState structure. Acked-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/scsi/megasas.c | 4 ++-- hw/scsi/trace-events | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index 87101705d01..266c3d38003 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -109,8 +109,8 @@ struct MegasasState { uint64_t reply_queue_pa; void *reply_queue; uint16_t reply_queue_len; - uint16_t reply_queue_head; - uint16_t reply_queue_tail; + uint32_t reply_queue_head; + uint32_t reply_queue_tail; uint64_t consumer_pa; uint64_t producer_pa; =20 diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index 92d5b40f892..ae8551f2797 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -42,18 +42,18 @@ mptsas_config_sas_phy(void *dev, int address, int port,= int phy_handle, int dev_ =20 # megasas.c megasas_init_firmware(uint64_t pa) "pa 0x%" PRIx64 " " -megasas_init_queue(uint64_t queue_pa, int queue_len, uint64_t head, uint64= _t tail, uint32_t flags) "queue at 0x%" PRIx64 " len %d head 0x%" PRIx64 " = tail 0x%" PRIx64 " flags 0x%x" +megasas_init_queue(uint64_t queue_pa, int queue_len, uint32_t head, uint32= _t tail, uint32_t flags) "queue at 0x%" PRIx64 " len %d head 0x%" PRIx32 " = tail 0x%" PRIx32 " flags 0x%x" megasas_initq_map_failed(int frame) "scmd %d: failed to map queue" megasas_initq_mapped(uint64_t pa) "queue already mapped at 0x%" PRIx64 megasas_initq_mismatch(int queue_len, int fw_cmds) "queue size %d max fw c= mds %d" megasas_qf_mapped(unsigned int index) "skip mapped frame 0x%x" megasas_qf_new(unsigned int index, uint64_t frame) "frame 0x%x addr 0x%" P= RIx64 megasas_qf_busy(unsigned long pa) "all frames busy for frame 0x%lx" -megasas_qf_enqueue(unsigned int index, unsigned int count, uint64_t contex= t, unsigned int head, unsigned int tail, int busy) "frame 0x%x count %d con= text 0x%" PRIx64 " head 0x%x tail 0x%x busy %d" -megasas_qf_update(unsigned int head, unsigned int tail, unsigned int busy)= "head 0x%x tail 0x%x busy %d" +megasas_qf_enqueue(unsigned int index, unsigned int count, uint64_t contex= t, uint32_t head, uint32_t tail, unsigned int busy) "frame 0x%x count %d co= ntext 0x%" PRIx64 " head 0x%" PRIx32 " tail 0x%" PRIx32 " busy %u" +megasas_qf_update(uint32_t head, uint32_t tail, unsigned int busy) "head 0= x%" PRIx32 " tail 0x%" PRIx32 " busy %u" megasas_qf_map_failed(int cmd, unsigned long frame) "scmd %d: frame %lu" megasas_qf_complete_noirq(uint64_t context) "context 0x%" PRIx64 " " -megasas_qf_complete(uint64_t context, unsigned int head, unsigned int tail= , int busy) "context 0x%" PRIx64 " head 0x%x tail 0x%x busy %d" +megasas_qf_complete(uint64_t context, uint32_t head, uint32_t tail, int bu= sy) "context 0x%" PRIx64 " head 0x%" PRIx32 " tail 0x%" PRIx32 " busy %u" megasas_frame_busy(uint64_t addr) "frame 0x%" PRIx64 " busy" megasas_unhandled_frame_cmd(int cmd, uint8_t frame_cmd) "scmd %d: MFI cmd = 0x%x" megasas_handle_scsi(const char *frame, int bus, int dev, int lun, void *sd= ev, unsigned long size) "%s dev %x/%x/%x sdev %p xfer %lu" --=20 2.33.1