From nobody Tue Nov 26 11:21:08 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1708966261; cv=none; d=zohomail.com; s=zohoarc; b=QT5dJTQy586hQfbPATYKX/cAQWfKTxWlc21/hWhtoap9pi/RNYvzTMOjB6SN0Ie1edZ5P7NF1oq5tg3vr1i6Z0A9uabv85gHg3fcnakN3zlwkb9VtFKnbe4gJH9EYWMAkg5hDLgbEsrTGPQYbEOhsOH44wQtwthiQIs9HHEE4IE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708966261; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mSB3DjDUt1VhXKQ8ZY2Xf8EIy3NhP1lIXSTZpypndH8=; b=BEhhxvnFOhsJDvb08ZiQh+yw+X8dG250TNnp6uVkV3ELzPh6xTY8eVpjl2nGcN2Zxzycadj6E81mS2bLDIUwbtbOZvfk2TLFdBnyJFcUtgUTQsXOc3yFD5vAYjKiazsnf0khECDksw31Y8yPU0GrAIZB2kllKrqnksgKyKt6vL4= 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+importer=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 SMTPS id 1708966261415297.65853126942295; Mon, 26 Feb 2024 08:51:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1reeAT-0005x1-90; Mon, 26 Feb 2024 11:49:29 -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 1reeAR-0005wN-JX for qemu-devel@nongnu.org; Mon, 26 Feb 2024 11:49:27 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1reeAO-0006Dp-Sl for qemu-devel@nongnu.org; Mon, 26 Feb 2024 11:49:26 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-33d36736d4eso2066152f8f.1 for ; Mon, 26 Feb 2024 08:49:24 -0800 (PST) Received: from m1x-phil.lan ([176.187.223.153]) by smtp.gmail.com with ESMTPSA id h4-20020a5d4304000000b0033d6c928a95sm8771903wrq.63.2024.02.26.08.49.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 26 Feb 2024 08:49:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708966163; x=1709570963; 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=mSB3DjDUt1VhXKQ8ZY2Xf8EIy3NhP1lIXSTZpypndH8=; b=SBa4VDo4zhD/+XOWE18BHzX4zNMessHPaigsKq4GVKh6Q/dOCJaVOhlM2FuBRa7B3w re3SAJvr0zSC2Z7ohpPBHll0VDhlnu+58gNWpFxLBj7M5W3fSb8LIK0w+jpZT8WJs1e8 UJZRAxaQtGmO9hwLi+fl9avAXdkriEsr2HIRcWlid4SgwowK1ZLb6UN0C6qV904+tFSH zUrACsugDebTPHIk4i1d/FBaDrcjkH51L0oNVJRD0Lw7HSxE4HAH3ZT1JTp6Kjc4X/9+ wbCJc02pmKK4ObwGb2aCXGzLs842a8wwUrUstELnbylHiajSBA63SDwWbbjM2dZvEZdl vJRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708966163; x=1709570963; 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=mSB3DjDUt1VhXKQ8ZY2Xf8EIy3NhP1lIXSTZpypndH8=; b=FmRpt/e1d6VawrCnmPmF+PLW1x3RfLB4G5XXQMEpstRVqs55QjcPnwYydJ0BAsRX1h 6YKY1DtJNocQlyBFb9Wev1/YOSQJvSKr1UCpAKYRrAWIjhaNA3o+kR6UxcSBO2VH/jug RV70yD9PM8Z8MlsJmcszTdPp+5IT/rHxuHZycf2vaqd0FKLklaN6raF5xDXUSuzNSaXt 3HDWqbmngdQU6f+TNEEt7yrwIz9JYkSsctt/zpr269d51Cdy1IAy7Xk8My6HSprtMnhA yMb02AlicoV5FqTHhisUupEukCWWNVx8VhFWvNltSUIpbbsvwi/4757VNTJY6GNtqbLg /ZlQ== X-Gm-Message-State: AOJu0Yx3j269rc6cOKiCYn2IzX+VCj+DUeU6R5XtV9W+6qCv/PtJ+TjD jEEafQLwd07rr0kvK/njfbdBOfvpGLEoHDqxs1Fq4wzI6FZFfMIEOcIKAm/Fw+Uon4PHDwzqZoI T X-Google-Smtp-Source: AGHT+IF059EUPAbCL7SWAkMPG8gvMdciEhLUauFFOGEG0lnzdfLarfDOY9vlKU1SjU6UIOnamaswsQ== X-Received: by 2002:a5d:64c6:0:b0:33d:db2f:b0fd with SMTP id f6-20020a5d64c6000000b0033ddb2fb0fdmr2206800wri.52.1708966163240; Mon, 26 Feb 2024 08:49:23 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , "Edgar E . Iglesias" , Anton Johansson , Mark Cave-Ayland , Peter Maydell , Zhao Liu , Eduardo Habkost , Marcel Apfelbaum , Igor Mammedov , Richard Henderson , Ani Sinha , Bernhard Beschow , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , "Michael S. Tsirkin" , Laszlo Ersek , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 1/5] target/i386/cpu: Expose SMI# IRQ line via QDev Date: Mon, 26 Feb 2024 17:49:08 +0100 Message-ID: <20240226164913.94077-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240226164913.94077-1-philmd@linaro.org> References: <20240226164913.94077-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1708966263555100003 In order to remove calls to cpu_interrupt() from hw/ code, expose the SMI# interrupt via QDev as named GPIO. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/cpu-internal.h | 1 + target/i386/cpu-sysemu.c | 11 +++++++++++ target/i386/cpu.c | 2 ++ 3 files changed, 14 insertions(+) diff --git a/target/i386/cpu-internal.h b/target/i386/cpu-internal.h index 9baac5c0b4..9d76bb77cf 100644 --- a/target/i386/cpu-internal.h +++ b/target/i386/cpu-internal.h @@ -62,6 +62,7 @@ GuestPanicInformation *x86_cpu_get_crash_info(CPUState *c= s); void x86_cpu_get_crash_info_qom(Object *obj, Visitor *v, const char *name, void *opaque, Error **er= rp); =20 +void x86_cpu_smi_irq(void *opaque, int irq, int level); void x86_cpu_apic_create(X86CPU *cpu, Error **errp); void x86_cpu_apic_realize(X86CPU *cpu, Error **errp); void x86_cpu_machine_reset_cb(void *opaque); diff --git a/target/i386/cpu-sysemu.c b/target/i386/cpu-sysemu.c index 7422096737..7684a7f01e 100644 --- a/target/i386/cpu-sysemu.c +++ b/target/i386/cpu-sysemu.c @@ -370,3 +370,14 @@ void x86_cpu_get_crash_info_qom(Object *obj, Visitor *= v, qapi_free_GuestPanicInformation(panic_info); } =20 +void x86_cpu_smi_irq(void *opaque, int irq, int level) +{ + DeviceState *dev =3D opaque; + CPUState *cs =3D CPU(dev); + + if (level) { + cpu_interrupt(cs, CPU_INTERRUPT_SMI); + } else { + cpu_reset_interrupt(cs, CPU_INTERRUPT_SMI); + } +} diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 7f90823676..6b4462d533 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7463,6 +7463,8 @@ static void x86_cpu_realizefn(DeviceState *dev, Error= **errp) } =20 #ifndef CONFIG_USER_ONLY + qdev_init_gpio_in_named(dev, x86_cpu_smi_irq, "SMI", 1); + x86_cpu_apic_realize(cpu, &local_err); if (local_err !=3D NULL) { goto out; --=20 2.41.0