From patchwork Fri Feb 9 12:32:21 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: 771315 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp823856wre; Fri, 9 Feb 2024 04:33:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXLkNftu9krDRRgqzlDyc2WuLozgVWG7XNbytDW5rEoLZNXBnlHaWlKuGAOcoaCOIjR3vmDpoafRVq7DOJTZ7Cr X-Google-Smtp-Source: AGHT+IFHKO1LDv+fLj6kOts1AqaI2r91dDaaTQ9EtlzHvZYsFV/qghchIUcz8ifUJ/s1L4wJibOg X-Received: by 2002:a05:6808:bd5:b0:3be:b5f6:f354 with SMTP id o21-20020a0568080bd500b003beb5f6f354mr1778618oik.13.1707482020011; Fri, 09 Feb 2024 04:33:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707482019; cv=none; d=google.com; s=arc-20160816; b=fxs3ezOLr94L5HkwbXegltsz3O7PDANb6PtGSnMdQyXWLbiW0mDChQGQyDmIv1fyG+ cpKClXo4/jH7/Rs6D4OQNWa62RYJYzJtZcVc7tATmPRMeiOhrHPC/luBRpxRaIldBqGp X3TNsKACXXl9uwKjSxYWp0WDRiiAtdjklWW9CIi90TuJCY0T4jCynOmdOUnabIn+W/vB pl7rA2aNODHjv6jwXt8JGoX5oA1e9H9tq8BrGSXt9j82ikfXFHtSI1d6esuqy8DZgC39 hPOzUKh5WRGqUedlzh/5mxZYHMNk2QdbaoQBfU1O5FVXZnXjyVsxsDQQUlQBI4QT7qNy s2mg== 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=DoeBrV+EEZMMsB2lJU5mfdts4xYAcXXfL7ZG+bYHvck=; fh=3YGy94ESPi9VmDnetGfqupKplcGyICyxp1utnQtzwJ8=; b=lSim+9i5zsL2LO8BgMkAqF77pC100jh6KAruzJ00zuuimaOBpSgi9UVDlc/jmjvv1Z eFKtKA9LZEyA204+i57d8nWhBYKhYYBhu4D7XBOFykDRNFneynFIVAIso5IrWtChXo5l kNz+aG27qmUn5WPngNSD5OUVVC3+mxHe7JNuaCF3AaF6rZ3/Xl/eh9q8EFIs1Mtj1MtT Ua+s0DdSSEHOTDvbY344mvo/+zbvBLAYZJrU9OQveRiLiRHDT0pmU2OVl9HWPtlTB5BX sRXFcgv1I7B3pILDSUraZ8F2Geyo9vEWNOKplCj6wPQUeVvQ3d0Frb0fWN3W0j5r7ZNr bRBw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mwVIjU74; 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; AJvYcCVmQX5azAUK42GiuF/8SzFwimj+FfRDXA4d1DQSk0v4XFo53CQ8KqP7sVUGzrgrth7EkaeXjMlyV+59/FcoxhbT Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m11-20020a05620a24cb00b00783ab5f86adsi2049610qkn.265.2024.02.09.04.33.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Feb 2024 04:33:39 -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=mwVIjU74; 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 1rYQ3w-0007zN-Lk; Fri, 09 Feb 2024 07:33:00 -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 1rYQ3m-0007rx-Jn for qemu-devel@nongnu.org; Fri, 09 Feb 2024 07:32:58 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rYQ3k-0001sz-Gm for qemu-devel@nongnu.org; Fri, 09 Feb 2024 07:32:50 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-33b401fd72bso495714f8f.3 for ; Fri, 09 Feb 2024 04:32:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707481967; x=1708086767; 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=DoeBrV+EEZMMsB2lJU5mfdts4xYAcXXfL7ZG+bYHvck=; b=mwVIjU74L8EpSrWA9GC+FnmdAzyXxTT+Lmx3qbxkNBpXeQNry7PU83htKlu1nn7i9H 1r7eYgQtRMlPOJLy8llHaVrF6xz/76bzXwk4XNw4OFmcnP9/KT13MKipzjidpP8N69RQ OXTQmLmy2hcMeuDpCw9U7t3TjJYDNmXVFLYskXvsV4OfvjhGUR3vgFiWmWnacJbMBJ2/ fO+ZlLNoqGThDsntD1pI5UnH1jB6GDhBW9vWXjmU9aHoAkRgpAC7Kgw6gm4eRhqBJ1KU 6S9Hcm8GHebNSjsVzpmCMsw8jMijph3XdtGHkRJ4TBlIHeJQvwSVoEn4xJQXEC2PYMSq o/Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707481967; x=1708086767; 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=DoeBrV+EEZMMsB2lJU5mfdts4xYAcXXfL7ZG+bYHvck=; b=gQE94tbzNMowQ6OT1nhldu8pprgMFZmnmfVxT3Jv9BAHaOngRZov17L2OlH4iIqsms YdCSRTIINiFPYrF211VKO3dQ+QIH82/8ce0AVGo0wwgyb73PryQ7xo1CjealweQPkCNo 47GkQEt5tydtQQKa+M87PqC80nzhG0BLTZU7ISO1kl9fxgTEafhdLibFRpqeZfHpEd52 XejBtMSsMmzVoQ9h4sJ5X0jadQaN7URMZz8Whc8CmwZP6x1/pUJsjU6KRLxS/3mpBfR+ wPChhNn/wEg/rxnblDzJhWTVysLVKpa01yXsMj3FW3TA4W83tWRZV63uSohCD8tNiKyI 4uzQ== X-Gm-Message-State: AOJu0YxAfyVcSnL3iHe/J/wJcl2wlW+y6x7pubmfbwz/+VAvLUTct93x 1SJp65f7QLFVZakQkVhVZxy/vd/5R/+mzHi8LDfo4z+qOpkOMx77FJr0lJkPkj8F8B0yUu5w28h Y X-Received: by 2002:adf:a442:0:b0:33b:61ed:b899 with SMTP id e2-20020adfa442000000b0033b61edb899mr892320wra.56.1707481966785; Fri, 09 Feb 2024 04:32:46 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXzfgXHMN47aQ/KCNhBxpV4Z3YyKPRl2YquyCugn1MlusU6NZEj5P66bCUgW3gpussgOGP+xANi+EeuF+NG8em8JEZKUh2yttWi4MnxBqiDLxQXopMjKPdXDU+90V/3v1NeIbXhr7cdmnh+hWKmOxADeH7HtF5hNd7e76gOgYou3cfEjEDdRk0c+QcWPz3/262htCsWFmn+KBJU1JLprRzmorl+uwiCJUo2oI/k3WcCdoAjeAQItdLyJ/52aEZiEzRw9bBmS3lOoAqbutHOB55EsKbgx5dz8wxZghUYOmrRhr5bCp5lQMfS68bjY1wAAGbWm/bDS0GNpFc= Received: from m1x-phil.lan ([176.187.218.105]) by smtp.gmail.com with ESMTPSA id d23-20020adfa357000000b0033ae50e2c6asm1712299wrb.83.2024.02.09.04.32.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 09 Feb 2024 04:32:46 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Paolo Bonzini , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Jiaxun Yang , qemu-block@nongnu.org, John Snow , qemu-ppc@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" Subject: [RFC PATCH 3/7] hw/ide/cmd646: Configure IDE bus IRQs after realization Date: Fri, 9 Feb 2024 13:32:21 +0100 Message-ID: <20240209123226.32576-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240209123226.32576-1-philmd@linaro.org> References: <20240209123226.32576-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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 shouldn't call qdev_get_gpio_in() on unrealized devices. Signed-off-by: Philippe Mathieu-Daudé --- Ideally we should rework the current IDE bus model to really use QOM and not globals. Left for later. --- hw/ide/cmd646.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c index c0bcfa4414..92e1e7a4fc 100644 --- a/hw/ide/cmd646.c +++ b/hw/ide/cmd646.c @@ -291,9 +291,18 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Error **errp) /* TODO: RST# value should be 0 */ pci_conf[PCI_INTERRUPT_PIN] = 0x01; // interrupt on pin 1 - qdev_init_gpio_in(ds, cmd646_set_irq, 2); for (i = 0; i < 2; i++) { ide_bus_init(&d->bus[i], sizeof(d->bus[i]), ds, i, 2); + } +} + +static void pci_cmd646_ide_wire(DeviceState *dev) +{ + PCIIDEState *d = PCI_IDE(dev); + DeviceState *ds = DEVICE(dev); + + qdev_init_gpio_in(ds, cmd646_set_irq, 2); + for (unsigned i = 0; i < 2; i++) { ide_bus_init_output_irq(&d->bus[i], qdev_get_gpio_in(ds, i)); bmdma_init(&d->bus[i], &d->bmdma[i], d); @@ -324,6 +333,7 @@ static void cmd646_ide_class_init(ObjectClass *klass, void *data) dc->reset = cmd646_reset; dc->vmsd = &vmstate_ide_pci; + dc->wire = pci_cmd646_ide_wire; k->realize = pci_cmd646_ide_realize; k->exit = pci_cmd646_ide_exitfn; k->vendor_id = PCI_VENDOR_ID_CMD;