From nobody Mon Sep 16 20:26:13 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673626217; cv=none; d=zohomail.com; s=zohoarc; b=TbAaIn1Ev6uByVHkzqcm2WHQ94Rqx+/WmWDVR72LO3hbiKgKyfD5UBViM4p8EZaV57GXWr5ySiPbkNKS7OEUVXJj7e5yjANEjsUJPNtBivIm53tv8wcG3U3vSsnrJHX5/Aj1oSmATaYiiMhV+T5m93kLLP3R4xIw8IFqTSeNGXs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673626217; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=e5EF39XPzrJs41yZ+ui/UtGx91WtVsmBYUeR//O1mUQ=; b=K2fGOpH+ONigInEf+Sm+ZiTTAuUV6tci0eh+2jD5KEhpvd568AB3bdkbbX1yGlyu27rVSapPqLKOJ2G9dLuk55mGEDt+dz3ZUcKUWoME4Z8ZG2SbkMrSxO716LTFNrWAfc73RQuS+dZTS4hHptMq9XhppLsqdZq/VPbZBb3fPXA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTP id 1673626217592418.09012620129045; Fri, 13 Jan 2023 08:10:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGMIc-0003BM-Ur; Fri, 13 Jan 2023 10:49: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 1pGMI8-0002wY-MX for qemu-devel@nongnu.org; Fri, 13 Jan 2023 10:48:32 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGMI5-0006Zl-1G for qemu-devel@nongnu.org; Fri, 13 Jan 2023 10:48:27 -0500 Received: by mail-wm1-x331.google.com with SMTP id j16-20020a05600c1c1000b003d9ef8c274bso13310289wms.0 for ; Fri, 13 Jan 2023 07:48:24 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id h10-20020a05600c2caa00b003cfd58409desm31241749wmc.13.2023.01.13.07.48.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 13 Jan 2023 07:48:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=e5EF39XPzrJs41yZ+ui/UtGx91WtVsmBYUeR//O1mUQ=; b=nFVmWjUZX6a6Hz/ufIYxAGI6TkrkPCoB/yXabLdqg4p0/of8r+p6ixWvnA2yDuqwRf e7HGDYt9uHS42kRweQtqAJ+4cHL9r+XyGyTyD3oOB8N0wVzxQ8kdKZYgjigqXusMFC+S 2Kuh4fUwr+TTeT4nBG3QyjEh5aq+GvsB/8XGmps44nVDZ5JAxZlGpqiz0yjWqi9u4Tyc zXJ9haG7eA8hpdwGgbdgg/Yn2JwfyP0A+CHAESPZtnfy8yJfEHTcEIk+t5Q/46YUBrdf Zrs7XUT5KglLcvDoes6XvWP7VVyqgSercMZobZZaU0VekDwl+IHwA+SJPQ5ISXWV8VUS lezg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=e5EF39XPzrJs41yZ+ui/UtGx91WtVsmBYUeR//O1mUQ=; b=ICnewVo9wnZjHPPagnrUqeLlehkZEV55rDvWLNGFLPmJup9b+9K5LPkI8h2xrGJe+L 40GhV9TaKyVboR4bjK9lcQbc6jAQIpxAgvoFKhBQYVEICQodnbEAxSwk6Z74d2eKCFAI 7qrqGuDO4e3igMfFyY6Sunxs1ahUifLNUQ5NTxgxr4bGYlS3eO9gKXhkMRd1dU3peAnO rEetNgooVRHgCA3bGwihQV6g/gQGnQ+VGu2+CFTrjgb8tyoiA0kwyjPL3hxpTX3BbEdw /DJhDA4H2vci/u0hR/uM6jlRKu7fQr1gEof2r0OR0cUqPDHSyQ9TnBGkZBHeJERdDkfy z5rg== X-Gm-Message-State: AFqh2kqUPhyRSHf1xrronhAQjquRkQxkgvFVfOwmx0+cJpMzE/T0eNeN muaf8qxDP3soCai8GcqZEMtdmDjPEB5cNWjY X-Google-Smtp-Source: AMrXdXtN9YcrhcSbcRZVWo/rVodnphSq4rWRcGMD+szcdOeHEHhb1esrtYevl9OngGUGhhWfbXVgHQ== X-Received: by 2002:a05:600c:2e44:b0:3d3:4406:8a3c with SMTP id q4-20020a05600c2e4400b003d344068a3cmr58317617wmf.32.1673624903455; Fri, 13 Jan 2023 07:48:23 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Bernhard Beschow , "Michael S . Tsirkin" , Mark Cave-Ayland , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 35/46] hw/intc/i8259: Make using the isa_pic singleton more type-safe Date: Fri, 13 Jan 2023 16:45:21 +0100 Message-Id: <20230113154532.49979-36-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230113154532.49979-1-philmd@linaro.org> References: <20230113154532.49979-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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 autolearn=ham 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673626218804100003 From: Bernhard Beschow This even spares some casts in hot code paths along the way. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Reviewed-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230109172347.1830-10-shentey@gmail.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/intc/i8259.c | 11 ++++------- include/hw/intc/i8259.h | 6 +++--- include/qemu/typedefs.h | 1 + 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c index cc4e21ffec..0261f087b2 100644 --- a/hw/intc/i8259.c +++ b/hw/intc/i8259.c @@ -55,7 +55,7 @@ struct PICClass { #ifdef DEBUG_IRQ_LATENCY static int64_t irq_time[16]; #endif -DeviceState *isa_pic; +PICCommonState *isa_pic; static PICCommonState *slave_pic; =20 /* return the highest priority found in mask (highest =3D smallest @@ -173,9 +173,8 @@ static void pic_intack(PICCommonState *s, int irq) pic_update_irq(s); } =20 -int pic_read_irq(DeviceState *d) +int pic_read_irq(PICCommonState *s) { - PICCommonState *s =3D PIC_COMMON(d); int irq, intno; =20 irq =3D pic_get_irq(s); @@ -354,10 +353,8 @@ static uint64_t pic_ioport_read(void *opaque, hwaddr a= ddr, return ret; } =20 -int pic_get_output(DeviceState *d) +int pic_get_output(PICCommonState *s) { - PICCommonState *s =3D PIC_COMMON(d); - return (pic_get_irq(s) >=3D 0); } =20 @@ -426,7 +423,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq) irq_set[i] =3D qdev_get_gpio_in(dev, i); } =20 - isa_pic =3D dev; + isa_pic =3D PIC_COMMON(dev); =20 isadev =3D i8259_init_chip(TYPE_I8259, bus, false); dev =3D DEVICE(isadev); diff --git a/include/hw/intc/i8259.h b/include/hw/intc/i8259.h index e2b1e8c59a..a0e34dd990 100644 --- a/include/hw/intc/i8259.h +++ b/include/hw/intc/i8259.h @@ -3,10 +3,10 @@ =20 /* i8259.c */ =20 -extern DeviceState *isa_pic; +extern PICCommonState *isa_pic; qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq); qemu_irq *kvm_i8259_init(ISABus *bus); -int pic_get_output(DeviceState *d); -int pic_read_irq(DeviceState *d); +int pic_get_output(PICCommonState *s); +int pic_read_irq(PICCommonState *s); =20 #endif diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 073abab998..fba04875c2 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -99,6 +99,7 @@ typedef struct PCIExpressDevice PCIExpressDevice; typedef struct PCIExpressHost PCIExpressHost; typedef struct PCIHostDeviceAddress PCIHostDeviceAddress; typedef struct PCIHostState PCIHostState; +typedef struct PICCommonState PICCommonState; typedef struct PostcopyDiscardState PostcopyDiscardState; typedef struct Property Property; typedef struct PropertyInfo PropertyInfo; --=20 2.38.1