From patchwork Tue Feb 13 08:11:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 772271 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp142931wre; Tue, 13 Feb 2024 00:14:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUvhvmVm7cybBM9eYQaaXP3A6nyYX63dvMnfOTkNF1/somk4bthGPUIwLAvo325LjUb8zqoAwQyaA0DWLYGOBTN X-Google-Smtp-Source: AGHT+IFa8rxftb1QQrMU/f3+bqTk/8xiJYIr9QCYd6+dDoCHaWefy8TBEiutyO1n5H237NruskTG X-Received: by 2002:a25:2e4b:0:b0:dcc:9e88:b15 with SMTP id b11-20020a252e4b000000b00dcc9e880b15mr889837ybn.41.1707812046937; Tue, 13 Feb 2024 00:14:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707812046; cv=none; d=google.com; s=arc-20160816; b=XLPPFhECm52wH9hg0ueEKjee9rjjgs1SoRX4riUNDNsioe9ziq9YB1ILsMjCOoGc05 5cejHA33bub6EinjLSEAXGeyrkNft7fSJzcvN/J06c9vJ8EMAFbwkdsQjyg4ZV6hzWUc Mcs9XQQh8q1wuMyB+SLcZzcpqhwd/NTE02TEm3b66wEMCskVBY4YSwa7d1aHytabG4Kr R1t7cClonvRzBXdqTUk1noD9W9gEZUl04ntBrWaEkNiDcKoX9kLUCmeElCdIXJy43i8t k5+nKOvDRQGMjXuAb5McHXM++lhgDu+i040fWgzUP0/jIQuHOixbFUTc9sz3E3CmV6ef fLAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QDigo3VaEMu1N9qxZDm571UBwWnNIeVpjt1aUzhYjcA=; fh=7L3r5zIxAzWVTIUvdksner8XO8r9VTVOi11y72Igybk=; b=NxfSE4x5QUGdCdGWxV9AEnOLZthcXKnIQGQZnTT8Co2RqA0JsHN5bxLlvUE1/HSgRP tGqloHS1LnDXS957vYdJTwo5HoDq4RXa+bpJOfqixbqSNLPGLEEeTC+yC/l/Xxws1uCt s8cJCuDJ8Rdq3R20Nguebvog8q3D/KJV4DieHitDBeNKnJyVvPO1mAOlrhznPq/6ZTKc KLiDq6MaHnS/v5OmFjqxu8z6IMwpK/9z4HJyrL1SE/YWQI9iljVAf/LM0ueZRAqa6C3Y WrXrChPfII4yk0SnRz2MAxjgKa0Wq7haUyF8ayhW1hhMlzDMIZUmi+dcm/cWBGJNa4O3 D1kA==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r0FN62pC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=1; AJvYcCUa0Hc0wGLeZMwYfq1ZkSO/zqj40Mpp6/lWEeczzv8AfHH29pXoBeYlgJLD2MKibD9U3oohFYB+ah3bRpzWnhyA Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v18-20020ac87492000000b0042c7dd2cfc2si2174681qtq.564.2024.02.13.00.14.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Feb 2024 00:14:06 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r0FN62pC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZnuM-0000gO-AW; Tue, 13 Feb 2024 03:12:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZnuK-0000eD-MS for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:12:48 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZnuI-0000tg-Nz for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:12:48 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-33cd57b86bfso269414f8f.1 for ; Tue, 13 Feb 2024 00:12:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707811963; x=1708416763; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QDigo3VaEMu1N9qxZDm571UBwWnNIeVpjt1aUzhYjcA=; b=r0FN62pCs1kidnhu/2RxxfY2K2doocDlkAMfqzL8V9JEeT6/fdGgiSu2En2lzxoL5/ vxyimfZr3v0obT9cguTdr8YXNRyu+ElbQ86Hjy36gnHJiVN1w3mwdlSQ/479D5nbyKlD Wa3zOTeLaN8V/0pE7NnUYWSvcKkPydIjYK3cgX0R+w4mGnpb409jqdKP+EtmZutntKCo iaZKHuUNE5/M8CWKX185oSBrPq9cLVPB48NFtcMX/LZf+BZC+T97BEPlWp4l9JBhMvr1 6XNKiC+Z+VEk9VnJ4SQ/ATZVOeM+2aHxvnx+7M7TTqlndUDHJ9oNvL7UTA7pDask+jhJ /Muw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707811963; x=1708416763; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QDigo3VaEMu1N9qxZDm571UBwWnNIeVpjt1aUzhYjcA=; b=NLaypr1M4/ak8oVC6hS+2BAioC+tuMLQNfwjyb8PXuOjkSyQcLIetHdUP7BKigItui Id1IslwN7TVH8645RbkdeRVHkmjWrYH8wAnRF14RmU6yfYB6zDftgCN1RGKzM8SnxXUE 97zLvJ9abA4FKgpesMNHC5vxlTIrd48Hd6689Fzh3zo79O38NOXZYtiLN4qz2wP3al/v A+EroFAa2h1EcL06SYH6qXNQq9Fsu3SkKmp4f3Z9zELCvWdrUcSUrPXOvqAkztEnSRhP AAq31Xd7IpWy4JvGQ2VqxrBFBQQ0EoRH4530WANz+1KS2UavhUTk3wnczXfCKoUG1apL k5Vw== X-Gm-Message-State: AOJu0YwqMksjAVvD68oKo8rheY5JSi7zZb1gcN8ia70OgzB8W32bkI4O Qsf7r4zlaXYZZXfQgqxkmA8R87Uz+BrGUocjv+izzdfwY3hgDVSeNHEVmLVp2MkEsKPm/Fkwoo7 L X-Received: by 2002:a5d:6c6d:0:b0:33c:d88b:bc5a with SMTP id r13-20020a5d6c6d000000b0033cd88bbc5amr799050wrz.34.1707811963439; Tue, 13 Feb 2024 00:12:43 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXSXrtsPG9g3efdKsqit9qYtcUzRvSrnd+k0Pl5vgN0tuKFia2vMbuvE+J4LMwegiPd0NdW0OPllB4VVSIjuV0AO44GPgDHEsh5FyV914eSHTb6E/sVEKPoxnfg3mXRj+7O2IHheBhHqlWNRW+kogul0gT2lbiXd526KuZP6NG9dD/ZL6ClHZvwAhBFr+3G7BqE7vsOQCYp1gYBmM9gnIyB7Ee8HM+lRcL4tY+8wlySq1fvyNHikhlbFMxn31ACmWSK6zJiz/u0uJoPLuc4xsyb0QmCfvc= Received: from m1x-phil.lan ([176.176.128.243]) by smtp.gmail.com with ESMTPSA id v9-20020a5d4b09000000b0033b843786e1sm4085476wrq.51.2024.02.13.00.12.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 13 Feb 2024 00:12:43 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Marcel Apfelbaum , John Snow , qemu-arm@nongnu.org, "Michael S. Tsirkin" , Paolo Bonzini , qemu-block@nongnu.org, Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH 6/9] hw/ide/ahci: Convert AHCIState::ports to unsigned Date: Tue, 13 Feb 2024 09:11:57 +0100 Message-ID: <20240213081201.78951-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240213081201.78951-1-philmd@linaro.org> References: <20240213081201.78951-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org AHCIState::ports should be unsigned. Besides, we never check it for negative value. It is unlikely it was ever used with more than INT32_MAX ports, so it is safe to convert it to unsigned. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/hw/ide/ahci.h | 2 +- hw/ide/ahci.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/hw/ide/ahci.h b/include/hw/ide/ahci.h index 8cd55b1333..604d3a0994 100644 --- a/include/hw/ide/ahci.h +++ b/include/hw/ide/ahci.h @@ -46,7 +46,7 @@ typedef struct AHCIState { MemoryRegion idp; /* Index-Data Pair I/O port space */ unsigned idp_offset; /* Offset of index in I/O port space */ uint32_t idp_index; /* Current IDP index */ - int32_t ports; + uint32_t ports; qemu_irq irq; AddressSpace *as; } AHCIState; diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index bac1871a31..2c3306dae4 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1819,7 +1819,7 @@ const VMStateDescription vmstate_ahci = { .version_id = 1, .post_load = ahci_state_post_load, .fields = (const VMStateField[]) { - VMSTATE_STRUCT_VARRAY_POINTER_INT32(dev, AHCIState, ports, + VMSTATE_STRUCT_VARRAY_POINTER_UINT32(dev, AHCIState, ports, vmstate_ahci_device, AHCIDevice), VMSTATE_UINT32(control_regs.cap, AHCIState), VMSTATE_UINT32(control_regs.ghc, AHCIState), @@ -1827,7 +1827,7 @@ const VMStateDescription vmstate_ahci = { VMSTATE_UINT32(control_regs.impl, AHCIState), VMSTATE_UINT32(control_regs.version, AHCIState), VMSTATE_UINT32(idp_index, AHCIState), - VMSTATE_INT32_EQUAL(ports, AHCIState, NULL), + VMSTATE_UINT32_EQUAL(ports, AHCIState, NULL), VMSTATE_END_OF_LIST() }, };