From patchwork Tue Feb 13 08:11:52 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: 772269 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp142896wre; Tue, 13 Feb 2024 00:13:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IFH2gVkD9QGer2fztb6F6bsKjhT4slWU/61TE8RFUbic4fOLba/eHVp+JTUxDOjn/lQvUo8 X-Received: by 2002:a05:620a:1915:b0:785:db0b:c010 with SMTP id bj21-20020a05620a191500b00785db0bc010mr4187264qkb.56.1707812038683; Tue, 13 Feb 2024 00:13:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707812038; cv=none; d=google.com; s=arc-20160816; b=dOpnv4qukvRqXVQcEuxeP7r7fxuYGvauWaJoD/1jX8kKfQvqno0215KOkWegEJvAhp l03R8dqlFqJGUxE9uSW/vrdP4iPZbqiwrNNSMMQb61TIDhg0x0XFJ6DsSb88Oc/H3QSN k9pgyECM1Pq1rgMbBgbx/fVhk1KrJm8WZJJ8Y43JtYQCtPtjYDad0o+jdieXc2BahQ1b qKUD384AQhgn8zZWyCAPD4ijo8NOaJ0v2lugVilgn3uxqWdIRVfyyCxH0sIDeXkO6ZsW mXRr4dk10OF8Z5KSA0uS7QOs5jG/gLsUjcmsFRVpwchQB4GX2CXD1y8u7LCSjMmPvqCb 8MCQ== 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=24s0na+x6T/s2HoEAp3AWZgaRuEgOsYG8hssre/glwc=; fh=z7I5ru06hg4qCTf0teffSmEIwsbQ7G+dg8mUA+XY+YM=; b=kBjsH5365P4sb7XiXKq4jUALtppn53Bw2uNiC/dWfx8Z9z+54FpngLu+tJHvDSOJrq Vxk1i6an09hrl6pFgDhFfXF0PKdltmp/1hOC8N2lzdmEpauIIS3A8CSlZEs+lmEWOQWC WyGAV9cSv9oXK9QOkAtIJPJppznptAaeOYOTO77IsBc2Dvq6pj3iy1U+I8fzzU6u2KbP 26wpsL9msU21V2nAgZNvM2b2hr5CtuAbBJXfbbDiI8yEFsRAYHcT6I3z0+PB8b0an1V1 qgnAfPB4vWdrHYrHw8PPya4mp0P/0GsxA5Dlo4isokvONzyK0wP//1telTZdHh9VP9Wz muuw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Q/u3Zh66"; 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; AJvYcCWKWZwxbdm2J6201tpGwgqB5IcYToTaiYd/hsM/nqWhsj2SY3ijQh/AdmwrnWoQtQDGA8P3CbUR9GqEsS6/sCmT Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ee6-20020a05620a800600b00786e8836d3esi2826274qkb.673.2024.02.13.00.13.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Feb 2024 00:13:58 -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="Q/u3Zh66"; 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 1rZnto-0000QJ-MU; Tue, 13 Feb 2024 03:12:16 -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 1rZntn-0000Pc-3O for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:12:15 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZntk-0000ij-O6 for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:12:14 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-411c863c1c6so659165e9.0 for ; Tue, 13 Feb 2024 00:12:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707811931; x=1708416731; 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=24s0na+x6T/s2HoEAp3AWZgaRuEgOsYG8hssre/glwc=; b=Q/u3Zh66GkrQFROPvonglXEhBYDpcWS0IvRW+qbtXdAPCwuSIkPn5WZto8DHo5AYV9 Dr00HH0zHcKp0k600R4w6GHF6z9oDcgU3mlzsh5fOGmdt+GV0esqQIfHYV1pYQsr2nfk kbrmaUrXiltKxbTHjwYwLC60UD10C6t34m1g97nBwtnGbD6EuI7iwzBRhvKzARa4MHYJ k5RIU7/5YugBxrgJSZzS1iZkocEzuAYXtvcEU0fR2jXHG0+gZEgjo1RUYKd/SqsmDBgn ywN/X/NQKXVqaPMcGwyNbwdxFoCTBCwXMdeusv9IMhnDNBqx4uH78aduxCfDsFrO62Hd L26A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707811931; x=1708416731; 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=24s0na+x6T/s2HoEAp3AWZgaRuEgOsYG8hssre/glwc=; b=wBZMhLwrdue+ZT2SxxkhGf/TRGaWnN1gC9+4lXq1cxUT56GEz0hSXY+fOPNRjpQMEA TSejgldJx3ViJEsva+XqswPYl/kKCmJOImhDjCvYQjzQk0gN93pJo6TK7tq46PydAMlM xMqcMbs+iC4s5lfafQY6uhzPYCyl0F5D+DfneQg6QrSacITc8m6N1/7NFuCh9WsTjCoV +H2sfg05W8fNcD9UzoDTFBsUFW+5BaqfsB1hly3KSv4se5GTX7NwsGRDQlJssi0xMZYe O6Pa0c+yzVt1VcYGFqxBeW2XQqad7dmsZsKvJabWGQQNA9l2ATB2ZUmFWXtD9McoxqWl oxVg== X-Gm-Message-State: AOJu0YxTkxVhYCrGqzImeOP42JjgG7FwVgBd+5yxR/mzgtyQRnAKZgAg S12c01e+AnHH+ZDl7uiYr0sBKJ9zosDy2xSRMbRZMdzXQ0ndpUHnDGYzAbi5j6fypNl0OqFH3oZ p X-Received: by 2002:a05:600c:5204:b0:410:6d23:dd6e with SMTP id fb4-20020a05600c520400b004106d23dd6emr7631551wmb.13.1707811931188; Tue, 13 Feb 2024 00:12:11 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVZr/ZZeRsWJDXNqVUnG1h8mN8q7pav7jiHUq5Sbzq6SN7ZE6G5TekGAv4tT8asPRzo6QMZkXT1B+5Yg+UDWov94084c8aEZCDqqR67jWd3trdEhurssUi+a4RIDfyr8UpSzffOh35dPcDEk7DoEXTPYxtorIDqWvQPmqALWIgAW8aV4DyqUk9MijO6iMGX6huWbQC4tq7LaGDEdId1Vi5FkdVagchaOiPiDV4BW7SIpo1QQVj2gUS5+afBkiWmyCNsJinyQwvZiwHAaxcXimVavj3ApMg= Received: from m1x-phil.lan ([176.176.128.243]) by smtp.gmail.com with ESMTPSA id fc9-20020a05600c524900b00410727c315fsm10857739wmb.16.2024.02.13.00.12.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 13 Feb 2024 00:12:10 -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 1/9] hw/i386/q35: Use DEVICE() cast macro with PCIDevice object Date: Tue, 13 Feb 2024 09:11:52 +0100 Message-ID: <20240213081201.78951-2-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::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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 QDev API provides the DEVICE() macro to access the 'qdev' parent field of the PCIDevice structure. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/i386/pc_q35.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 7ca3f465e0..33a4413708 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -309,8 +309,8 @@ static void pc_q35_init(MachineState *machine) PCI_DEVFN(ICH9_SATA1_DEV, ICH9_SATA1_FUNC), "ich9-ahci"); - idebus[0] = qdev_get_child_bus(&ahci->qdev, "ide.0"); - idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1"); + idebus[0] = qdev_get_child_bus(DEVICE(ahci), "ide.0"); + idebus[1] = qdev_get_child_bus(DEVICE(ahci), "ide.1"); g_assert(MAX_SATA_PORTS == ahci_get_num_ports(ahci)); ide_drive_get(hd, ahci_get_num_ports(ahci)); ahci_ide_create_devs(ahci, hd); From patchwork Tue Feb 13 08:11:53 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: 772267 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp142809wre; Tue, 13 Feb 2024 00:13:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWtobppKifHaIYs84Xi+NCE9Srqk4EXnbISzBMwbpjUPJo7VPJgLsJ9AnDpDylMRu6ga8Yon7F7pXxcenYXFyVI X-Google-Smtp-Source: AGHT+IH32szK8NO8UVwr1i7tKyq9LLG3z1l9SYOIOZPCjJVapylIKLw25k0Gzp75aUlAeJnJNRoC X-Received: by 2002:a0c:e4d4:0:b0:68e:ecdc:1104 with SMTP id g20-20020a0ce4d4000000b0068eecdc1104mr453340qvm.20.1707812020500; Tue, 13 Feb 2024 00:13:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707812020; cv=none; d=google.com; s=arc-20160816; b=O0emzgNFblVltSgkf2mj8Xp5QlfE8z+o/FG906p6/LKZRx6F5LhiXm8cHXOHpqoKRL WOlBcqcwJr3Ku+QlgWJZk4p1bNNIJBvRDUdpz1Lcyc1WcQPklgejo5KyCcEuTDXDvWtf KwM06jEPX4A00k+w+eskd1IyOBxHWOkLQOywYGbqDvUHNJ/DCCFj7lXr/ecnJgb/MjDS CVe5DoTno78GUrlxlYmG38cBFUK5O+7mq6IzU8YPImtK2T8a+8eCeoI1q+txdUbB51bn cKkDLparGFE0of8iw95jm3kmTRwfLU4sOmmr7F5TxjQp9dy8qTCSk93y/1qCMcsbPzPz Yl2g== 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=N8pdPclv//gTPDxcO4OPrK97h1/L6R/pG9BlhZPSR0A=; fh=YBdP4ul+j6z99FIlX3wEgsi0Ytc3KiRTpkIHAwzz3oM=; b=1K4ZkBS1Lmuj9dJpG9puOjUXYEBULk5atYEmODEda6mnO4Fw7/ShU/aZHni52E24m5 MdBq/VRTYRVARqhBnCaPhX9I87jFn/NPLoXN8RYynPXQbpq71bFfqzNFJyYp8dZFUFap FthBSn+cIu/Rje4HfW3fgtQM57UeGqmi5cjW7nNSAzxCD8EAfuyzvs/M1W97ELA5Ql/y FVsZgMbmqWxA29w+ZN20wubJTVQnLiUl7T+YUX0Lw/xcBvgfuOfLRgVbfCV0bUbrYuTo wAu7bu2BCEsBAFqrSYXeO463mP4SLfrBm16oESj4UblrtLyXgLejRZNA8F2YjIz45hRm q7tw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rbu1YKDe; 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; AJvYcCV3rtEc2VCAdnHHvo2YrPMcY9Q090BKdvUOurfT1uvp6s8rpF28ZFakYW9G1SWejbrYQALfvbA8XSWz8Ozt9MSP Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r9-20020a0562140c4900b0068d034d08b1si2233876qvj.305.2024.02.13.00.13.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Feb 2024 00:13:40 -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=Rbu1YKDe; 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 1rZnu2-0000VU-GR; Tue, 13 Feb 2024 03:12:30 -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 1rZnu1-0000VC-9i for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:12:29 -0500 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZntr-0000jV-Mi for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:12:29 -0500 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-5119da22560so87544e87.2 for ; Tue, 13 Feb 2024 00:12:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707811938; x=1708416738; 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=N8pdPclv//gTPDxcO4OPrK97h1/L6R/pG9BlhZPSR0A=; b=Rbu1YKDeqQD9sBjTW/ETdKbKUallfiWhwgfPuyA0bdDbljU0JjEf3gvbwxAtZRVNPA AxF3MJyXakXsH3+V/TreGeQF8YA6K6uqrXAjo4mt5rPvOWfTMxYFDzis0n3TCWwgrP6X pnuAeF4Llm4q7Uok8TjPm5pvoOj8oLJzComTaWEMj7NPb0PHRtgSSjn81oNzfCR2gfq1 Q6Z+3kJZwgHSEgov8sA57piK2g36l4uMtv6Hv+H3IIuIuzks6xnsyLRHclvRkhqVXuy9 pgqXurnH/IjsXr4QR4hJlulsKEQekPCNn2E183FjcpiAK0kyjY22TasIFIpTSry098k6 5njA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707811938; x=1708416738; 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=N8pdPclv//gTPDxcO4OPrK97h1/L6R/pG9BlhZPSR0A=; b=spIWxgov0lc1rRFeUDDL2autCoWWHrPylyKBNPhvz1ja4FM5tKDWGfPP8LEX1wril+ GjuVUAFC+Wu/5J4rS+MJSbwtym3qZdPvzQUlpUpZmN1i1MGpw6n+7xU4qnja4n+GaMK+ chA/C5aIJQy21AZha9+VdlEzSHi/A2lVW0uQbvCigMD8P+fd04WNQtb00MzLftXZrPpR Wzasik6uolfVRZwLuk4D3UZHRVWkLC0+A4SI24TOkV4wa//v12ODWmFcUsKV8+HgIwLV b5zl1l+u1/VJqGuYks67nZx1HWuIDkWQTVaVpY/qTDleG8KHqrIsu3LTnqBRS0bMJ30K DglA== X-Gm-Message-State: AOJu0Yyqqhol8XGrJnRhrr7kO9HheDEMvZ0B/rqvfXx5lugzFkMJDkWy EjxZflQtOPv6HfU3Z39ctPAhwaIm9ulU4HTcIm8LN79yIvObOvI0TsFjHQMr12EMrQbVqayHMxO W X-Received: by 2002:a19:8c0e:0:b0:511:9ca1:12ee with SMTP id o14-20020a198c0e000000b005119ca112eemr511914lfd.51.1707811937613; Tue, 13 Feb 2024 00:12:17 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCV5O8aKJAF8ta5d8oV1lTUbDj+XjaNQOCUHaQvFKpq/cHbV+NItK3hFig8zdYJsjduZfp+Qu1J2YwdhTBtQJ1FfBi56lMPjVIZnw6Zf2+NdRYI0fiCrISCu7fhmqjq4yB7GS2+QT1VxrsrfVyxA9vQ4XA3yHALEapzOwY6Q9FjFW3wkOMUsQjOi/emBD77maZWbA4V8pOMScEo6LA6r99CV+X0CZvel7uPZssxi1TYFwLgYaCV+5WAvYN+i8m2Pn/M0gsP/LuHOidW78zeap7hZur6Zg6hGEOWoGCY1+bil388JbZJP8k/06YPYrJM/NM9dFpXOz119QTBuGV0Mob73zoINJa5xSKrMjw== Received: from m1x-phil.lan ([176.176.128.243]) by smtp.gmail.com with ESMTPSA id s8-20020a7bc388000000b00410bca333b7sm6493537wmj.27.2024.02.13.00.12.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 13 Feb 2024 00:12:17 -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?= , Paul Burton , Aleksandar Rikalo Subject: [PATCH 2/9] hw/ide/ahci: Expose AHCIPCIState structure Date: Tue, 13 Feb 2024 09:11:53 +0100 Message-ID: <20240213081201.78951-3-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::134; envelope-from=philmd@linaro.org; helo=mail-lf1-x134.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 In order to be able to QOM-embed a structure, we need its full definition. Move it from "ahci_internal.h" to the new "hw/ide/ahci-pci.h" header. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/ide/ahci_internal.h | 8 -------- include/hw/ide/ahci-pci.h | 22 ++++++++++++++++++++++ include/hw/ide/ahci.h | 3 --- hw/i386/pc_q35.c | 2 +- hw/ide/ahci.c | 1 + hw/ide/ich.c | 1 + hw/mips/boston.c | 2 +- 7 files changed, 26 insertions(+), 13 deletions(-) create mode 100644 include/hw/ide/ahci-pci.h diff --git a/hw/ide/ahci_internal.h b/hw/ide/ahci_internal.h index c244bbd8be..4dc2805d21 100644 --- a/hw/ide/ahci_internal.h +++ b/hw/ide/ahci_internal.h @@ -324,14 +324,6 @@ struct AHCIDevice { MemReentrancyGuard mem_reentrancy_guard; }; -struct AHCIPCIState { - /*< private >*/ - PCIDevice parent_obj; - /*< public >*/ - - AHCIState ahci; -}; - extern const VMStateDescription vmstate_ahci; #define VMSTATE_AHCI(_field, _state) { \ diff --git a/include/hw/ide/ahci-pci.h b/include/hw/ide/ahci-pci.h new file mode 100644 index 0000000000..c2ee616962 --- /dev/null +++ b/include/hw/ide/ahci-pci.h @@ -0,0 +1,22 @@ +/* + * QEMU AHCI Emulation (PCI devices) + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef HW_IDE_AHCI_PCI_H +#define HW_IDE_AHCI_PCI_H + +#include "qom/object.h" +#include "hw/ide/ahci.h" +#include "hw/pci/pci_device.h" + +#define TYPE_ICH9_AHCI "ich9-ahci" +OBJECT_DECLARE_SIMPLE_TYPE(AHCIPCIState, ICH9_AHCI) + +struct AHCIPCIState { + PCIDevice parent_obj; + + AHCIState ahci; +}; + +#endif diff --git a/include/hw/ide/ahci.h b/include/hw/ide/ahci.h index 210e5e734c..6818d02063 100644 --- a/include/hw/ide/ahci.h +++ b/include/hw/ide/ahci.h @@ -52,9 +52,6 @@ typedef struct AHCIState { } AHCIState; -#define TYPE_ICH9_AHCI "ich9-ahci" -OBJECT_DECLARE_SIMPLE_TYPE(AHCIPCIState, ICH9_AHCI) - int32_t ahci_get_num_ports(PCIDevice *dev); void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 33a4413708..ace8d3839a 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -47,7 +47,7 @@ #include "hw/display/ramfb.h" #include "hw/firmware/smbios.h" #include "hw/ide/pci.h" -#include "hw/ide/ahci.h" +#include "hw/ide/ahci-pci.h" #include "hw/intc/ioapic.h" #include "hw/southbridge/ich9.h" #include "hw/usb.h" diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 0eb83a6d46..aa9381a7b2 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -36,6 +36,7 @@ #include "sysemu/dma.h" #include "hw/ide/internal.h" #include "hw/ide/pci.h" +#include "hw/ide/ahci-pci.h" #include "ahci_internal.h" #include "trace.h" diff --git a/hw/ide/ich.c b/hw/ide/ich.c index 49f8eb8a7d..d190012a95 100644 --- a/hw/ide/ich.c +++ b/hw/ide/ich.c @@ -69,6 +69,7 @@ #include "hw/isa/isa.h" #include "sysemu/dma.h" #include "hw/ide/pci.h" +#include "hw/ide/ahci-pci.h" #include "ahci_internal.h" #define ICH9_MSI_CAP_OFFSET 0x80 diff --git a/hw/mips/boston.c b/hw/mips/boston.c index 4e11ff6cd6..cbcefdd693 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -24,7 +24,7 @@ #include "hw/boards.h" #include "hw/char/serial.h" #include "hw/ide/pci.h" -#include "hw/ide/ahci.h" +#include "hw/ide/ahci-pci.h" #include "hw/loader.h" #include "hw/loader-fit.h" #include "hw/mips/bootloader.h" From patchwork Tue Feb 13 08:11:54 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: 772268 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp142865wre; Tue, 13 Feb 2024 00:13:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IGROz4IEO7DvDP9sThrGGkgXC+8AxI9GvrqVHHr2TzGHHA4ch415pgpuSt7yjRJVhLiXIQc X-Received: by 2002:a1f:e082:0:b0:4c0:1bb6:322 with SMTP id x124-20020a1fe082000000b004c01bb60322mr4958721vkg.15.1707812029825; Tue, 13 Feb 2024 00:13:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707812029; cv=none; d=google.com; s=arc-20160816; b=KUYp9Zx8By7Yo4O7W9cwg5DUwY2N0oqPLsJpoPg5lhi9IJVd0d/yJRNz3JwsdvZOaa thH/cwBSScuPsgSsrzDI8x0BcjQ0ouZpDSkRRJmQs54DoefPyCeuvrgFrXZBAMZX1TKn dLF8kL9W9gVLC1vJqameFi1q3Afi/uJzL/HWP7wyejG8SkDxeb+wPDRfDs7AzwvxvUVx yBBlA3AfeOhTT9QgVSA5aJ2f91hz8R8ORzxMTuDE0OA/4RBCQGiLO+6xyQA2+FTFOSfK S65snD1wB+rpTDp72PJiks/I9RexgIGcUZyvsT5sFikxqZq0HrTgjdpdOl0zo3jD5MJn zPGw== 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=5xcNsXW9mDVOPPZyrAplUMmD9sMhDYldoYl40GQNnJE=; fh=K7bZQbWlr8sApBN1jLibRjel8vcYUEWNcKxgx8ktZso=; b=iHAueQt4ByLmWT1bs7Xk+Y/sgobKgRJrm8+b9pR4ohKC35JANnDv9IprHSITHvKi9n ohUpIBx+tw4bquZTtqpUk79LzklYH9cCF1U4hfddN2hmNeT2Smj+Uf/WXUkp43EOPPmJ nyp/4vK9lLeRkE8P4jvAlyWEqLqVYVtldTZpAsq9/cJwMoIY784/u7NjFT76akR19lZq 36p3AK+3CH0xrJnC2Tyatl0j1Q3T24Xhh2MI4G+GiLzIWMZGhakKlpguOlAQgOcwsECx mEG4W15E+NipFgy2Rb+ldAADT0SA0dlLkIDL52V5qMshpw/ZpreWc39zdVGwRrT9ALXb IhyA==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bt2K0ORg; 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; AJvYcCVohhFOeML3bSOfwPngoNeTnhGZ8zbP+V1IqzXGM/XhqRHswGPRnm6Jm4kGLrsJbv6FG8DOQu7S8oMKJIu4J+VC Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d12-20020ac847cc000000b0042c75a66b95si2171917qtr.799.2024.02.13.00.13.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Feb 2024 00:13:49 -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=bt2K0ORg; 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 1rZnu6-0000WR-8t; Tue, 13 Feb 2024 03:12:34 -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 1rZnu4-0000WH-I0 for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:12:32 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZntx-0000ox-RY for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:12:32 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-410db155e57so11924575e9.1 for ; Tue, 13 Feb 2024 00:12:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707811944; x=1708416744; 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=5xcNsXW9mDVOPPZyrAplUMmD9sMhDYldoYl40GQNnJE=; b=bt2K0ORgObQUwQ/rduDMZ9j69987lh8ykygTRCUy27yMi7+xDO4WDSGZpKMIQ1irKY ho5QbZps7BNMSMip/1xA6zlY06AULWadYXdbWD2RqNmA0f2LFtDpx9se1pMYbcrxQnQb pX2E+U32z33OVzPYDtQgPMoGAtotrsWh5P0en1c1OxzW6UHlNjB6GStDFu4MqXeul7ho ClApyxCoaydoxNiyz1f9XPNaR09cFx2oa1SrCq3R23Ab+x83FrjZs624HiaHDCFvKArE V7QJcYE2LoNW4YEPInIZL0pn5ZaDgGDT5sSPW7nsYQWnxE4ct57tvIAehDcMzealYg/z gVIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707811944; x=1708416744; 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=5xcNsXW9mDVOPPZyrAplUMmD9sMhDYldoYl40GQNnJE=; b=RfUP+JvUvDg2PTEWbBv+qShYY1g70hwoTt+d/Pxk2X5K/iG9LokO3oLp7tv/k1YEEv 9zQWH+Grm8m6MNx8WY5G0LGiAGuP13oPpapzT0O3PZwzPkZJ665MtThTAWX00rJORm7c 114gTkoXmBrwgdb/yMRES2w5/cO0R0z816ywSrxbiobr0iKN7e8d+SXzueLvj/zQpEkK pY48p7b0oTCmuN+KvdOnxETXJbaRfXQfpSqiw1i2UXOWYefiB8/7ulUBJrOTnGe4Oyn5 OTY8CmDtRQNQ29FR9e5dFmFVb2SLRi9rz0nr3+nrAjR0+FfZtGkBGPJcALfdJm6Ie1yI TIfQ== X-Gm-Message-State: AOJu0Yz42aez2SStlNqTEMX7Qo0dFtAgu4DrjGK0JpAYZeJKmIuInKWp R4ASfg2B1KtsplNzFpFgfhQXbKekyDTVXh2IlQ4tdvwnKPFKdMVQA+hiYvqqYURqHGrM1rnxvpb R X-Received: by 2002:a05:600c:c89:b0:410:888f:f342 with SMTP id fj9-20020a05600c0c8900b00410888ff342mr7260646wmb.4.1707811944206; Tue, 13 Feb 2024 00:12:24 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVNvjQ2bTAysAnkRoMSOG0D/8BnRZOKyOXKKUUDRAjHR003X98VUGsTFLG1MZRTMGHUj0MA3wj5i3qAmdxzaTWa6ynfVBwGZe/4fbu7HwBdQzILKZxcruW9IAQc78iTES5IPL6vRAxDSV9J3xLrS9lrYunSRrqof3GoWxqO7C7zbdfZOZf982xJN4tLX7P0eX6aEQ/6GWbZFQpiOnBT+ijlCTmMJgQ//q7NLry/xEni/wbV9ZWfILxMFdBRDOchW66fYjqR+yvFIUxoAlUr7jW9TbUIn+09I6g1U86Leepp1tw6HGlsQz1kQbJkKVnPMAT2GZV9IAyML9aG3nxoQ9Vp+W7i/mXv2aqY3w== Received: from m1x-phil.lan ([176.176.128.243]) by smtp.gmail.com with ESMTPSA id cc19-20020a5d5c13000000b0033b728190c1sm8318048wrb.79.2024.02.13.00.12.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 13 Feb 2024 00:12:23 -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?= , Paul Burton , Aleksandar Rikalo Subject: [PATCH 3/9] hw/ide/ahci: Rename AHCI PCI function as 'pdev' Date: Tue, 13 Feb 2024 09:11:54 +0100 Message-ID: <20240213081201.78951-4-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::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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 We want to access AHCIPCIState::ahci field. In order to keep the code simple (avoiding &ahci->ahci), rename the current 'ahci' variable as 'pdev' Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/pc_q35.c | 15 ++++++++------- hw/mips/boston.c | 10 +++++----- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index ace8d3839a..e298f4ff32 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -135,7 +135,6 @@ static void pc_q35_init(MachineState *machine) GSIState *gsi_state; ISABus *isa_bus; int i; - PCIDevice *ahci; ram_addr_t lowmem; DriveInfo *hd[MAX_SATA_PORTS]; MachineClass *mc = MACHINE_GET_CLASS(machine); @@ -304,16 +303,18 @@ static void pc_q35_init(MachineState *machine) 0xff0104); if (pcms->sata_enabled) { + PCIDevice *pdev; + /* ahci and SATA device, for q35 1 ahci controller is built-in */ - ahci = pci_create_simple_multifunction(host_bus, + pdev = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_SATA1_DEV, ICH9_SATA1_FUNC), "ich9-ahci"); - idebus[0] = qdev_get_child_bus(DEVICE(ahci), "ide.0"); - idebus[1] = qdev_get_child_bus(DEVICE(ahci), "ide.1"); - g_assert(MAX_SATA_PORTS == ahci_get_num_ports(ahci)); - ide_drive_get(hd, ahci_get_num_ports(ahci)); - ahci_ide_create_devs(ahci, hd); + idebus[0] = qdev_get_child_bus(DEVICE(pdev), "ide.0"); + idebus[1] = qdev_get_child_bus(DEVICE(pdev), "ide.1"); + g_assert(MAX_SATA_PORTS == ahci_get_num_ports(pdev)); + ide_drive_get(hd, ahci_get_num_ports(pdev)); + ahci_ide_create_devs(pdev, hd); } else { idebus[0] = idebus[1] = NULL; } diff --git a/hw/mips/boston.c b/hw/mips/boston.c index cbcefdd693..0ec0b98066 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -677,7 +677,7 @@ static void boston_mach_init(MachineState *machine) MemoryRegion *flash, *ddr_low_alias, *lcd, *platreg; MemoryRegion *sys_mem = get_system_memory(); XilinxPCIEHost *pcie2; - PCIDevice *ahci; + PCIDevice *pdev; DriveInfo *hd[6]; Chardev *chr; int fw_size, fit_err; @@ -769,11 +769,11 @@ static void boston_mach_init(MachineState *machine) qemu_chr_fe_set_handlers(&s->lcd_display, NULL, NULL, boston_lcd_event, NULL, s, NULL, true); - ahci = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus, + pdev = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus, PCI_DEVFN(0, 0), TYPE_ICH9_AHCI); - g_assert(ARRAY_SIZE(hd) == ahci_get_num_ports(ahci)); - ide_drive_get(hd, ahci_get_num_ports(ahci)); - ahci_ide_create_devs(ahci, hd); + g_assert(ARRAY_SIZE(hd) == ahci_get_num_ports(pdev)); + ide_drive_get(hd, ahci_get_num_ports(pdev)); + ahci_ide_create_devs(pdev, hd); if (machine->firmware) { fw_size = load_image_targphys(machine->firmware, From patchwork Tue Feb 13 08:11:55 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: 772266 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp142644wre; Tue, 13 Feb 2024 00:13:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IEtdR43ife1210Vn7Avdaf3he04K/nrGtj4YQbVCSU3uyee/Y7SEiC5PqzrsAkBgcKnsyDy X-Received: by 2002:ac8:5bcf:0:b0:42c:6416:b288 with SMTP id b15-20020ac85bcf000000b0042c6416b288mr11895607qtb.18.1707811991517; Tue, 13 Feb 2024 00:13:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707811991; cv=none; d=google.com; s=arc-20160816; b=BGQ11uU9tM0FPcEOp2h5xS8NqEluAlR6dTihHsLd+d4RDV+WRrtPzvaTerv51xBkRd R5LQnclUdtVkksUcK5c0f5jYKz/0g77mQlEj58nlCUKhrki5ep5px37F8qM77eo6D+4H YO8l2eZ5SY+uFJUN/7RfOhZwoZb3od7IzlTweF6i2Flhxy5/GPS0Slx+M0TJbGCY75wc oommn/LnI7B74FrPLQ5SXPcj7PWpyQHTMUrTYrUZ4JLikIDIyhEc5Q4enerUysYVe0e0 +4P0TzWKICNuvdccm99lnHA+gw8/2UMv3dGGJD+vKHu4evlpfzp7HHObijkcq/Qu6z9C pcDw== 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=L/ev/rbWgQ4Tjt8IzrgKY2Bj8EwxwI7ToduD8QMlTVc=; fh=pZhKr/vDpUCPh4QXB/f0AtR7G5gknQVLH1n1m73VUB4=; b=D6AfsOOxdhYog+1ump9tx1AOTuQg1iR2f5VB+FplguHpFUF5P+VrzGcKXtP0r6vuwU J38ZjcWiJS5GBmv1whvM16XNcJKLU3z7p09AGgjhFwdYusuCMsmbrM8KyeXVH+8uj7Uf NMucSkg5d7lMHgS8uBPRKysnlBv7Axw+AgznY30VZbOm1HzqxeKhTU6LdyHMotsF/dXa AnrsxHWXdUSpKC+kOWTnnFj6HvD520zyWiyILxTUyBbHuaApaZCYQ72xjrhH5lAMNy5m koJh891iO48cIxR+S11IleRPfc7429Zsv/4FhhKXVPsfSuENVKtV3OPLa2ILTgBTK/YC qLIw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OmHPij1n; 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; AJvYcCUEDq2Rtf8++77EdBSHOOBxOnCruOh6cY8AUgDhi3UROiPJG8dxVf8r0cdcERTUZDOQElrVcSivY6uGiaby8aS2 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u19-20020a05622a011300b0042d8814e9eesi2620512qtw.459.2024.02.13.00.13.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Feb 2024 00:13:11 -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=OmHPij1n; 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 1rZnuF-0000Yc-JX; Tue, 13 Feb 2024 03:12:43 -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 1rZnuB-0000YC-6c for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:12:39 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZnu5-0000sD-Bl for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:12:38 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-33b2960ff60so2867094f8f.1 for ; Tue, 13 Feb 2024 00:12:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707811950; x=1708416750; 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=L/ev/rbWgQ4Tjt8IzrgKY2Bj8EwxwI7ToduD8QMlTVc=; b=OmHPij1nMHWSDXhbNPXLWOaTIXovogV9PHuX1FZW+fYdJVATVdvVltVi1jht9RthS4 XdcwIb41iBvJEIxqMNGyofBHCjKd8lHOYhOllKycnaBRmLBBgx9V3pqwqh0OSYuEHr41 6K7OPKjS7N/7jkxxIs3T9Pb+4n5CabKDAGVS404+eW4QEizUKa3I28V6H9vrOqCHa0b3 iPbvqROYJxK9DNhEBdxmVWlx6TiaNl7wc9cb0wJXE0ey7BaGOFNjgAU08WczsiGQ157e Hg/gyGQ85Lcstbug83SiRZQmi3eYtfJpsxK7rnqqrNEQRGVHod5r1MF50lvIttfG0Nbb 71YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707811950; x=1708416750; 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=L/ev/rbWgQ4Tjt8IzrgKY2Bj8EwxwI7ToduD8QMlTVc=; b=a0QXeoH1tUILqoFqazB458eJHLcyt9N4GNbrn8i40rJhlVkIicBe8+EKZAXuw/L/ex o9mlqVNUD+abow8C7Lko/UnVs2W5D8QAHSwX0nr3snSf26UF0iq/8Fk55dBiue3fmts8 KcFosCJAFV3ZpdV/tEM+gG4ifN5PgodUgmWcgQqmE9vE9XTkMIudaY149ZfyL25Osz7g KblP/5ncVIxMlTdw8EdWIq32yeuovdAS6FsxHMK10meWBUFcAXIl0A63/WXvD4GHXbb4 BJ4oZ4vIWGgD94eMI4Cx5WqWA9hHVEERF+ZgxamdVAxfucz2MXUbHWI7L+2D+CBNDurP hH6w== X-Gm-Message-State: AOJu0YzdiiKdV9Uo+4H+4tKf0DQA/YEKf1/SeJi/iNc5bHtxKMjKB9os WH+5sdEzlNVTI9pYQZGAWVobr8BcSVfXShzIw2kQCAuYp3inQbB6IBbAxkTuEgZVQwfQT0h6q7G V X-Received: by 2002:a5d:5f93:0:b0:33c:cfb5:aab9 with SMTP id dr19-20020a5d5f93000000b0033ccfb5aab9mr1450931wrb.3.1707811950579; Tue, 13 Feb 2024 00:12:30 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUclnUpMmQ39qAeZEAkb6sL8xgztDx1rzjwtf7Mfp8iT9JZOckg0N4x1PPNg5rcSdh/CMdkEZN3pUnqsMVRRbwXVBLyLl/l8QcQ92qu7bHn6MXYLFQIezJlt3My341sDdbD3YM/2vqqgkyRygJdkGITRO5Senfo30QrcInMKJxCBJHh3vkaeyhtLpu1pdnXCZZ+3gLbxvRKsfP6TergMLepXAZznBYqkWhORjvvY9g1g6enTBS+ok/kZFpQOadYTMALjGOgloJbxvWITsLnw4ZJEk8YbjQfXp05oO4TvLrJY61zEFcphHYcZCvSyCPH40HdDmxs5ss6+5T1Pnh+qAqZ3WhJLj2r8BdvXA== Received: from m1x-phil.lan ([176.176.128.243]) by smtp.gmail.com with ESMTPSA id y8-20020a5d4708000000b0033b507b0abdsm8799389wrq.32.2024.02.13.00.12.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 13 Feb 2024 00:12:30 -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?= , Paul Burton , Aleksandar Rikalo Subject: [PATCH 4/9] hw/ide/ahci: Inline ahci_get_num_ports() Date: Tue, 13 Feb 2024 09:11:55 +0100 Message-ID: <20240213081201.78951-5-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::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=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=no 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 Introduce the 'ich9' variable and inline ahci_get_num_ports(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/hw/ide/ahci.h | 1 - hw/i386/pc_q35.c | 6 ++++-- hw/ide/ahci.c | 8 -------- hw/mips/boston.c | 6 ++++-- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/include/hw/ide/ahci.h b/include/hw/ide/ahci.h index 6818d02063..dbef377f3d 100644 --- a/include/hw/ide/ahci.h +++ b/include/hw/ide/ahci.h @@ -52,7 +52,6 @@ typedef struct AHCIState { } AHCIState; -int32_t ahci_get_num_ports(PCIDevice *dev); void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd); #define TYPE_SYSBUS_AHCI "sysbus-ahci" diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index e298f4ff32..c50e3bfc42 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -304,16 +304,18 @@ static void pc_q35_init(MachineState *machine) if (pcms->sata_enabled) { PCIDevice *pdev; + AHCIPCIState *ich9; /* ahci and SATA device, for q35 1 ahci controller is built-in */ pdev = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_SATA1_DEV, ICH9_SATA1_FUNC), "ich9-ahci"); + ich9 = ICH9_AHCI(pdev); idebus[0] = qdev_get_child_bus(DEVICE(pdev), "ide.0"); idebus[1] = qdev_get_child_bus(DEVICE(pdev), "ide.1"); - g_assert(MAX_SATA_PORTS == ahci_get_num_ports(pdev)); - ide_drive_get(hd, ahci_get_num_ports(pdev)); + g_assert(MAX_SATA_PORTS == ich9->ahci.ports); + ide_drive_get(hd, ich9->ahci.ports); ahci_ide_create_devs(pdev, hd); } else { idebus[0] = idebus[1] = NULL; diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index aa9381a7b2..8b97c6b0e7 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1896,14 +1896,6 @@ static void sysbus_ahci_register_types(void) type_init(sysbus_ahci_register_types) -int32_t ahci_get_num_ports(PCIDevice *dev) -{ - AHCIPCIState *d = ICH9_AHCI(dev); - AHCIState *ahci = &d->ahci; - - return ahci->ports; -} - void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd) { AHCIPCIState *d = ICH9_AHCI(dev); diff --git a/hw/mips/boston.c b/hw/mips/boston.c index 0ec0b98066..a6c7bc18ff 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -678,6 +678,7 @@ static void boston_mach_init(MachineState *machine) MemoryRegion *sys_mem = get_system_memory(); XilinxPCIEHost *pcie2; PCIDevice *pdev; + AHCIPCIState *ich9; DriveInfo *hd[6]; Chardev *chr; int fw_size, fit_err; @@ -771,8 +772,9 @@ static void boston_mach_init(MachineState *machine) pdev = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus, PCI_DEVFN(0, 0), TYPE_ICH9_AHCI); - g_assert(ARRAY_SIZE(hd) == ahci_get_num_ports(pdev)); - ide_drive_get(hd, ahci_get_num_ports(pdev)); + ich9 = ICH9_AHCI(pdev); + g_assert(ARRAY_SIZE(hd) == ich9->ahci.ports); + ide_drive_get(hd, ich9->ahci.ports); ahci_ide_create_devs(pdev, hd); if (machine->firmware) { From patchwork Tue Feb 13 08:11:56 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: 772273 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp143037wre; Tue, 13 Feb 2024 00:14:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUTFK+R6HSC8vP34tLWm+n9/ibSC27p2Py2xkSReXgVGxzABUvXGvRlXOe3jIVUgqeXaoD0l77S7gOMv2fbbV0X X-Google-Smtp-Source: AGHT+IGPl9jH6FBf/MUEtMpRrqP5dMA6KiTqH08+11jmzrnlPJo51HTsWAkiRo5UaeU0PQYm/QsA X-Received: by 2002:a05:622a:48c:b0:42b:f2c9:8fc4 with SMTP id p12-20020a05622a048c00b0042bf2c98fc4mr11936484qtx.39.1707812068424; Tue, 13 Feb 2024 00:14:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707812068; cv=none; d=google.com; s=arc-20160816; b=CMIDGl1G+J1kZcvVxIgmQvIE7NASCuHmbDPHVhIJ7mxJiw2lA3Ad5fqMhB4G37U2Pp c/esTzBGhEToPGRt+IBGNoDN0IsY322JgKjnMny163UqNo5M1OrdSNYhbDrQyuZ249dv 8FgBNRzwwW825KqWYHWX0IHPew+0KePpl5/N6oend1VUh9yhihvCjTpssTNxaBT4pj32 n5M1ZCoQtjos0WLIwwYcNDtzcQ7Hv3mC8cPSOMZmPRgqmECzfmjwwIQVwuJUkLaWVsUx 0+l3GTBsF2s4XW134NIMwoXrkDkzydhls3o02oTygT2aJPpg1YPwVVq9ZEsE2F/xs7OE xtLQ== 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=a4ug+gqIzlvgMFvPTiM99Fr6Vu5lvApMTDFifyvx+0U=; fh=WvDyX2dZnLWIv35d+Lo3tW6BvDqqpT/vIEyp3dwGYdw=; b=o4ju13Cmg54h2zMpyg9arCRvvLhoEiVeyliWfr/gnCdkwezegyGToUFr5G64kh5Z6S U5HuvCcypfLxibcyGYxvUyGClcPeTylz3z3FL0Qck+xLXCxisuJHdWzDeAtR7ne3DHMS cJ9nc2967FkOzaNwx0nfgwxiGNRFgaIq8SUtU1alzcWyw1sZwp2mFiOzNdBDWOglgQam TVReMiQRI7j++KdgIjdv/sy1y0K4fV8RiZmiHxr3j3XdU6m8WuYJAh4GHD/NB8EyXi+D KMIwG1hKnuXRvZP9ZRWpgbIFT8VjxpBq2xNbFMH4wV0qOxuCM4710fuoiA0LfvHouoGp Uhdg==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hJl4/HnI"; 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; AJvYcCUel8Nff5lsgiRGR8HPlhZStPyC2vbCUGy9/9Rp1v1j4Y6/CFLAWeIGNkZy3S7eF5i6d7rfqKRKJgsif/nAFwlf Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i25-20020ac84899000000b0042a87d0cfa7si2156327qtq.159.2024.02.13.00.14.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Feb 2024 00:14:28 -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="hJl4/HnI"; 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 1rZnuH-0000ZS-D5; Tue, 13 Feb 2024 03:12:46 -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 1rZnuF-0000Yd-30 for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:12:43 -0500 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZnuB-0000st-Be for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:12:40 -0500 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2d0c7e6b240so55080381fa.0 for ; Tue, 13 Feb 2024 00:12:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707811957; x=1708416757; 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=a4ug+gqIzlvgMFvPTiM99Fr6Vu5lvApMTDFifyvx+0U=; b=hJl4/HnIRU9x3VmCmxM5Z8T/YkhtZbh5hcTPb9q8aWZFzMXcw6d70z5/eLM/3s025o ldyVN3XBbDC/gs0Eoi8z01F5AZrd2BvliFPciS8/md782TwExvsRN2K7vXwHDHljkztu xluKixYyA5VfP2wLuRO+uswJx04DeZMw0ZgAfHHAdT3XwO99AN0F1LgR74UnzwZOlIQm Tt0CVKHGWHR5UsBY8lOwwG0EjeeAjGlMb1gxpC0dSJcac7sA0vm/xMoWJlOkqLRcdGeA v3np/E5OwOCKW5CaiyWkEceLqgGZCdF5YRPV0CvbMWDIrSl+kM3nqOWpL87Z9Pa71Tw4 plxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707811957; x=1708416757; 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=a4ug+gqIzlvgMFvPTiM99Fr6Vu5lvApMTDFifyvx+0U=; b=AxIUvbmCY769G75LvBVmHz0xVe4sCDM0RmCkH2laxbIdOBW9cRuq9kyiKAxViIJo1e XK1KmNDuAaOB0Jkcvma7z6dGpJWoK8agjOIrbkN7M/mhFt/hL+yhAMs51AqGbPKkAu2Q JP9Wfol4/ZqMYDPjNprSszpouFnFWbtBuitK3JPn6Kvp6c6OGQwDwvAPEguuoq+TNPNZ pjShPif3WkXiuqbo6pzgRFo9K0cRWSOwmEVlIHGuPbGfL8mo/vnbH7/2DaYv2ksEYcAd G3gzZxMBMbuXkcfAV1sYWT3Y6VbtMUzus8PnpJhFAJjS0hZPMgoOQf/Fc04slg4G3e9W u0eg== X-Gm-Message-State: AOJu0YyBVoFtwwysRpSeVZ4sPRvwkJy/lJ5YFflhaQoS8FclAO9mGnob Sl8xJJhyMSACbt2OBjORFdk1MkVKd64KUv+FiKCnY+OSLPyLMupIlc6lV2iAQKdnbDjBWwyHbEV G X-Received: by 2002:a2e:86c5:0:b0:2d0:f8d7:a91c with SMTP id n5-20020a2e86c5000000b002d0f8d7a91cmr3119336ljj.52.1707811957191; Tue, 13 Feb 2024 00:12:37 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXEBS51Yaa0dYKasaqeIyfMKcL4ZSG91xMTOHjNyeFwjuSoeUHGg2W0J45PZpF5sfTAWq4O7AamRSKu609B/uMQ0dwdKcligWmgyYw+B1eZ1e0o1Qyo4jN+2Ca5SrEGs+QpQDodMAsoIXcuPsdTshJicxnT3SzNCyXxIOat2WLZCrvklPdpd4yk2fjH4fAN4rE2LDHyB4g0zgdPmpfvQF3wIHKYtNGLnrPcVvbo5Q4pmqJlW13N9k2pymquFbpYzntB00J7RTT+2KF/cbG+KPcHwz3/gzptU3ilBaIfZ1+Aund3yXUmu2L89n1kPqnkORWVYvUcHMYBoFo+n8y87PvH9xABqy0aSv3GKQ== Received: from m1x-phil.lan ([176.176.128.243]) by smtp.gmail.com with ESMTPSA id fa1-20020a056000258100b0033b79d385f6sm6566745wrb.47.2024.02.13.00.12.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 13 Feb 2024 00:12:36 -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?= , Paul Burton , Aleksandar Rikalo Subject: [PATCH 5/9] hw/ide/ahci: Pass AHCI context to ahci_ide_create_devs() Date: Tue, 13 Feb 2024 09:11:56 +0100 Message-ID: <20240213081201.78951-6-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::229; envelope-from=philmd@linaro.org; helo=mail-lj1-x229.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 Since ahci_ide_create_devs() is not PCI specific, pass it an AHCIState argument instead of PCIDevice. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/hw/ide/ahci.h | 2 +- hw/i386/pc_q35.c | 2 +- hw/ide/ahci.c | 5 +---- hw/mips/boston.c | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/include/hw/ide/ahci.h b/include/hw/ide/ahci.h index dbef377f3d..8cd55b1333 100644 --- a/include/hw/ide/ahci.h +++ b/include/hw/ide/ahci.h @@ -52,7 +52,7 @@ typedef struct AHCIState { } AHCIState; -void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd); +void ahci_ide_create_devs(AHCIState *ahci, DriveInfo **hd); #define TYPE_SYSBUS_AHCI "sysbus-ahci" OBJECT_DECLARE_SIMPLE_TYPE(SysbusAHCIState, SYSBUS_AHCI) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index c50e3bfc42..7f4f51fcdf 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -316,7 +316,7 @@ static void pc_q35_init(MachineState *machine) idebus[1] = qdev_get_child_bus(DEVICE(pdev), "ide.1"); g_assert(MAX_SATA_PORTS == ich9->ahci.ports); ide_drive_get(hd, ich9->ahci.ports); - ahci_ide_create_devs(pdev, hd); + ahci_ide_create_devs(&ich9->ahci, hd); } else { idebus[0] = idebus[1] = NULL; } diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 8b97c6b0e7..bac1871a31 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1896,10 +1896,8 @@ static void sysbus_ahci_register_types(void) type_init(sysbus_ahci_register_types) -void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd) +void ahci_ide_create_devs(AHCIState *ahci, DriveInfo **hd) { - AHCIPCIState *d = ICH9_AHCI(dev); - AHCIState *ahci = &d->ahci; int i; for (i = 0; i < ahci->ports; i++) { @@ -1908,5 +1906,4 @@ void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd) } ide_bus_create_drive(&ahci->dev[i].port, 0, hd[i]); } - } diff --git a/hw/mips/boston.c b/hw/mips/boston.c index a6c7bc18ff..1b44fb354c 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -775,7 +775,7 @@ static void boston_mach_init(MachineState *machine) ich9 = ICH9_AHCI(pdev); g_assert(ARRAY_SIZE(hd) == ich9->ahci.ports); ide_drive_get(hd, ich9->ahci.ports); - ahci_ide_create_devs(pdev, hd); + ahci_ide_create_devs(&ich9->ahci, hd); if (machine->firmware) { fw_size = load_image_targphys(machine->firmware, 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() }, }; 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); From patchwork Tue Feb 13 08:11:59 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: 772274 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp143051wre; Tue, 13 Feb 2024 00:14:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVJbOw/0Fu64HIqPzsiy4ohuU0Nm8N7v4ymD/rVVRqS7k8WFaY0aVcDry6/L/DIiyO2vxuDxKFzsutU5Jd3UbGJ X-Google-Smtp-Source: AGHT+IHuA8oFkgM03oqP07JJc4LQgccwsZfYTxpzyoZlEGwbfS4Nx7ofmRh2AZfMkun9qLk7LLTy X-Received: by 2002:a67:f88f:0:b0:46d:606e:6323 with SMTP id h15-20020a67f88f000000b0046d606e6323mr5990589vso.2.1707812070686; Tue, 13 Feb 2024 00:14:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707812070; cv=none; d=google.com; s=arc-20160816; b=WDGf6M/z5Pdm/R7bGpTuAOHq4Djz2sdUjuH6WglYwhSnbl5hT/cU/rE+0BgSdwQZxK UVfbe/k885Qy4qpdOmjxE5Mqab1Wtin8UunqaGhhGZBcVsVNVtTluxyShNcSyqO5L1Gr 3+Wxu/89nxyNTHj4D1raFR2oUI9dVnVv/gB/93aA8P4UwZICvaziqTt226rbWn66/++L qv7m8LJzFesy5XmeATfoXDKhvkRSrSKHckduHImRr3kKlYbEiBRr3Nfs9xN7kCaRTMxH 0HUWIAuSOXlTZUnzMjj+SvBh480eLEgnLgz6aF6TKLk4BTKqPJ5EbVmId4mG9UIrvzgT 65bA== 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=o9Mll3b0jD3+V1gEhLcEmdspqDBWW+gx7Ndf0tUMfZI=; fh=o+IQOD4BIveFNppSFbiP6uXk+gP12zo4fFe6KHu+tHg=; b=sriS28c719eF1TorYEtBqSaxuSnaumLZ4LNH1osc9S0ebH+zGG6UgrySE9+LywVQtk NYc3gLKSi/1hXpvIR33S4kDjkYnDAKiNW39Q7vy/QoIhD42stzcvRuWGJllwFTfR87kS 5nm8MXuU/40t2YW2KtD52tIYTQ3XFLtDnwdlsEM/smVxAU2b6cQJ71cZBmjcTF0CBZIr xwRv8e9+GDTo0I56bKeuFLyaNtHaxfQwE3vZOVrYM3jqtF/Sfs2bxPtoDvCV9zHN89hA q19OeBk87DQP4TaoXRqC9DPWSjAt8rn04czvak/EOA/IUGIJS1N00N1bAZuT5h6oYY7K Eyyg==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ODlbnsDD; 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; AJvYcCUwyxHLn0Dmdw/LcCg7m6C16xlibFwnm9ggRnzvYdaqZWonupN7Nmu9GK036Z1e2ofzdAxyJzsZ/ANgG8YT8AFZ Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 12-20020a0562140d6c00b0068cd84add5bsi2332121qvs.12.2024.02.13.00.14.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Feb 2024 00:14:30 -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=ODlbnsDD; 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 1rZnuc-0000w2-7q; Tue, 13 Feb 2024 03:13:06 -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-0000uY-TL for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:13:03 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZnuT-0000v2-TH for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:13:03 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4114e0a2936so10243985e9.3 for ; Tue, 13 Feb 2024 00:12:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707811976; x=1708416776; 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=o9Mll3b0jD3+V1gEhLcEmdspqDBWW+gx7Ndf0tUMfZI=; b=ODlbnsDDlVkFrkvHkY1s/g+SmSP+mcpGx4jycFSii2JeolMY9XEOHpRUAH+o7x064s 3lmHjeL6snn149zESBGifQEsXvI/+FnpQNY2q6H0ulqeXm7MvYZRVcNvQ3/tlnmEyMz9 PCSQb1wEBQH9nnT47RntBV6/x0vmSfkqK/fSg4BzuQskw3iSoQ25dFyFbNvuc69ETd5S ybe/OcKaaylqiGp1S0pFLRqjtTyblcp+CFoK5JlaQ5OMWysB0WmL61eZ/W6qrburGkB2 uYvmA6ACb/7xUQX+VtlALRuVd7Kno5BUBl0BDPBND87lcBHwcAYv40yECQNhiLFT2Szq P9pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707811976; x=1708416776; 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=o9Mll3b0jD3+V1gEhLcEmdspqDBWW+gx7Ndf0tUMfZI=; b=TmcxRSsGD/vEbJydXO3I2izYodCFOahmn6xAItWpvIIaNgvYPJap8cBTNlQuZksJfT dzX30UybaIRlrHl3CitQZoCmCxPQPq8hWiVOKhFA8lJNag9JZCt/S3C7SMOcgXs7vsiV tEaMGyWNNkPmDpS9IIlM1qiuKSMqanPv3iLsYlUjirdC8NwHtbnclZS0KNb13RTXrDTJ HGa9pW37qIMyTWSV2E4Q94hnAFUzYy6nOcm5f1EDWSX1b1T3YKnoUiHJD8wNDbnRC67T djWP3zmyAvpnq/11JPYJbb8smn/qtQJtzI8lRwCyy92Da2B72dznY5oy0ecfxT9PCuDq bCeQ== X-Gm-Message-State: AOJu0Yw0nt9Ryyq0VNL7/ikJwCRP/sBpeMd3Ox2leyrGlInxUu+d1hM1 73axlXgGIuvjsJm4HJK18N4HBByrzapmDyiD24M5fVpReH7aTacztuAH8VVeZRG2RoBMVfQcQGd n X-Received: by 2002:a05:600c:5487:b0:410:cc53:a358 with SMTP id iv7-20020a05600c548700b00410cc53a358mr5102258wmb.16.1707811976001; Tue, 13 Feb 2024 00:12:56 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXaF3ktzSm9VNZed+L5sZ6c4prONn+fJw8l4SkEvOb17m90mnfPe+5XmmsYDYWotcewD9rRFWM9+Pmu6eLkzU0kthbmP9mpXvR0+6s8pQHcjfBzs7G4mcNatOq6EH8rTS720Ej7dwRhn3/St9xHVHpvn7McPF9FhDuilFvSWsP7r+5HqXyZ+MUJMHAriJuJHyA97L5oyyBCXlPdm2WiR1/HVGiXPY8vseL4TPb+JWCeEmGH+OyHwRn3bIbDIeRnrk4njCOC59dDzukORHPyHC3G9w3BiRM= Received: from m1x-phil.lan ([176.176.128.243]) by smtp.gmail.com with ESMTPSA id e1-20020a5d65c1000000b0033afb963d0dsm8828239wrw.101.2024.02.13.00.12.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 13 Feb 2024 00:12:55 -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 8/9] hw/ide/ahci: Remove SysbusAHCIState::num_ports field Date: Tue, 13 Feb 2024 09:11:59 +0100 Message-ID: <20240213081201.78951-9-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::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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 No need to duplicate AHCIState::ports, directly access it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/hw/ide/ahci.h | 1 - hw/ide/ahci.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/hw/ide/ahci.h b/include/hw/ide/ahci.h index 604d3a0994..c0b10c2bb4 100644 --- a/include/hw/ide/ahci.h +++ b/include/hw/ide/ahci.h @@ -63,7 +63,6 @@ struct SysbusAHCIState { /*< public >*/ AHCIState ahci; - uint32_t num_ports; }; #define TYPE_ALLWINNER_AHCI "allwinner-ahci" diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 33f7e83687..041cc87c11 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1862,12 +1862,11 @@ static void sysbus_ahci_realize(DeviceState *dev, Error **errp) { SysbusAHCIState *s = SYSBUS_AHCI(dev); - s->ahci.ports = s->num_ports; ahci_realize(&s->ahci, dev, &address_space_memory); } static Property sysbus_ahci_properties[] = { - DEFINE_PROP_UINT32("num-ports", SysbusAHCIState, num_ports, 1), + DEFINE_PROP_UINT32("num-ports", SysbusAHCIState, ahci.ports, 1), DEFINE_PROP_END_OF_LIST(), }; From patchwork Tue Feb 13 08:12:00 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: 772272 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp142995wre; Tue, 13 Feb 2024 00:14:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVcuHkggqDuuclfZnbgw4T/TH4/SIHyFlPgA7tjOqVbVDdMWbb46DESRPNxkySuy+lS569e2g6do6lrWBLnolxD X-Google-Smtp-Source: AGHT+IFDMfF+tx/7GTPbTjQdu4XJBheU08+9p6kC3Jj6KdPJLDky5VJNN5nVB7epcazwUIT6Nb8r X-Received: by 2002:a05:620a:560b:b0:785:c3b7:4e84 with SMTP id vu11-20020a05620a560b00b00785c3b74e84mr2838931qkn.35.1707812059700; Tue, 13 Feb 2024 00:14:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707812059; cv=none; d=google.com; s=arc-20160816; b=hjsrd3mh6fnuKuWDGVOJCEvV0/fJP/Z/MfSFpngo/RKC2E/t5Qkk2bZQHCeJ628MiK lI5JgGLUi2sqZgaIyKLO8Y4uEKU/2C2nUXbEJHVY7PktWCTzsnM6zdfFuDh4vvAjEuAt 5m9duiY+E6tYW6MECE+jdDoHVGsKaLA7VGdpTspEJT44KTYBCZzbwRROhu3NWDqjJmVZ KVS5kayn5YAzNaXz8lTLq79ZmAefMHeg8RoEIU5kjqsJ9dL4A6hFJqwxuGeSyPv1thOD OyYEa12S5H/lTwVT8Lui7CEmVp9tX4S6mMrd0TBf8VCQYdDJS+oJ59W5yfCk4BMxFDke hRMg== 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=l2VfWU0EmMkx2mEhciES4OHFukm6OT4OfeAh7mCbOtI=; fh=B3Zk29ydZzMsTXWgY1vtjDHznQ1HkFGdr4JdsMHk0rs=; b=JM4+S+FMiwHVvDThRzjrsGq4V2d2ouk+mo9VgSrC4cTq1QJYwlSPx76YDhuiSLIiAN YOuXdF9uF1cReZ0dasT9mJSbUCN39CGa9triNzhpCni7fXwXEzAg8UMBo0RWyCcZTigi OTMXtXXZ2me55HHKRsDRi057DpMMpHmW6Qf8gOxk/6au7wrFcj0z3jl4Cm9GMHlSIvJc 4yKORr905Z7Qaenk/D2vEM4A83cqSx6lXBp8rIoURvKGoflE5SNlN9w/A+foEy92T20o lW+l31bExROUMTmHdIRC45t6h66ikNV93COxYXmENH/sUaVpl4RW9FnSO/CztoiROFT7 GHUw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jzuHWtsN; 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; AJvYcCUOBUt01jlnVqbwdslstodPXlL2ZXx6ry87QwiV+mFuGL628QBsEx5yJUEgEvB+sEf5OrnvGc95qm43Th9/8fD7 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id qb6-20020a05620a650600b00785dafc62d6si3151349qkn.455.2024.02.13.00.14.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Feb 2024 00:14:19 -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=jzuHWtsN; 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 1rZnuf-0001It-IA; Tue, 13 Feb 2024 03:13:09 -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 1rZnud-00016g-Tg for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:13:07 -0500 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZnua-0000w6-Up for qemu-devel@nongnu.org; Tue, 13 Feb 2024 03:13:07 -0500 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-5114fa38434so4465292e87.0 for ; Tue, 13 Feb 2024 00:13:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707811983; x=1708416783; 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=l2VfWU0EmMkx2mEhciES4OHFukm6OT4OfeAh7mCbOtI=; b=jzuHWtsNdy3fx8Einpv94oVLqTRAbAK2TTJCeByRROFBNr586DkjL9mxcdrh86k+xH zQ4NPYvyaunwPK27wUg1TnNpkejk/vyOWHV5t0M5clOHmebBH6V6UJsu5ejCr+RbDI5C A31DQDCSjolLgVz8afViRQEvBgs9AYTHIAVqFwWkz9LjL1gCXvcJVcHrphEMeWQNiScn yVQTWE77pv1XKkqyXwMjA6pnDLHFA0yHZ4VrBESVFV/K191MypKOncZutLTWhNxPVZkX wn2OiCqBbL6YaU0mk3a0IUCB5ji7HlnjVnoyeAwz8BmzFIz/HmbYZmcTcEnFA/kACQXc MGwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707811983; x=1708416783; 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=l2VfWU0EmMkx2mEhciES4OHFukm6OT4OfeAh7mCbOtI=; b=T6dEwDdzYS+ZZhuP8qmgiU6NSTbvPTf5ks5HD78T4zyhZQGxo7LXmAZYTPW9UBBnkV e7si0qhzqSFPIzdr/44doNxLynYm0+tyRwiUXyGBlkQ9Wo0gA4jCLXvnFiYK3OmsnfHQ JxLngRn+Fa75pSJa3CXFgkfzwg5PfHYal56LeZNGb7cKDbg5q8BwHPZpHTI2G1ZzNHf+ qWkU6w7q0gHQDGXvQuFa2oXBpZMahdwwBVEBuC2Ve5SZIGxjBkjpF60lrdq1yCjGxUwh 2SXMjv6d173wKbxNxDvOjTcj3p3QqHCG9vBXLMU3TEsBfGPzpOELCLpE0cY6UcFGLuCy 73+A== X-Gm-Message-State: AOJu0Yz78mMGiwyQyG268roXItpMr4tVqImZWHD8D8gceA+dx691uAfH lkCsRvl8ed5Hc/LHsfRFRCQwlsmUi/D3OiqdvnsEonGOPrG4rOLj+yRf+ZNtRTz3gasvbyGlhq7 1 X-Received: by 2002:a05:6512:3c8d:b0:511:9d22:f4bd with SMTP id h13-20020a0565123c8d00b005119d22f4bdmr413061lfv.63.1707811983187; Tue, 13 Feb 2024 00:13:03 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWi577CshayfwLtIFjxE46jsqtR5FDaYjIGDsT58tJdyJz8QGWPlEWRwWCHoqPKZvRe6y+95Ro2LZwOiIdS6olDsJ9NOuuT9uPkWoxdpPq/i3wmj3mvs1g4m8fMCYNIMefak0V3rRCZBGJr5ty2QJHPBQviC885EHcNSTgty6C5E1mXLuJas0f6F5JGz6nEVhoT+WFTHaHMZGA4APuwJlxRjW9Mj0dc/d/Rs27tBw+Pw7zg+Tv8izJngNTeoZUMIa+tcQN7xnXQjzuLMvnKhfHc0Ywm4olFb6C1n5/uKKmBgS8LUYSt5stoEDLjtjEgb4cH3cCBvsDFLIdr8gsK2Bf8Y0abj+ZDwd59KoWIk1DAxr8ng19hNm+VGzVlYjX7QdqehHWl/pl3egnAgHNmUhymOh66EYxijO7EKW+Gmj/8fYnEhwQhyyZwdxmyj/0qS/aY+WeeGNEH+8R+2ZFPjjy38H/SqO7G28ej0LnKjIej++KbP36XekC5BwZRwGRbH2Vm/Yth7idREEwB4r85tf8pAKCC8PzxcPDgTEU3Dd4EMBtjG9e/hdfuDfxOs3sIp9uXCFw= Received: from m1x-phil.lan ([176.176.128.243]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c154d00b0040fb783ad93sm10792039wmg.48.2024.02.13.00.13.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 13 Feb 2024 00:13:02 -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?= , Rob Herring , Peter Maydell , Radoslaw Biernacki , Leif Lindholm , Marcin Juszkiewicz , Beniamino Galvani , Strahinja Jankovic , Alistair Francis , "Edgar E. Iglesias" Subject: [PATCH 9/9] hw/ide/ahci: Move SysBus definitions to 'ahci-sysbus.h' Date: Tue, 13 Feb 2024 09:12:00 +0100 Message-ID: <20240213081201.78951-10-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::133; envelope-from=philmd@linaro.org; helo=mail-lf1-x133.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 Keep "hw/ide/ahci.h" AHCI-generic. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Leif Lindholm --- include/hw/arm/allwinner-a10.h | 2 +- include/hw/arm/allwinner-r40.h | 2 +- include/hw/arm/xlnx-zynqmp.h | 2 +- include/hw/ide/ahci-sysbus.h | 35 ++++++++++++++++++++++++++++++++++ include/hw/ide/ahci.h | 29 +--------------------------- hw/arm/highbank.c | 2 +- hw/arm/sbsa-ref.c | 1 + hw/ide/ahci-allwinner.c | 3 +-- hw/ide/ahci.c | 1 + 9 files changed, 43 insertions(+), 34 deletions(-) create mode 100644 include/hw/ide/ahci-sysbus.h diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h index 2eb83a17ea..67a9a17b86 100644 --- a/include/hw/arm/allwinner-a10.h +++ b/include/hw/arm/allwinner-a10.h @@ -5,7 +5,7 @@ #include "hw/intc/allwinner-a10-pic.h" #include "hw/net/allwinner_emac.h" #include "hw/sd/allwinner-sdhost.h" -#include "hw/ide/ahci.h" +#include "hw/ide/ahci-sysbus.h" #include "hw/usb/hcd-ohci.h" #include "hw/usb/hcd-ehci.h" #include "hw/rtc/allwinner-rtc.h" diff --git a/include/hw/arm/allwinner-r40.h b/include/hw/arm/allwinner-r40.h index 66c38e7d90..614e74b7ed 100644 --- a/include/hw/arm/allwinner-r40.h +++ b/include/hw/arm/allwinner-r40.h @@ -22,7 +22,7 @@ #include "qom/object.h" #include "hw/timer/allwinner-a10-pit.h" -#include "hw/ide/ahci.h" +#include "hw/ide/ahci-sysbus.h" #include "hw/intc/arm_gic.h" #include "hw/sd/allwinner-sdhost.h" #include "hw/misc/allwinner-r40-ccu.h" diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h index 96358d51eb..48f7948092 100644 --- a/include/hw/arm/xlnx-zynqmp.h +++ b/include/hw/arm/xlnx-zynqmp.h @@ -22,7 +22,7 @@ #include "hw/net/cadence_gem.h" #include "hw/char/cadence_uart.h" #include "hw/net/xlnx-zynqmp-can.h" -#include "hw/ide/ahci.h" +#include "hw/ide/ahci-sysbus.h" #include "hw/sd/sdhci.h" #include "hw/ssi/xilinx_spips.h" #include "hw/dma/xlnx_dpdma.h" diff --git a/include/hw/ide/ahci-sysbus.h b/include/hw/ide/ahci-sysbus.h new file mode 100644 index 0000000000..7ed6cad496 --- /dev/null +++ b/include/hw/ide/ahci-sysbus.h @@ -0,0 +1,35 @@ +/* + * QEMU AHCI Emulation (MMIO-mapped devices) + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef HW_IDE_AHCI_SYSBUS_H +#define HW_IDE_AHCI_SYSBUS_H + +#include "qom/object.h" +#include "hw/sysbus.h" +#include "hw/ide/ahci.h" + +#define TYPE_SYSBUS_AHCI "sysbus-ahci" +OBJECT_DECLARE_SIMPLE_TYPE(SysbusAHCIState, SYSBUS_AHCI) + +struct SysbusAHCIState { + SysBusDevice parent_obj; + + AHCIState ahci; +}; + +#define TYPE_ALLWINNER_AHCI "allwinner-ahci" +OBJECT_DECLARE_SIMPLE_TYPE(AllwinnerAHCIState, ALLWINNER_AHCI) + +#define ALLWINNER_AHCI_MMIO_OFF 0x80 +#define ALLWINNER_AHCI_MMIO_SIZE 0x80 + +struct AllwinnerAHCIState { + SysbusAHCIState parent_obj; + + MemoryRegion mmio; + uint32_t regs[ALLWINNER_AHCI_MMIO_SIZE/4]; +}; + +#endif diff --git a/include/hw/ide/ahci.h b/include/hw/ide/ahci.h index c0b10c2bb4..ba31e75ff9 100644 --- a/include/hw/ide/ahci.h +++ b/include/hw/ide/ahci.h @@ -24,8 +24,7 @@ #ifndef HW_IDE_AHCI_H #define HW_IDE_AHCI_H -#include "hw/sysbus.h" -#include "qom/object.h" +#include "exec/memory.h" typedef struct AHCIDevice AHCIDevice; @@ -54,30 +53,4 @@ typedef struct AHCIState { void ahci_ide_create_devs(AHCIState *ahci, DriveInfo **hd); -#define TYPE_SYSBUS_AHCI "sysbus-ahci" -OBJECT_DECLARE_SIMPLE_TYPE(SysbusAHCIState, SYSBUS_AHCI) - -struct SysbusAHCIState { - /*< private >*/ - SysBusDevice parent_obj; - /*< public >*/ - - AHCIState ahci; -}; - -#define TYPE_ALLWINNER_AHCI "allwinner-ahci" -OBJECT_DECLARE_SIMPLE_TYPE(AllwinnerAHCIState, ALLWINNER_AHCI) - -#define ALLWINNER_AHCI_MMIO_OFF 0x80 -#define ALLWINNER_AHCI_MMIO_SIZE 0x80 - -struct AllwinnerAHCIState { - /*< private >*/ - SysbusAHCIState parent_obj; - /*< public >*/ - - MemoryRegion mmio; - uint32_t regs[ALLWINNER_AHCI_MMIO_SIZE/4]; -}; - #endif /* HW_IDE_AHCI_H */ diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index 9fdac1cc81..c71b1a8db3 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -30,7 +30,7 @@ #include "hw/boards.h" #include "qemu/error-report.h" #include "hw/char/pl011.h" -#include "hw/ide/ahci.h" +#include "hw/ide/ahci-sysbus.h" #include "hw/cpu/a9mpcore.h" #include "hw/cpu/a15mpcore.h" #include "qemu/log.h" diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index f2adf30337..5d3a574664 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -38,6 +38,7 @@ #include "hw/boards.h" #include "hw/ide/internal.h" #include "hw/ide/ahci_internal.h" +#include "hw/ide/ahci-sysbus.h" #include "hw/intc/arm_gicv3_common.h" #include "hw/intc/arm_gicv3_its_common.h" #include "hw/loader.h" diff --git a/hw/ide/ahci-allwinner.c b/hw/ide/ahci-allwinner.c index b173121006..9620de8ce8 100644 --- a/hw/ide/ahci-allwinner.c +++ b/hw/ide/ahci-allwinner.c @@ -19,9 +19,8 @@ #include "qemu/error-report.h" #include "qemu/module.h" #include "sysemu/dma.h" -#include "hw/ide/internal.h" #include "migration/vmstate.h" -#include "ahci_internal.h" +#include "hw/ide/ahci-sysbus.h" #include "trace.h" diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 041cc87c11..54c9685495 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -37,6 +37,7 @@ #include "hw/ide/internal.h" #include "hw/ide/pci.h" #include "hw/ide/ahci-pci.h" +#include "hw/ide/ahci-sysbus.h" #include "ahci_internal.h" #include "trace.h"