From patchwork Tue Feb 13 08:11:58 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: 772270 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp142915wre; Tue, 13 Feb 2024 00:14:04 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVAPAUGXo6PdodYPhk8uvbaOo+x17s0FkmI3SpHfIgXJbSM3rYbRHCTCocF3k5mv65nDCkC16wModuuk8l95UoO X-Google-Smtp-Source: AGHT+IHsXjnhS6I7VNTem1JWdmkafAuW1s9K+JD3yXmvHxTfw49Y1VknqUwO9X6pxRPLmW2yAhG/ X-Received: by 2002:a05:622a:45:b0:42c:24d9:74ab with SMTP id y5-20020a05622a004500b0042c24d974abmr3628825qtw.17.1707812044384; Tue, 13 Feb 2024 00:14:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707812044; cv=none; d=google.com; s=arc-20160816; b=hF3OdycZGMnUA57GlpWt1U4R9APWdFJRcor8Jhbj5XTSZ2qWkQERcYEidC8jOODr8b edhGtEpFA0qlvlF9Lv/fsRyAyxSw7RQuKaUQyQVjC3EWt4AKONMFtMte+rnHO2iqaBH+ LxV6dP8A8HQRuuubw3/0pOOF6hugtUe/oF26IOwfGhPfsyjnUemut1ikKG1LhqyzjQue 4LLzVwsl74/uzaSKDUVsmnHsqEgsgSwpT9bAUgV7UFo7vObuh7LDLUgHHuJbuXjgVy+M fVc/5y2Or60XFfRXk3hLu/Jo4lL3qRjTG295crO8neV10QIjiHHTy3KzLupFfkyfgQyT QJLA== 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=3tGBnm3xpKoZJLGDzyHurshmc29aTqyoeNI6UD7GZU8=; fh=/8Lz4H/PexwTjVNqi26Amu6rEPu27cLfXjP2DmOyqX8=; b=D6eW0gDympccQXQHueZ4qDvHEgmhS/g+JnQzKf/+k/60p/ovdm5cjU58vQrllNyoc2 nUZGqXOr1r3sL8EiiZuSOoBlewtCTvf4emNUVa9243wQQ8arcKhNaisPEsAw4xdah2pA DNMhommzJCkxq3n73G6MA1TZfLFodPN4mnzN2nTLVFXDiOQqfyTPg0WxvuCihW/cu2PH B0kxEq5sOPJoN08T3ZT6+b2+kMyQAKxmoQb0g4IIB1SzOYJJOc1opXhL30eiZ9waWhiv X/FN97Mk9Li3R0aQLk15vry/sL1vzXtG6TQ+JrQxLEUvzVkLX73ecwquciQRyMzXPjxn l3kQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CsjDaSAp; 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; AJvYcCU+cxs4JKq+lTYy3Z9CQpQNsOPY91TlXumlN4GpoOV0Rx3o5tQa+5JK1mFLK9oVia6uptp9kDTppzc04LVUNtYB Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h7-20020ac85047000000b0042c31dd7f69si2135725qtm.686.2024.02.13.00.14.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Feb 2024 00:14:04 -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=CsjDaSAp; 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 1rZnua-0000vE-N8; Tue, 13 Feb 2024 03:13:04 -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 1rZnuZ-0000uC-Bv for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:13:03 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZnuO-0000uS-8o for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:13:03 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-33b2960ff60so2867270f8f.1 for ; Tue, 13 Feb 2024 00:12:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707811969; x=1708416769; 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=3tGBnm3xpKoZJLGDzyHurshmc29aTqyoeNI6UD7GZU8=; b=CsjDaSAp9E5pazR+KBsXLlYoc29uzU8c4HU3hkmoRh79x1Nebb1mzWD/BHrWGYfy3D Xd+uwTbsZLQdtQ9BUYs/ev3AEOy2ObRcgwj+XrdDux+kvTd7ff4hyoKeyjM+YZh4oxzH D0yIAEcgh/8UxQKJDlSv0SiOqm0M+nTdunKduXHR1wGBfgB5Lpyr1L5jUeZdeM8BuShw +m1ftiCPvnXmWSWFUDOtFmQH8Yy46vzTJGbuqTebx01t3C+z54gvI/BzcBDH5aG7CUXO AzSJISdR032F18nAIP+LGOhti6gll9TT4u763dCQe4IrsWVzUwKj1sDHseC45tnu0NcT R/zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707811969; x=1708416769; 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=3tGBnm3xpKoZJLGDzyHurshmc29aTqyoeNI6UD7GZU8=; b=SYDoJ/G3z7YiNXGGXQu5mRPjI1tOhsCKdgyHJYm3q+N/wPtXwYc0xxgsnkGLYNIQl1 CKWsBjYXKZNVfOQlBB5ixwTRqsz3fWLjX/sSn4DvfFc597/vdbJueVYQGHRbd3tjotrF vcUbM/1F6+JLae32UU/98AiyQGPYoLKPCJioYtxhUYEqkHZK1uc+QkB00pW1X43SJsNS xIdGXt6pHqlmB8umA1dSiOdbnZ+nAf1xLehyLgeG3oW2Ogba0y8o7Avh2MxP/ifAwnZR m6MyLZ06BX7nafiDjbxbqc95LhVnT2EXRVpbA7u1E7NVHHuyBFvsEhn0cl6NMyw6lIbL Wlsg== X-Gm-Message-State: AOJu0YzpE7008L4TAmb3ioACrBfp972FwO/JyPMkbGzekp2Zex43jKc6 klPpZHqH/B9buZTKyHPrbB/Gko6Xkwp3Z+OTbl1ExhHbriBUYvxYFBdbUdRq20em4hcdbQ/XOUK e X-Received: by 2002:a5d:4e4a:0:b0:33b:68d2:c5c9 with SMTP id r10-20020a5d4e4a000000b0033b68d2c5c9mr1442385wrt.8.1707811969753; Tue, 13 Feb 2024 00:12:49 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUhv7HcJZUaxKepPaqXlfGBs6Jto0eV0QW/c86+/oleUEDjymNxErcchK8KDSHA0b91m/xVsnaFINko6RqeG82c2ixyk9H9WDfvlw9MHB01+N2/h+AyFjRuTYba8pw8FP4vAY8V/r+RPmr0BasoDggJD7gR9yEIEEiGeJSJ/rOiui/dSh/goC7y/E/YvJRlzBzLPhEVfZQeKgj0HS9FaToXQy4rAu7TgSIJ8CONb1oi0yTIMgN/ZGYlk5Z+0Mllmhrt/bOPc9/NU95UDvn+mq+JeSdm5f0= Received: from m1x-phil.lan ([176.176.128.243]) by smtp.gmail.com with ESMTPSA id t24-20020adfa2d8000000b0033b86b38611sm3549752wra.10.2024.02.13.00.12.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 13 Feb 2024 00:12:49 -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 7/9] hw/ide/ahci: Do not pass 'ports' argument to ahci_realize() Date: Tue, 13 Feb 2024 09:11:58 +0100 Message-ID: <20240213081201.78951-8-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::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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 Explicitly set AHCIState::ports before calling ahci_realize(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/ide/ahci_internal.h | 2 +- hw/ide/ahci.c | 9 +++++---- hw/ide/ich.c | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/ide/ahci_internal.h b/hw/ide/ahci_internal.h index 4dc2805d21..4e13329bb2 100644 --- a/hw/ide/ahci_internal.h +++ b/hw/ide/ahci_internal.h @@ -377,7 +377,7 @@ typedef struct SDBFIS { uint32_t payload; } QEMU_PACKED SDBFIS; -void ahci_realize(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports); +void ahci_realize(AHCIState *s, DeviceState *qdev, AddressSpace *as); void ahci_init(AHCIState *s, DeviceState *qdev); void ahci_uninit(AHCIState *s); diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 2c3306dae4..33f7e83687 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1614,14 +1614,14 @@ void ahci_init(AHCIState *s, DeviceState *qdev) "ahci-idp", 32); } -void ahci_realize(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports) +void ahci_realize(AHCIState *s, DeviceState *qdev, AddressSpace *as) { qemu_irq *irqs; int i; s->as = as; - s->ports = ports; - s->dev = g_new0(AHCIDevice, ports); + assert(s->ports > 0); + s->dev = g_new0(AHCIDevice, s->ports); ahci_reg_init(s); irqs = qemu_allocate_irqs(ahci_irq_set, s, s->ports); for (i = 0; i < s->ports; i++) { @@ -1862,7 +1862,8 @@ static void sysbus_ahci_realize(DeviceState *dev, Error **errp) { SysbusAHCIState *s = SYSBUS_AHCI(dev); - ahci_realize(&s->ahci, dev, &address_space_memory, s->num_ports); + s->ahci.ports = s->num_ports; + ahci_realize(&s->ahci, dev, &address_space_memory); } static Property sysbus_ahci_properties[] = { diff --git a/hw/ide/ich.c b/hw/ide/ich.c index d190012a95..122fc7e0ab 100644 --- a/hw/ide/ich.c +++ b/hw/ide/ich.c @@ -113,7 +113,8 @@ static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp) d = ICH9_AHCI(dev); int ret; - ahci_realize(&d->ahci, DEVICE(dev), pci_get_address_space(dev), 6); + d->ahci.ports = 6; + ahci_realize(&d->ahci, DEVICE(dev), pci_get_address_space(dev)); pci_config_set_prog_interface(dev->config, AHCI_PROGMODE_MAJOR_REV_1);