From patchwork Sun Jan 22 17:07:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13111543 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F07AFC54E94 for ; Sun, 22 Jan 2023 17:08:33 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJdop-00023T-8s; Sun, 22 Jan 2023 12:07:47 -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 1pJdon-00022o-Oc for qemu-devel@nongnu.org; Sun, 22 Jan 2023 12:07:45 -0500 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJdom-0005TU-6U for qemu-devel@nongnu.org; Sun, 22 Jan 2023 12:07:45 -0500 Received: by mail-ej1-x631.google.com with SMTP id hw16so25048211ejc.10 for ; Sun, 22 Jan 2023 09:07:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=kuM8mwAgpa0Pup/G43XnuFRa7bBjpEX8hFtFhv41d40=; b=QssRFAGvcBSMUqxTHjamJfOB1vbt3GaJgq1VYHnoFMgEz2LqyWldp0RTEcWhPHSMqF bBBlPXAZVnDC55ITAOSXsx7Qfe0rNwC1PjOYdjuPTulKevZoU+iLt7sBLJlJGkgoD/8o KrWh7qfPyJ2Yw7TfRLoU41pykAJrTJGWgpC7pKqQxDXxI/d71PqdTn7zw67VP4LK1uCV asa5eYia1LC4SwqYTaqmHMEYpD5Yx83tjTA6HMPuYbqM9Ftb748VFjUTmukxLwsGZEjg RD6pedR8XRj5yU/fgQarzeFAvs0PQgOdaZeQMzz1IPrZtw7bkHmDzL5kLLeOe87xBivz z+2Q== 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=kuM8mwAgpa0Pup/G43XnuFRa7bBjpEX8hFtFhv41d40=; b=7cW42W/F9t5qDBmRhQeOfNVpn5X17sTpnKrSeyc71hd//5YMZUve/u0H4eARbfDB/6 CdoIDD9Qiym7KcmM1WZJsHFUe4HlNyXXLSIW5c4HRXqg4CZJrokoy1BbgEmCsLRSsM8w MT40Krs7nba5ytO9TJokHjHt0vloLB7CGfDiEh5bAvKAq3eFhswYx5/4qafPvo0XA6nP OxomEuYowG62K3bO76xvPcUnTLlzTKACEtQMWX0DIrB1HjPt11SbUa1ZtJn16MJg/jiI Zq1UdXJdXDz48q8etqF614vSYFCbGdnfUoFuCOtp//Hn3spHJws0VJ+Pt1vqwz3G/S8Z XUXA== X-Gm-Message-State: AFqh2kq0FbLmX84BRjy8z5/iv6G5Go9M9gSlSTsJG8wH6ZzzzcM3LIHH iFYIVLMSSR6pyAHHFFVQikfd0LAJ39dvEw== X-Google-Smtp-Source: AMrXdXsHm8eIyklvLGeaBKzdbz3xSOQNRARUKgIXhcEngNre2A1QGww7TSAtZx36HCTLUuqnXnTWyA== X-Received: by 2002:a17:906:52d0:b0:870:5496:26c0 with SMTP id w16-20020a17090652d000b00870549626c0mr22514977ejn.34.1674407262391; Sun, 22 Jan 2023 09:07:42 -0800 (PST) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id kw4-20020a170907770400b0084d397e0938sm19670453ejc.195.2023.01.22.09.07.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Jan 2023 09:07:41 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Ani Sinha , "Michael S. Tsirkin" , Aurelien Jarno , Bernhard Beschow Subject: [PATCH 1/7] hw/acpi/{ich9, piix4}: Reuse existing attributes for QOM properties Date: Sun, 22 Jan 2023 18:07:18 +0100 Message-Id: <20230122170724.21868-2-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230122170724.21868-1-shentey@gmail.com> References: <20230122170724.21868-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=shentey@gmail.com; helo=mail-ej1-x631.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, FREEMAIL_FROM=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The QOM properties are accessed after the device models have been realized. This means that the constants are redundant. Remove them. Signed-off-by: Bernhard Beschow --- hw/acpi/ich9.c | 5 ++--- hw/acpi/piix4.c | 10 ++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index a93c470e9d..2050af67b9 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -433,7 +433,6 @@ static void ich9_pm_set_keep_pci_slot_hpc(Object *obj, bool value, Error **errp) void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm) { - static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN; pm->acpi_memory_hotplug.is_enabled = true; pm->cpu_hotplug_legacy = true; pm->disable_s3 = 0; @@ -448,8 +447,8 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm) object_property_add(obj, ACPI_PM_PROP_GPE0_BLK, "uint32", ich9_pm_get_gpe0_blk, NULL, NULL, pm); - object_property_add_uint32_ptr(obj, ACPI_PM_PROP_GPE0_BLK_LEN, - &gpe0_len, OBJ_PROP_FLAG_READ); + object_property_add_uint8_ptr(obj, ACPI_PM_PROP_GPE0_BLK_LEN, + &pm->acpi_regs.gpe.len, OBJ_PROP_FLAG_READ); object_property_add_bool(obj, "memory-hotplug-support", ich9_pm_get_memory_hotplug_support, ich9_pm_set_memory_hotplug_support); diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 0a81f1ad93..370b34eacf 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -421,18 +421,16 @@ static void piix4_pm_add_properties(PIIX4PMState *s) { static const uint8_t acpi_enable_cmd = ACPI_ENABLE; static const uint8_t acpi_disable_cmd = ACPI_DISABLE; - static const uint32_t gpe0_blk = GPE_BASE; - static const uint32_t gpe0_blk_len = GPE_LEN; static const uint16_t sci_int = 9; object_property_add_uint8_ptr(OBJECT(s), ACPI_PM_PROP_ACPI_ENABLE_CMD, &acpi_enable_cmd, OBJ_PROP_FLAG_READ); object_property_add_uint8_ptr(OBJECT(s), ACPI_PM_PROP_ACPI_DISABLE_CMD, &acpi_disable_cmd, OBJ_PROP_FLAG_READ); - object_property_add_uint32_ptr(OBJECT(s), ACPI_PM_PROP_GPE0_BLK, - &gpe0_blk, OBJ_PROP_FLAG_READ); - object_property_add_uint32_ptr(OBJECT(s), ACPI_PM_PROP_GPE0_BLK_LEN, - &gpe0_blk_len, OBJ_PROP_FLAG_READ); + object_property_add_uint64_ptr(OBJECT(s), ACPI_PM_PROP_GPE0_BLK, + &s->io_gpe.addr, OBJ_PROP_FLAG_READ); + object_property_add_uint8_ptr(OBJECT(s), ACPI_PM_PROP_GPE0_BLK_LEN, + &s->ar.gpe.len, OBJ_PROP_FLAG_READ); object_property_add_uint16_ptr(OBJECT(s), ACPI_PM_PROP_SCI_INT, &sci_int, OBJ_PROP_FLAG_READ); object_property_add_uint32_ptr(OBJECT(s), ACPI_PM_PROP_PM_IO_BASE, From patchwork Sun Jan 22 17:07:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13111544 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E4880C54EB4 for ; Sun, 22 Jan 2023 17:08:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJdoq-00024C-5Q; Sun, 22 Jan 2023 12:07:48 -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 1pJdop-00023B-0c for qemu-devel@nongnu.org; Sun, 22 Jan 2023 12:07:47 -0500 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJdon-0005Ta-Gz for qemu-devel@nongnu.org; Sun, 22 Jan 2023 12:07:46 -0500 Received: by mail-ed1-x531.google.com with SMTP id b4so12137363edf.0 for ; Sun, 22 Jan 2023 09:07:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=nQaQHWQNI3vzwZ2uav7kTtN2xFmzRbqZJRcUDlV+tKU=; b=V5+mgXm7FOW/YqdOf0Co/pdeI2jZ0v69bo1lBPE9Aej53Nagy7okB8jjRU3jyuLzYx sFNlh2CSVVBy+aSa5aqM1EHkBl6SKBEJtW4DjKIHkSjEtX6IuNaJHiDxaWvVVB2AxAee +2+jpgYugmCBDLKqZi5XNwDj6Q63v0VsjYpnPu5OhxRgGJTprw0YlPQnL0e5UfgTosp5 yNAGFG8nwR5Ht9FqZicN0AxKNg+QEVAj92UH55kGeqp5mkwk3WKZ3/kUO1K8h8bhkRb8 ZqWXosqWzhFarpBX2v9qmyrdWEVja5q15pQIlcemx8PvpCA7xmFkhAJVx/5DWtRxJ2Aw cldQ== 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=nQaQHWQNI3vzwZ2uav7kTtN2xFmzRbqZJRcUDlV+tKU=; b=r/tJLzoP154XLwLB/7VlcgN5BQFTJgEQ1sgP95fB9GvxPXXRF1KiERtIEowcVqNoIn xY1tdsC5AVFWIvBGaEcBt4NhRR5G2c8Ux9NOPiK7Wi6gr9fPNX0bNacV7dpKbgLJIsV7 /N3E7k5epjgFL86iokNDuuSVrfOpryWvp4YbwRO9YF/jdY6pwUKLl2DTF/SNtlYsbANU nW42uN8CB6uIikuclrwY/9qGM2iKnhhS91bNGXJV/aj5s2e7sAsZ3c27JbFTLxYx0gwB trsN2r3tEKLAvOK9XhaDekbpdGv0YL6gIX3LqkD9cPqVyIsFOmPQTCCvp687egGqdXCx aq9g== X-Gm-Message-State: AFqh2krQGvKKTAKBHTOkOh6b1y9cydizGB99DQFLiDEd8SBP6xdXc72m cWjb8O6MADIQQQLXxOws5ZINwocRBsVF3g== X-Google-Smtp-Source: AMrXdXv506+V6jB++L8H10OMD5QGDrKck2+JgLRQRqqXLrlLPkSrE5ZttwnGAyPDcCk8+LnIqM2rTg== X-Received: by 2002:a05:6402:189:b0:499:376e:6b27 with SMTP id r9-20020a056402018900b00499376e6b27mr22608397edv.5.1674407263487; Sun, 22 Jan 2023 09:07:43 -0800 (PST) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id kw4-20020a170907770400b0084d397e0938sm19670453ejc.195.2023.01.22.09.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Jan 2023 09:07:42 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Ani Sinha , "Michael S. Tsirkin" , Aurelien Jarno , Bernhard Beschow Subject: [PATCH 2/7] hw/acpi/ich9: Remove unneeded assignments Date: Sun, 22 Jan 2023 18:07:19 +0100 Message-Id: <20230122170724.21868-3-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230122170724.21868-1-shentey@gmail.com> References: <20230122170724.21868-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=shentey@gmail.com; helo=mail-ed1-x531.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, FREEMAIL_FROM=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The first thing ich9_pm_iospace_update() does is to set pm->pm_io_base to the pm_io_base parameter. The pm_io_base parameter's value is the old one of pm->pm_io_base. Signed-off-by: Bernhard Beschow --- hw/acpi/ich9.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 2050af67b9..0313e71e74 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -136,9 +136,7 @@ void ich9_pm_iospace_update(ICH9LPCPMRegs *pm, uint32_t pm_io_base) static int ich9_pm_post_load(void *opaque, int version_id) { ICH9LPCPMRegs *pm = opaque; - uint32_t pm_io_base = pm->pm_io_base; - pm->pm_io_base = 0; - ich9_pm_iospace_update(pm, pm_io_base); + ich9_pm_iospace_update(pm, pm->pm_io_base); return 0; } From patchwork Sun Jan 22 17:07:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13111547 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04607C38142 for ; Sun, 22 Jan 2023 17:09:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJdor-00024X-19; Sun, 22 Jan 2023 12:07:49 -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 1pJdop-00023z-P2 for qemu-devel@nongnu.org; Sun, 22 Jan 2023 12:07:47 -0500 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJdoo-0005TS-28 for qemu-devel@nongnu.org; Sun, 22 Jan 2023 12:07:47 -0500 Received: by mail-ej1-x634.google.com with SMTP id qx13so25024970ejb.13 for ; Sun, 22 Jan 2023 09:07:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=H2vClOyHfJHGHWScoT9CS6UO1o8J5b4Lv9/t/Xz8pGc=; b=QvEl3alJ0pvEJG9+cVl2fAToHCUBafyXW0v/+p7mGXC8kusrQYFVKNyI8zOkQWyVkE FFjI13QiZmmdIHuOIINMw6nnHZ11KM2q83zAjgBwdVBBMfX66ikLHe+8BZ/BVOtnDz3x NT3m/gFH6WQsHgRD6Awzmijxf23+3DJmbd4177Ky07vI6hRsBoV+qGLl2rMMbw6CDHQR CxVW1zv/VILO+FLOSyefZAPRMeEXPDQFSeir6FUbOFeQhQ5lu5+Z3rFcVwO39iqBlL9t Cu+NFdyAujItqhPFCymMt/u/FAhE9pY39StQ0AEjkLdfBZbdqAi/GURCH7zjsCVLDIWJ MI3A== 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=H2vClOyHfJHGHWScoT9CS6UO1o8J5b4Lv9/t/Xz8pGc=; b=Ja7VBH8uv+G91QpOKGpMkjN/SMRuvO5+5eLeVD5Ql/8EbSk/wcbaJ+24ESPS7cZAZv kk3JX773eMBoDYEPqjxF7EAAHwWon5sMTFAQj9buQkYKWuu/rCP+HZt44N1ycLmZhCHf yNgeFA4hEa0ghtRjzMBMLFOpDVYgc2KSUGEzZQtqgom1xe4CbqmaiZjiaOzrs0NmAjB2 vqfS4mArhE0hKeb77cyoMSA7lL3rMBK57sHYqHSarD1tV40feqI053HDtiVhWSCoZUTH DepmnkwNE+1OkBgoi8gpfEq4AROpngIHRBZRlAzRr9NpYYuat0Oj4IusTnUyXO0OJ0wM QkpQ== X-Gm-Message-State: AFqh2krSta6KqFz9keUJu4AzgJv/d0ZIVZOds/HLK1aqooc0VddSfRnm S7hN5VKRVq6v+Wwx7/T///cGZd4DOg24og== X-Google-Smtp-Source: AMrXdXtCxPG1TJZibWxXp3eVhatJAfPK7cU8Uyg1xwvkA2T0BDPHnyY+oUOqdTk6btTOoUzgP06v1g== X-Received: by 2002:a17:906:b14b:b0:864:1902:7050 with SMTP id bt11-20020a170906b14b00b0086419027050mr21343843ejb.69.1674407265215; Sun, 22 Jan 2023 09:07:45 -0800 (PST) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id kw4-20020a170907770400b0084d397e0938sm19670453ejc.195.2023.01.22.09.07.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Jan 2023 09:07:44 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Ani Sinha , "Michael S. Tsirkin" , Aurelien Jarno , Bernhard Beschow Subject: [PATCH 3/7] hw/acpi/{ich9, piix4}: Resolve redundant io_base address attributes Date: Sun, 22 Jan 2023 18:07:20 +0100 Message-Id: <20230122170724.21868-4-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230122170724.21868-1-shentey@gmail.com> References: <20230122170724.21868-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=shentey@gmail.com; helo=mail-ej1-x634.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, FREEMAIL_FROM=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org A MemoryRegion has an addr attribute which gets set to the same values as the redundant io_addr attributes. Signed-off-by: Bernhard Beschow --- include/hw/acpi/ich9.h | 1 - include/hw/acpi/piix4.h | 2 -- hw/acpi/ich9.c | 17 ++++++++--------- hw/acpi/piix4.c | 11 ++++++----- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h index d41866a229..22471a1b9d 100644 --- a/include/hw/acpi/ich9.h +++ b/include/hw/acpi/ich9.h @@ -49,7 +49,6 @@ typedef struct ICH9LPCPMRegs { qemu_irq irq; /* SCI */ - uint32_t pm_io_base; Notifier powerdown_notifier; bool cpu_hotplug_legacy; diff --git a/include/hw/acpi/piix4.h b/include/hw/acpi/piix4.h index be1f8ea80e..62e1925a1f 100644 --- a/include/hw/acpi/piix4.h +++ b/include/hw/acpi/piix4.h @@ -39,8 +39,6 @@ struct PIIX4PMState { /*< public >*/ MemoryRegion io; - uint32_t io_base; - MemoryRegion io_gpe; ACPIREGS ar; diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 0313e71e74..f8af238974 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -126,17 +126,16 @@ void ich9_pm_iospace_update(ICH9LPCPMRegs *pm, uint32_t pm_io_base) assert((pm_io_base & ICH9_PMIO_MASK) == 0); - pm->pm_io_base = pm_io_base; memory_region_transaction_begin(); - memory_region_set_enabled(&pm->io, pm->pm_io_base != 0); - memory_region_set_address(&pm->io, pm->pm_io_base); + memory_region_set_enabled(&pm->io, pm_io_base != 0); + memory_region_set_address(&pm->io, pm_io_base); memory_region_transaction_commit(); } static int ich9_pm_post_load(void *opaque, int version_id) { ICH9LPCPMRegs *pm = opaque; - ich9_pm_iospace_update(pm, pm->pm_io_base); + ich9_pm_iospace_update(pm, pm->io.addr); return 0; } @@ -349,9 +348,9 @@ static void ich9_pm_get_gpe0_blk(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { ICH9LPCPMRegs *pm = opaque; - uint32_t value = pm->pm_io_base + ICH9_PMIO_GPE0_STS; + uint64_t value = pm->io.addr + ICH9_PMIO_GPE0_STS; - visit_type_uint32(v, name, &value, errp); + visit_type_uint64(v, name, &value, errp); } static bool ich9_pm_get_memory_hotplug_support(Object *obj, Error **errp) @@ -440,9 +439,9 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm) pm->keep_pci_slot_hpc = true; pm->enable_tco = true; - object_property_add_uint32_ptr(obj, ACPI_PM_PROP_PM_IO_BASE, - &pm->pm_io_base, OBJ_PROP_FLAG_READ); - object_property_add(obj, ACPI_PM_PROP_GPE0_BLK, "uint32", + object_property_add_uint64_ptr(obj, ACPI_PM_PROP_PM_IO_BASE, + &pm->io.addr, OBJ_PROP_FLAG_READ); + object_property_add(obj, ACPI_PM_PROP_GPE0_BLK, "uint64", ich9_pm_get_gpe0_blk, NULL, NULL, pm); object_property_add_uint8_ptr(obj, ACPI_PM_PROP_GPE0_BLK_LEN, diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 370b34eacf..2e9bc63fca 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -91,13 +91,14 @@ static void apm_ctrl_changed(uint32_t val, void *arg) static void pm_io_space_update(PIIX4PMState *s) { PCIDevice *d = PCI_DEVICE(s); + uint32_t io_base; - s->io_base = le32_to_cpu(*(uint32_t *)(d->config + 0x40)); - s->io_base &= 0xffc0; + io_base = le32_to_cpu(*(uint32_t *)(d->config + 0x40)); + io_base &= 0xffc0; memory_region_transaction_begin(); memory_region_set_enabled(&s->io, d->config[0x80] & 1); - memory_region_set_address(&s->io, s->io_base); + memory_region_set_address(&s->io, io_base); memory_region_transaction_commit(); } @@ -433,8 +434,8 @@ static void piix4_pm_add_properties(PIIX4PMState *s) &s->ar.gpe.len, OBJ_PROP_FLAG_READ); object_property_add_uint16_ptr(OBJECT(s), ACPI_PM_PROP_SCI_INT, &sci_int, OBJ_PROP_FLAG_READ); - object_property_add_uint32_ptr(OBJECT(s), ACPI_PM_PROP_PM_IO_BASE, - &s->io_base, OBJ_PROP_FLAG_READ); + object_property_add_uint64_ptr(OBJECT(s), ACPI_PM_PROP_PM_IO_BASE, + &s->io.addr, OBJ_PROP_FLAG_READ); } static void piix4_pm_realize(PCIDevice *dev, Error **errp) From patchwork Sun Jan 22 17:07:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13111546 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C3A7EC38142 for ; Sun, 22 Jan 2023 17:09:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJdor-00024f-Jh; Sun, 22 Jan 2023 12:07:49 -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 1pJdoq-00024W-UT for qemu-devel@nongnu.org; Sun, 22 Jan 2023 12:07:48 -0500 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJdop-0005UN-HW for qemu-devel@nongnu.org; Sun, 22 Jan 2023 12:07:48 -0500 Received: by mail-ej1-x631.google.com with SMTP id tz11so25222377ejc.0 for ; Sun, 22 Jan 2023 09:07:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=yNV6Luq8syOfSpRqKm0ADXQJug9isKXJJADcOVA5Ux0=; b=caW6mi1ohgqp2yEKlFZundMAn+Ll1ggZcRNmwy0ogwvXNEY9yAT/uLXMq5NpnLNUKq f06Ayp6LDVUZXmIssG6v+1hqNWbH3Fdkz0Qa6Asl4dsrvH9ESrdNPWO8r+VhN0KcUqg3 pTSdAQ7fycGUG9Tat0EbBEH8d6VxNiBxRfpdUOVhL6+S4xyljuTIbEB95iqxAk8p8p3u 2XW6KpLud9d7OZJnfwSNdhtbwpr4s0A4E/loqLgHu/I1t2jz8qaQxUmCJv/tOVOP1iC8 0MfoZIuTXrJKI0nfSpjFIPTLO9enOZIkztCzYRxe7i/zOP/G25mhWwdFkEoGlBUulJSl d3lg== 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=yNV6Luq8syOfSpRqKm0ADXQJug9isKXJJADcOVA5Ux0=; b=eOIA63KFyzO4KaxhJgMQ2dpyemaEsr3m1pRYaycjFC72cCSly6EEhD+eaGIOHvGN++ Fd29Zeae+BYfA1mt2hgVpWiNeantgGbRF3GF25UowZ1OqlJ7V7nyQADcU5ALdTEQCQ0G GjKqIiLgC870mby4FJjj57Wj5cI4lLL7Lg4rhkKNHXqulTgAfc7PLw+/ozg966kbNmpL S7I/KE1gSmtZhI+P4tg+UsfiXxgBPn5RPqUhE65IDl1uT4+l/SWEiFvJ1sFj0aWRRxSV bZt2OnHYIlfOh9s3/+lvg1MR6zMx+lwifVL0guS0nCvGZb3VG86WQ1qldYUS9JN1jIF4 k5Ag== X-Gm-Message-State: AFqh2krVz6wGnNJSWWOHA5v/sEolDMKNyj58ih25pnLBIX5FYJaLhbHS PPulNvV7rhSYDqJbwqtvguqB1mD0YQcqDQ== X-Google-Smtp-Source: AMrXdXtw6Tn2+Jme9sKZ5QYtBiHeX9tkcvCWYNBeKGbgMFrGx3/Gb56jTLY+WYde1Rd02JPwQwcdgg== X-Received: by 2002:a17:906:4f93:b0:877:61e8:915a with SMTP id o19-20020a1709064f9300b0087761e8915amr15642627eju.75.1674407265986; Sun, 22 Jan 2023 09:07:45 -0800 (PST) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id kw4-20020a170907770400b0084d397e0938sm19670453ejc.195.2023.01.22.09.07.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Jan 2023 09:07:45 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Ani Sinha , "Michael S. Tsirkin" , Aurelien Jarno , Bernhard Beschow Subject: [PATCH 4/7] hw/acpi/ich9: Use ICH9_PMIO_GPE0_STS just once Date: Sun, 22 Jan 2023 18:07:21 +0100 Message-Id: <20230122170724.21868-5-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230122170724.21868-1-shentey@gmail.com> References: <20230122170724.21868-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=shentey@gmail.com; helo=mail-ej1-x631.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, FREEMAIL_FROM=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Cosmetic change emphasizing that always the actual address of the gpe0 block is returned. Signed-off-by: Bernhard Beschow --- hw/acpi/ich9.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index f8af238974..40a20e01ea 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -348,7 +348,9 @@ static void ich9_pm_get_gpe0_blk(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { ICH9LPCPMRegs *pm = opaque; - uint64_t value = pm->io.addr + ICH9_PMIO_GPE0_STS; + uint64_t value = pm->io.addr + pm->io_gpe.addr; + + assert(&pm->io == pm->io_gpe.container); visit_type_uint64(v, name, &value, errp); } From patchwork Sun Jan 22 17:07:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13111549 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E3606C25B4E for ; Sun, 22 Jan 2023 17:09:36 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJdou-00025x-4c; Sun, 22 Jan 2023 12:07:52 -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 1pJdos-000250-8O for qemu-devel@nongnu.org; Sun, 22 Jan 2023 12:07:50 -0500 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJdoq-0005Uj-LS for qemu-devel@nongnu.org; Sun, 22 Jan 2023 12:07:50 -0500 Received: by mail-ej1-x629.google.com with SMTP id ss4so25036152ejb.11 for ; Sun, 22 Jan 2023 09:07:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=WTp/1FVQ9VbeB7B8kOXkxftyXCVa8a/9MHE3WMaJPHc=; b=n2KujdI0uAbwEGMLjp4i665qKt5CT+qZuvrd7vXEikI4T8QJBBO+2d+29tQ6CNZlXE oQZyNO1HwpGv4hbCeusgWq/lDUKOrW+sRWSdVH5v8s4AG56mIjJND+/3QMWj1NKmAOJV pdEePQ0/ATK3DewazwiI38Uz3xxIZ2Uk3nqOc7kkl/m3XjVmpfmKokmjo7mpM0pmokuV OzsLYiTpQixGMfhvP7t7eXx5ptO4LcT0y/fzCRDo6VhUJvMbRJ0QilI+/SMEWomH/OOW ghJF5imWCg1CDPacS4d/I/jz5DJs/MEYiDdImpkxYcvb8gtQey7ik6K9T+x2So9Y5M0i AGXg== 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=WTp/1FVQ9VbeB7B8kOXkxftyXCVa8a/9MHE3WMaJPHc=; b=UvosXh4V2HG8viZ3ClVgplnDTeu7GdX/yliNpiWciGnxR1EWyCFHyCl+bbxuToqLMp /UXX0PKwMpcrD1AAogJtaNjW1jRkoR+6WKSfahAHXtflfJrPcJUY74+uJXFKkDSrn/ud vLmZzKehgmYq3zkfpAt80IfMU0jxuud7rFIverVDR+0n4sPyVCE7VKujZ/rCv0qGAwXJ w/yFNMJf3lBx5anVm9zDRvmbtSkisSIgvVvrWb9v8WcLnu3w8fwrAdCML8ojJ231Vdnt 3adQltdXVTYK6LbekD6xAg1vuNM9O0EV8kk0H9l1AQ6oRuDGWNrd9s4sVxtGQU7fWE0Q RFGw== X-Gm-Message-State: AFqh2kr4RYOCI19+u4LRJ9VAGPr3n8lf3TcFDR+wynpzIFyzQwMpDq03 jPfALw0Ncj3soHXMJ4+9vHlx4ZFA9boQCA== X-Google-Smtp-Source: AMrXdXukWhvVYcgJun4PclDz0IZUSXMj8PEx1xiMgS1J6ax7mb+UbLqj0DWjukMVBl0T6ryd+EBooQ== X-Received: by 2002:a17:906:7188:b0:7c1:eb:b2a7 with SMTP id h8-20020a170906718800b007c100ebb2a7mr36578381ejk.13.1674407266947; Sun, 22 Jan 2023 09:07:46 -0800 (PST) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id kw4-20020a170907770400b0084d397e0938sm19670453ejc.195.2023.01.22.09.07.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Jan 2023 09:07:46 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Ani Sinha , "Michael S. Tsirkin" , Aurelien Jarno , Bernhard Beschow Subject: [PATCH 5/7] hw/acpi/piix4: Fix offset of GPE0 registers Date: Sun, 22 Jan 2023 18:07:22 +0100 Message-Id: <20230122170724.21868-6-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230122170724.21868-1-shentey@gmail.com> References: <20230122170724.21868-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=shentey@gmail.com; helo=mail-ej1-x629.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, FREEMAIL_FROM=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The PIIX4 datasheet defines the GPSTS register to be at offset 0x0c of the power management I/O register block. This register block is represented in the device model by the io attribute. So make io_gpe a child memory region of io at offset 0x0c. Note that SeaBIOS sets the base address of the register block to 0x600, resulting in the io_gpe block to start at 0x60c. GPE_BASE is defined as 0xafe0 which is 0xa9d4 bytes off. In order to preserve compatibilty, create an io_gpe_qemu memory region alias at GPE_BASE. Signed-off-by: Bernhard Beschow --- include/hw/acpi/piix4.h | 1 + hw/acpi/piix4.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/hw/acpi/piix4.h b/include/hw/acpi/piix4.h index 62e1925a1f..4e6cad9e8c 100644 --- a/include/hw/acpi/piix4.h +++ b/include/hw/acpi/piix4.h @@ -40,6 +40,7 @@ struct PIIX4PMState { MemoryRegion io; MemoryRegion io_gpe; + MemoryRegion io_gpe_qemu; ACPIREGS ar; APMState apm; diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 2e9bc63fca..836f9026b1 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -49,6 +49,7 @@ #include "qom/object.h" #define GPE_BASE 0xafe0 +#define GPE_OFS 0xc #define GPE_LEN 4 #define ACPI_PCIHP_ADDR_PIIX4 0xae00 @@ -429,7 +430,7 @@ static void piix4_pm_add_properties(PIIX4PMState *s) object_property_add_uint8_ptr(OBJECT(s), ACPI_PM_PROP_ACPI_DISABLE_CMD, &acpi_disable_cmd, OBJ_PROP_FLAG_READ); object_property_add_uint64_ptr(OBJECT(s), ACPI_PM_PROP_GPE0_BLK, - &s->io_gpe.addr, OBJ_PROP_FLAG_READ); + &s->io_gpe_qemu.addr, OBJ_PROP_FLAG_READ); object_property_add_uint8_ptr(OBJECT(s), ACPI_PM_PROP_GPE0_BLK_LEN, &s->ar.gpe.len, OBJ_PROP_FLAG_READ); object_property_add_uint16_ptr(OBJECT(s), ACPI_PM_PROP_SCI_INT, @@ -558,7 +559,11 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent, { memory_region_init_io(&s->io_gpe, OBJECT(s), &piix4_gpe_ops, s, "acpi-gpe0", GPE_LEN); - memory_region_add_subregion(parent, GPE_BASE, &s->io_gpe); + memory_region_add_subregion(&s->io, GPE_OFS, &s->io_gpe); + + memory_region_init_alias(&s->io_gpe_qemu, OBJECT(s), "acpi-gpe0-qemu", + &s->io_gpe, 0, memory_region_size(&s->io_gpe)); + memory_region_add_subregion(parent, GPE_BASE, &s->io_gpe_qemu); if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) { acpi_pcihp_init(OBJECT(s), &s->acpi_pci_hotplug, bus, parent, From patchwork Sun Jan 22 17:07:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13111548 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B66F0C25B4E for ; Sun, 22 Jan 2023 17:09:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJdou-000266-Lg; Sun, 22 Jan 2023 12:07:52 -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 1pJdos-00025J-KX for qemu-devel@nongnu.org; Sun, 22 Jan 2023 12:07:50 -0500 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJdor-0005TS-1P for qemu-devel@nongnu.org; Sun, 22 Jan 2023 12:07:50 -0500 Received: by mail-ej1-x634.google.com with SMTP id qx13so25025160ejb.13 for ; Sun, 22 Jan 2023 09:07:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=eI89IUN7RUUfOnazKDFhGcoR2byoRpvGz9uEt6uTd/4=; b=KcEMhD9Ocq0RhW4sOjxD92H4y8Y/S8rCWBodI/SHp4rj26SDQio/QtpQMU+U+dGYWJ rKfAvRGUkj99F0R9swfYiwX0zJrlFVDa5a8TkzzqeQWgrYHr+rNRW0u3UF2vo6RRj1c+ 0hNTq3qXXAwsBOwdJyZUCAUAydLmyiDjHG5FWidwxh4P96p6Le8ZHC6ioH7rAIJNcimU /diBI4t+NrMoZJx28iOgLQVGVs7hyeGOtOCdUvhTvQz+jUtS9mZc5I7kUqx5Rj1mSklb yPC+Tse7wmZdYshhyzV3bBoR/I9GYuiuI4+xxeQoc9b5v5SqR/GzTs1WZs1CZgxZ79Y2 DvdQ== 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=eI89IUN7RUUfOnazKDFhGcoR2byoRpvGz9uEt6uTd/4=; b=flswteq6so29A1hM+4mfZTB/HkQ9mzuqOL3lAX/duUoKOdvxtC6vMKDfQbMCZLJscR lh4giH8GlSJaEBG8IhS1Tdmf5RnB1G/oMY0fABiVSgS0DV9pHGKBjJza9xe7o3a/Q70Y WhVgjg7wJz01BX+voqbFlQTNZHW78XGd8qDX9ZtdVt7+hKSbLzTcm5/F3XlGPKDEM/nE 3T8pISHT+JBtCCFVtCXZHipDVscqEJN3Wuhx0EXdQ95CubcqTFKjmGa+1MZVb851qGGH r4IITpYpsa8lC4sO9lGhtUsjr6mIOgpJG3Tn/TY7d6CjS1UUemSZY4ef0ENaENckmscN dFuQ== X-Gm-Message-State: AFqh2kpAjoSr5mZVEqcx4HI7s7bvmbCYbyh3ppBBpFMEB/saLrcmm1Rt wi919aBHCIszejZFi97DoEa94SWoSasSdQ== X-Google-Smtp-Source: AMrXdXu40VdWxBunHDZGLJ14lcKQ3Ao6DdZsTeQt+4RyWXDlp+YvjRDDSA7V7sOuN6uhbCff83pabg== X-Received: by 2002:a17:906:6844:b0:86e:f478:f598 with SMTP id a4-20020a170906684400b0086ef478f598mr22331066ejs.44.1674407268141; Sun, 22 Jan 2023 09:07:48 -0800 (PST) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id kw4-20020a170907770400b0084d397e0938sm19670453ejc.195.2023.01.22.09.07.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Jan 2023 09:07:47 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Ani Sinha , "Michael S. Tsirkin" , Aurelien Jarno , Bernhard Beschow Subject: [PATCH 6/7] hw/acpi: Trace GPE access in all device models, not just PIIX4 Date: Sun, 22 Jan 2023 18:07:23 +0100 Message-Id: <20230122170724.21868-7-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230122170724.21868-1-shentey@gmail.com> References: <20230122170724.21868-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=shentey@gmail.com; helo=mail-ej1-x634.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, FREEMAIL_FROM=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Igor Mammedov --- hw/acpi/core.c | 5 +++++ hw/acpi/piix4.c | 3 --- hw/acpi/trace-events | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/hw/acpi/core.c b/hw/acpi/core.c index 6da275c599..a33e410e69 100644 --- a/hw/acpi/core.c +++ b/hw/acpi/core.c @@ -32,6 +32,7 @@ #include "qemu/module.h" #include "qemu/option.h" #include "sysemu/runstate.h" +#include "trace.h" struct acpi_table_header { uint16_t _length; /* our length, not actual part of the hdr */ @@ -686,6 +687,8 @@ void acpi_gpe_ioport_writeb(ACPIREGS *ar, uint32_t addr, uint32_t val) { uint8_t *cur; + trace_acpi_gpe_ioport_writeb(addr, val); + cur = acpi_gpe_ioport_get_ptr(ar, addr); if (addr < ar->gpe.len / 2) { /* GPE_STS */ @@ -709,6 +712,8 @@ uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr) val = *cur; } + trace_acpi_gpe_ioport_readb(addr, val); + return val; } diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 836f9026b1..b65ddb8e44 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -45,7 +45,6 @@ #include "hw/acpi/acpi_dev_interface.h" #include "migration/vmstate.h" #include "hw/core/cpu.h" -#include "trace.h" #include "qom/object.h" #define GPE_BASE 0xafe0 @@ -510,7 +509,6 @@ static uint64_t gpe_readb(void *opaque, hwaddr addr, unsigned width) PIIX4PMState *s = opaque; uint32_t val = acpi_gpe_ioport_readb(&s->ar, addr); - trace_piix4_gpe_readb(addr, width, val); return val; } @@ -519,7 +517,6 @@ static void gpe_writeb(void *opaque, hwaddr addr, uint64_t val, { PIIX4PMState *s = opaque; - trace_piix4_gpe_writeb(addr, width, val); acpi_gpe_ioport_writeb(&s->ar, addr, val); acpi_update_sci(&s->ar, s->irq); } diff --git a/hw/acpi/trace-events b/hw/acpi/trace-events index 78e0a8670e..159937ddb9 100644 --- a/hw/acpi/trace-events +++ b/hw/acpi/trace-events @@ -17,6 +17,10 @@ mhp_acpi_clear_remove_evt(uint32_t slot) "slot[0x%"PRIx32"] clear remove event" mhp_acpi_pc_dimm_deleted(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm deleted" mhp_acpi_pc_dimm_delete_failed(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm delete failed" +# core.c +acpi_gpe_ioport_readb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " ==> 0x%" PRIx8 +acpi_gpe_ioport_writeb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " <== 0x%" PRIx8 + # cpu.c cpuhp_acpi_invalid_idx_selected(uint32_t idx) "0x%"PRIx32 cpuhp_acpi_read_flags(uint32_t idx, uint8_t flags) "idx[0x%"PRIx32"] flags: 0x%"PRIx8 @@ -48,10 +52,6 @@ acpi_pci_sel_read(uint32_t val) "%" PRIu32 acpi_pci_ej_write(uint64_t addr, uint64_t data) "0x%" PRIx64 " <== %" PRIu64 acpi_pci_sel_write(uint64_t addr, uint64_t data) "0x%" PRIx64 " <== %" PRIu64 -# piix4.c -piix4_gpe_readb(uint64_t addr, unsigned width, uint64_t val) "addr: 0x%" PRIx64 " width: %d ==> 0x%" PRIx64 -piix4_gpe_writeb(uint64_t addr, unsigned width, uint64_t val) "addr: 0x%" PRIx64 " width: %d <== 0x%" PRIx64 - # tco.c tco_timer_reload(int ticks, int msec) "ticks=%d (%d ms)" tco_timer_expired(int timeouts_no, bool strap, bool no_reboot) "timeouts_no=%d no_reboot=%d/%d" From patchwork Sun Jan 22 17:07:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13111545 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6ACC0C25B4E for ; Sun, 22 Jan 2023 17:08:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJdov-00026E-RK; Sun, 22 Jan 2023 12:07:53 -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 1pJdou-00025y-7i for qemu-devel@nongnu.org; Sun, 22 Jan 2023 12:07:52 -0500 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJdos-0005V5-Mc for qemu-devel@nongnu.org; Sun, 22 Jan 2023 12:07:52 -0500 Received: by mail-ej1-x633.google.com with SMTP id qx13so25025203ejb.13 for ; Sun, 22 Jan 2023 09:07:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=55nP5nNHv1CqBBrsvggBWBrAdo4oEubQ3LLGbVvXnaI=; b=Zq2A7M6RXabHrttR39XiFU3gWSLZNFH2yydlttFAzWFdvdFEsZt7QBmkKgCCqazxIL zy+7Sf8wDBUXw74kP+M+aBcfN+6w8knjihsQjIoJIjJucZ4IA6/Mop/CuYnVZ7Q7ESR/ EQFJsdSG/h/KZPdMByU4vEaKwqTSaT+b0aGyB/sS/uoPPLhbDXMElX4f4k6kpgYy4pqW 0Xs7DW4x9XygNDpow42jHJ9vWV8q70Ze57Y+7s5eQ2GZ6oivwXaiXfqzEqa0+2QBOwG/ IaYYaU7e+zEGjgBkTmxCqx5vA2uhrKVZPUfWg2nMKstrMoDpfx9ztLqhjViO9ro5leja 1CIQ== 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=55nP5nNHv1CqBBrsvggBWBrAdo4oEubQ3LLGbVvXnaI=; b=hA2qmbhF9MWebYMZ1bhMcItbWgP70ISUdsPv/UfhAKRbvdsMu6srUo7s8GebjXGt3d H4nyG9duLhLe8rI4R4ZeGVvX78lxRTMwq6IQJNFDOH7gANceTB0dy5qUNeyUwejIy2Nv FzTOf2PBdDY6OGtk/83Zco0yiWck36jPfhauvQUxPLzRaG5zCRDygZ+AA7qilUyWePFp W9yVkpsjIdJaQyMcFGhPwIXi8CrST8pyO8ucVG/CPH/JaPmvb56630GuhTVvBLqXH/qe NYZCV9kVGMy313nRawlSgJUrC/6gVaZO3wipc47ltEqn+jfFbHtr08UOnAZ2KU2LVDIR XLWQ== X-Gm-Message-State: AFqh2kr9bNSOg4khaMuPOehU+KZJbHgmiDd0LurVJhjDBuYprGZEAJfQ fXh+gVTWLnjVIuxhzfScvMylfpixLYHLDg== X-Google-Smtp-Source: AMrXdXskVSqK1IHroQcrP0p6vic9KS4gJ7VHSMHkLoJe5d/yYzuAElhSiU7oPUlnwFvknZ5G76SG/g== X-Received: by 2002:a17:906:df49:b0:84c:f9b0:b54a with SMTP id if9-20020a170906df4900b0084cf9b0b54amr18957784ejc.58.1674407268982; Sun, 22 Jan 2023 09:07:48 -0800 (PST) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id kw4-20020a170907770400b0084d397e0938sm19670453ejc.195.2023.01.22.09.07.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Jan 2023 09:07:48 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Ani Sinha , "Michael S. Tsirkin" , Aurelien Jarno , Bernhard Beschow Subject: [PATCH 7/7] hw/acpi/core: Trace enable and status registers of GPE separately Date: Sun, 22 Jan 2023 18:07:24 +0100 Message-Id: <20230122170724.21868-8-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230122170724.21868-1-shentey@gmail.com> References: <20230122170724.21868-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=shentey@gmail.com; helo=mail-ej1-x633.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, FREEMAIL_FROM=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The bit positions of both registers are related. Tracing the registers independently results in the same offsets across these registers which eases debugging. Signed-off-by: Bernhard Beschow Acked-by: Igor Mammedov --- hw/acpi/core.c | 10 +++++++--- hw/acpi/trace-events | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/hw/acpi/core.c b/hw/acpi/core.c index a33e410e69..cc33605d61 100644 --- a/hw/acpi/core.c +++ b/hw/acpi/core.c @@ -687,13 +687,13 @@ void acpi_gpe_ioport_writeb(ACPIREGS *ar, uint32_t addr, uint32_t val) { uint8_t *cur; - trace_acpi_gpe_ioport_writeb(addr, val); - cur = acpi_gpe_ioport_get_ptr(ar, addr); if (addr < ar->gpe.len / 2) { + trace_acpi_gpe_sts_ioport_writeb(addr, val); /* GPE_STS */ *cur = (*cur) & ~val; } else if (addr < ar->gpe.len) { + trace_acpi_gpe_en_ioport_writeb(addr - (ar->gpe.len / 2), val); /* GPE_EN */ *cur = val; } else { @@ -712,7 +712,11 @@ uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr) val = *cur; } - trace_acpi_gpe_ioport_readb(addr, val); + if (addr < ar->gpe.len / 2) { + trace_acpi_gpe_sts_ioport_readb(addr, val); + } else { + trace_acpi_gpe_en_ioport_readb(addr - (ar->gpe.len / 2), val); + } return val; } diff --git a/hw/acpi/trace-events b/hw/acpi/trace-events index 159937ddb9..d387adfb0b 100644 --- a/hw/acpi/trace-events +++ b/hw/acpi/trace-events @@ -18,8 +18,10 @@ mhp_acpi_pc_dimm_deleted(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm deleted" mhp_acpi_pc_dimm_delete_failed(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm delete failed" # core.c -acpi_gpe_ioport_readb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " ==> 0x%" PRIx8 -acpi_gpe_ioport_writeb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " <== 0x%" PRIx8 +acpi_gpe_sts_ioport_readb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " ==> 0x%" PRIx8 +acpi_gpe_en_ioport_readb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " ==> 0x%" PRIx8 +acpi_gpe_sts_ioport_writeb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " <== 0x%" PRIx8 +acpi_gpe_en_ioport_writeb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " <== 0x%" PRIx8 # cpu.c cpuhp_acpi_invalid_idx_selected(uint32_t idx) "0x%"PRIx32