From patchwork Thu Dec 21 15:07:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13502237 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 23D14C46CD2 for ; Thu, 21 Dec 2023 15:10:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGKeg-00086l-Cb; Thu, 21 Dec 2023 10:08:10 -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 1rGKee-00086T-OJ; Thu, 21 Dec 2023 10:08:08 -0500 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGKed-0004Ie-2g; Thu, 21 Dec 2023 10:08:08 -0500 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-54c79968ffbso981271a12.3; Thu, 21 Dec 2023 07:08:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703171282; x=1703776082; 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=f6QSb1FgBHOx15gmSAz7A8OR4SzZo63fPyAah9GqvLw=; b=lD7jz4DIaRHiNlDCt3JaMxvtHCkm5jNgaaCZWhyKIbxCi3hdG9oyTRM9pjdY1E3ryK vQ7bUnZo25bBOXl1Lh6O3qU5SaK0RFKp1p9lZCZclrAs/Q/53dlF1CttYduQLbXuRRq6 aXvGWCj/ZJGoI7zB0uR2yKqkDvAlyyok+BcjtVWzCCH7konWikGatDvtoRJyhul0p+4p +eycGtZRPUeUsGNwBOpjfZVQtvfZpqezFtL8pM4G2cy4KeH/t1w9YhlgaW7h0eqK3OTw VCHVevZ2MqbH1hBochgRnqLYRSjBVSqjiQlcUcgibrH5d/p9FoZigUoy8PuSrpNTEQ3n pbfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703171282; x=1703776082; 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=f6QSb1FgBHOx15gmSAz7A8OR4SzZo63fPyAah9GqvLw=; b=SwDhBfXs30MO6jDyHafOl0EtBD2p/DTpK4oCY3eVXPKLwCk2qBeZqYLvYESTqhiBQW Rlyz1qW+atReFwiqg50oknJIGGXXK3LqmT3Z6tgVamzBIWUuaIscnq0yT7qC9rYVw6F0 ZwrZoLApkNh8aB1wrF/DKN9coQgHx0WiAfLR0vJ6GzY2/xl8WqvsFC+uRQFNDkZbW6+p ZqdqnHy+TOJK6ndZNAqHmtT44NJI+okPIpsDsp5QlmamZYMZXv6loDKDZRDOfFXVO7t0 QjT3xYKgY8udY+7ciD4Yh9bzLUCpMQ1Z3ZiHfpX0jOcGZ3QkVujK5CWZ+VWu+69beOJW vlPg== X-Gm-Message-State: AOJu0YxN6ngY7/e/zvYZgKS1HlJ9sUe1L0dDQd1PYlWQCO0Bo9YkQ/4n +qDwJADO7BbDOBCWqggVgowx7ogTYoBcGA== X-Google-Smtp-Source: AGHT+IGWuFbrYOPgfFxBwRFob9N5D3BMeQyNU0f2nZ4lzWnQtDD1OrW9DyvgT4cVrDlEoFPmlEWG3A== X-Received: by 2002:a50:871a:0:b0:553:ca52:3fb3 with SMTP id i26-20020a50871a000000b00553ca523fb3mr1695176edb.42.1703171282583; Thu, 21 Dec 2023 07:08:02 -0800 (PST) Received: from archlinux.. (pd95ed842.dip0.t-ipconnect.de. [217.94.216.66]) by smtp.gmail.com with ESMTPSA id t25-20020a056402241900b00553b6b5bb44sm1264264eda.67.2023.12.21.07.08.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 07:08:01 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Juan Quintela , =?utf-8?q?Herv=C3=A9_Poussineau?= , Hanna Reitz , Fabiano Rosas , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Mark Cave-Ayland , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Eduardo Habkost , Thomas Huth , Peter Xu , Jiaxun Yang , qemu-ppc@nongnu.org, Kevin Wolf , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , Sergio Lopez , John Snow , Artyom Tarasenko , David Hildenbrand , Nicholas Piggin , Marcel Apfelbaum , BALATON Zoltan , qemu-block@nongnu.org, Richard Henderson , Leonardo Bras , "Michael S. Tsirkin" , Bernhard Beschow Subject: [PATCH v3 01/11] hw/block/fdc-isa: Move portio_list from FDCtrl to FDCtrlISABus Date: Thu, 21 Dec 2023 16:07:40 +0100 Message-ID: <20231221150750.5435-2-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221150750.5435-1-shentey@gmail.com> References: <20231221150750.5435-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52a; envelope-from=shentey@gmail.com; helo=mail-ed1-x52a.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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org FDCtrl::portio_list isn't used inside FDCtrl context but only inside FDCtrlISABus context, so move it there. Signed-off-by: Bernhard Beschow Reviewed-by: BALATON Zoltan --- hw/block/fdc-internal.h | 2 -- hw/block/fdc-isa.c | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/block/fdc-internal.h b/hw/block/fdc-internal.h index 036392e9fc..fef2bfbbf5 100644 --- a/hw/block/fdc-internal.h +++ b/hw/block/fdc-internal.h @@ -26,7 +26,6 @@ #define HW_BLOCK_FDC_INTERNAL_H #include "exec/memory.h" -#include "exec/ioport.h" #include "hw/block/block.h" #include "hw/block/fdc.h" #include "qapi/qapi-types-block.h" @@ -140,7 +139,6 @@ struct FDCtrl { /* Timers state */ uint8_t timer0; uint8_t timer1; - PortioList portio_list; }; extern const FDFormat fd_formats[]; diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c index 7ec075e470..b4c92b40b3 100644 --- a/hw/block/fdc-isa.c +++ b/hw/block/fdc-isa.c @@ -42,6 +42,7 @@ #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "sysemu/sysemu.h" +#include "exec/ioport.h" #include "qemu/log.h" #include "qemu/main-loop.h" #include "qemu/module.h" @@ -60,6 +61,7 @@ struct FDCtrlISABus { uint32_t irq; uint32_t dma; struct FDCtrl state; + PortioList portio_list; int32_t bootindexA; int32_t bootindexB; }; @@ -91,7 +93,7 @@ static void isabus_fdc_realize(DeviceState *dev, Error **errp) FDCtrl *fdctrl = &isa->state; Error *err = NULL; - isa_register_portio_list(isadev, &fdctrl->portio_list, + isa_register_portio_list(isadev, &isa->portio_list, isa->iobase, fdc_portio_list, fdctrl, "fdc"); From patchwork Thu Dec 21 15:07:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13502239 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 B2880C35274 for ; Thu, 21 Dec 2023 15:10:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGKej-00087y-3F; Thu, 21 Dec 2023 10:08:13 -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 1rGKeg-000874-W0; Thu, 21 Dec 2023 10:08:11 -0500 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGKed-0004Iq-Da; Thu, 21 Dec 2023 10:08:10 -0500 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-54cd2281ccbso1035995a12.2; Thu, 21 Dec 2023 07:08:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703171284; x=1703776084; 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=wfHRRNWqxD5Cz4yUuf761Ur5xxVpSmPBcVYJl+qexEY=; b=BABXFLT+5bTfFvqaz8wYSa0CMcbmOR5JPSbi/2nOxi5zJHtVntaD8MNCelhFZ1+68b IEDlJM9jFBxI0AujFVZHr2r4La/gBd6Vik15xtzJBnruFMru+nFCr57NBji6y/X+LvZP 1Mp7gGvGeaDVJRyo3f7YF+x8drU+sNcGvU8nWIu91Mq43GcJHTJbrg4TtSymOKrF1aOB gd9V+5eMrwTJDvnuJ8lJoEMyxvbiBCPb003mychJOuHM39g2ac7GnO9uoGhKj2iFhCco VqDZXMXGIHXS6YrNDApaNjU/k5GGf/7AJ3AgapA7goSTcLlNY/slTs+fZPOjW9BPFh++ NMlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703171284; x=1703776084; 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=wfHRRNWqxD5Cz4yUuf761Ur5xxVpSmPBcVYJl+qexEY=; b=UnSW2sOwBIj8Jf9xYtPMfY7ayVqOQn5bbykH130CHBZZuLeQP5H+Y3UOHc9eK2vRti Kbl/L4EufOPPcMSmIUZDr/cb0CGdIjBR7uJOOLlCe1Vhs0zfEsbGjLV+L+1IfSrPGL26 43YgSUdvoqWz87IsaG4MdnQS6lLBXpGQ213+Dq6XlYU4aMWZoVo4byiHCMN6OB2fxsGK rguHYhskn460QmogScOJkHjkLhJ9PSg0yggI8BIB88PWnMCL75q3CpEWX7nYzmTCf0km o2Xb+sGeDDCM8+w8qcdLGNhNlJru2eJCRAujS5d45002qxd3/krbgxYjdSJUBL+Y7xRz UAqA== X-Gm-Message-State: AOJu0Yych8pukc2D+G3eLXUziCt8H8vjxtVkI3LSauXMeaOxh5MK1lAW zuyLgCGUPLOflk1Gf1BK9tg3Opi6eGD8tg== X-Google-Smtp-Source: AGHT+IGClyiFwkPSF3jeHox3DxpqMwTGrl5lfTNJt/kx+V42xAaxU0Wb2kxE+/p+ICDkUOF6SDlbTw== X-Received: by 2002:a50:cbcc:0:b0:54c:d2:ea39 with SMTP id l12-20020a50cbcc000000b0054c00d2ea39mr11638269edi.18.1703171284259; Thu, 21 Dec 2023 07:08:04 -0800 (PST) Received: from archlinux.. (pd95ed842.dip0.t-ipconnect.de. [217.94.216.66]) by smtp.gmail.com with ESMTPSA id t25-20020a056402241900b00553b6b5bb44sm1264264eda.67.2023.12.21.07.08.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 07:08:03 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Juan Quintela , =?utf-8?q?Herv=C3=A9_Poussineau?= , Hanna Reitz , Fabiano Rosas , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Mark Cave-Ayland , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Eduardo Habkost , Thomas Huth , Peter Xu , Jiaxun Yang , qemu-ppc@nongnu.org, Kevin Wolf , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , Sergio Lopez , John Snow , Artyom Tarasenko , David Hildenbrand , Nicholas Piggin , Marcel Apfelbaum , BALATON Zoltan , qemu-block@nongnu.org, Richard Henderson , Leonardo Bras , "Michael S. Tsirkin" , Bernhard Beschow Subject: [PATCH v3 02/11] hw/block/fdc-sysbus: Move iomem from FDCtrl to FDCtrlSysBus Date: Thu, 21 Dec 2023 16:07:41 +0100 Message-ID: <20231221150750.5435-3-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221150750.5435-1-shentey@gmail.com> References: <20231221150750.5435-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=shentey@gmail.com; helo=mail-ed1-x52f.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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org FDCtrl::iomem isn't used inside FDCtrl context but only inside FDCtrlSysBus context, so move it there. Signed-off-by: Bernhard Beschow Reviewed-by: BALATON Zoltan --- hw/block/fdc-internal.h | 2 -- hw/block/fdc-sysbus.c | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/block/fdc-internal.h b/hw/block/fdc-internal.h index fef2bfbbf5..e219623dc7 100644 --- a/hw/block/fdc-internal.h +++ b/hw/block/fdc-internal.h @@ -25,7 +25,6 @@ #ifndef HW_BLOCK_FDC_INTERNAL_H #define HW_BLOCK_FDC_INTERNAL_H -#include "exec/memory.h" #include "hw/block/block.h" #include "hw/block/fdc.h" #include "qapi/qapi-types-block.h" @@ -91,7 +90,6 @@ typedef struct FDrive { } FDrive; struct FDCtrl { - MemoryRegion iomem; qemu_irq irq; /* Controller state */ QEMUTimer *result_timer; diff --git a/hw/block/fdc-sysbus.c b/hw/block/fdc-sysbus.c index 86ea51d003..e197b97262 100644 --- a/hw/block/fdc-sysbus.c +++ b/hw/block/fdc-sysbus.c @@ -26,6 +26,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qom/object.h" +#include "exec/memory.h" #include "hw/sysbus.h" #include "hw/block/fdc.h" #include "migration/vmstate.h" @@ -52,6 +53,7 @@ struct FDCtrlSysBus { /*< public >*/ struct FDCtrl state; + MemoryRegion iomem; }; static uint64_t fdctrl_read_mem(void *opaque, hwaddr reg, unsigned ize) @@ -146,11 +148,11 @@ static void sysbus_fdc_common_instance_init(Object *obj) qdev_set_legacy_instance_id(dev, 0 /* io */, 2); /* FIXME */ - memory_region_init_io(&fdctrl->iomem, obj, + memory_region_init_io(&sys->iomem, obj, sbdc->use_strict_io ? &fdctrl_mem_strict_ops : &fdctrl_mem_ops, fdctrl, "fdc", 0x08); - sysbus_init_mmio(sbd, &fdctrl->iomem); + sysbus_init_mmio(sbd, &sys->iomem); sysbus_init_irq(sbd, &fdctrl->irq); qdev_init_gpio_in(dev, fdctrl_handle_tc, 1); From patchwork Thu Dec 21 15:07:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13502232 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 40FB5C35274 for ; Thu, 21 Dec 2023 15:09:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGKej-00088m-VP; Thu, 21 Dec 2023 10:08:14 -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 1rGKeh-00087V-Mv; Thu, 21 Dec 2023 10:08:11 -0500 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGKeg-0004JD-0H; Thu, 21 Dec 2023 10:08:11 -0500 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-54cb4fa667bso1147202a12.3; Thu, 21 Dec 2023 07:08:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703171286; x=1703776086; 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=y7ExFl9Onle82wvecw0jGK0kYbFQMh4wlO/YWeYYimY=; b=lqfYn0DvQmzxnbShtGFKkyW8m6qnDeyBGWbKNsOq8qXbLKVVFExvVCwIDz7aueBgDA QXWRWbVsY8YHEcx08uNburKKn0VH6IDcNIof3/vzyssIKuCFUoIhCEH3epNVuGlfoqu8 LiTjSCUBkaa9Cht0NFgnwdVdaBD/8kYAoRzamuztCTyPmiQ9QsV2yKgaKfxJtilByD2r 8k1ceBbosnJ5xnKEVjbsnvrDguGd19jVULRHp8pXcizl/1/2MP8g9evhnDTHHpIpXMh/ bTpYeORDFEY88lI31y56Fcyy+FtZCiL6NbIanmbKB/e+6eRr6XkLDaJNz0+JfHkvxIuH 5MLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703171286; x=1703776086; 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=y7ExFl9Onle82wvecw0jGK0kYbFQMh4wlO/YWeYYimY=; b=MqzvmQ8aBeZsOwXj49fA8zhZM49aXgh/05AoAaxRU6oddYgZtuffZtK48oJZdjgiQl cGIsT+04nrLGNQrtrlKcStOxz+F5/ZgCGzuTqvNkmshc05i4Ie2ccJxUichCEvsQ+KPO Ta3Tflw71SwGsPit4VWgnbgOWJp2RnrGoq66zPH9Dg/WAscSEi0GMjipVWoayz2TrmtQ EEGeovBKNz1dMoSxLSm4ZabfzuQILpYd0wo6NjEVr3P8QqR72KwFhcZBzFuLhv++PkI9 fm7DL6dzR5oXq8O9oLAWfp9Q5BRP1D5GEOntLNEBRQ1j3lcv7f2oqESvwCbhksaiv2z/ 3qxw== X-Gm-Message-State: AOJu0YxsTcqz2WVXvNsiPDNATmThHymOE7/NK4yDBxKf/vEtnhJnjx6g qbI3l0fn4JNO+klGcmM7PsE2TQvCuKlCoA== X-Google-Smtp-Source: AGHT+IGSFmGciZHdvmJpaFDwiIz0Wf3TU2MabbChsT91kf6bhWGAt7sMyWXyFvBS8nreA3s3wc2M8A== X-Received: by 2002:a50:999a:0:b0:553:6562:be8 with SMTP id m26-20020a50999a000000b0055365620be8mr3156874edb.44.1703171286146; Thu, 21 Dec 2023 07:08:06 -0800 (PST) Received: from archlinux.. (pd95ed842.dip0.t-ipconnect.de. [217.94.216.66]) by smtp.gmail.com with ESMTPSA id t25-20020a056402241900b00553b6b5bb44sm1264264eda.67.2023.12.21.07.08.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 07:08:05 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Juan Quintela , =?utf-8?q?Herv=C3=A9_Poussineau?= , Hanna Reitz , Fabiano Rosas , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Mark Cave-Ayland , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Eduardo Habkost , Thomas Huth , Peter Xu , Jiaxun Yang , qemu-ppc@nongnu.org, Kevin Wolf , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , Sergio Lopez , John Snow , Artyom Tarasenko , David Hildenbrand , Nicholas Piggin , Marcel Apfelbaum , BALATON Zoltan , qemu-block@nongnu.org, Richard Henderson , Leonardo Bras , "Michael S. Tsirkin" , Bernhard Beschow Subject: [PATCH v3 03/11] hw/char/parallel: Move portio_list from ParallelState to ISAParallelState Date: Thu, 21 Dec 2023 16:07:42 +0100 Message-ID: <20231221150750.5435-4-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221150750.5435-1-shentey@gmail.com> References: <20231221150750.5435-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=shentey@gmail.com; helo=mail-ed1-x530.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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org ParallelState::portio_list isn't used inside ParallelState context but only inside ISAParallelState context, so move it there. Signed-off-by: Bernhard Beschow Reviewed-by: BALATON Zoltan --- include/hw/char/parallel-isa.h | 2 ++ include/hw/char/parallel.h | 2 -- hw/char/parallel.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/hw/char/parallel-isa.h b/include/hw/char/parallel-isa.h index d24ccecf05..3b783bd08d 100644 --- a/include/hw/char/parallel-isa.h +++ b/include/hw/char/parallel-isa.h @@ -12,6 +12,7 @@ #include "parallel.h" +#include "exec/ioport.h" #include "hw/isa/isa.h" #include "qom/object.h" @@ -25,6 +26,7 @@ struct ISAParallelState { uint32_t iobase; uint32_t isairq; ParallelState state; + PortioList portio_list; }; #endif /* HW_PARALLEL_ISA_H */ diff --git a/include/hw/char/parallel.h b/include/hw/char/parallel.h index 7b5a309a03..cfb97cc7cc 100644 --- a/include/hw/char/parallel.h +++ b/include/hw/char/parallel.h @@ -1,7 +1,6 @@ #ifndef HW_PARALLEL_H #define HW_PARALLEL_H -#include "exec/ioport.h" #include "exec/memory.h" #include "hw/isa/isa.h" #include "hw/irq.h" @@ -22,7 +21,6 @@ typedef struct ParallelState { uint32_t last_read_offset; /* For debugging */ /* Memory-mapped interface */ int it_shift; - PortioList portio_list; } ParallelState; void parallel_hds_isa_init(ISABus *bus, int n); diff --git a/hw/char/parallel.c b/hw/char/parallel.c index 147c900f0d..c1747cbb75 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -532,7 +532,7 @@ static void parallel_isa_realizefn(DeviceState *dev, Error **errp) s->status = dummy; } - isa_register_portio_list(isadev, &s->portio_list, base, + isa_register_portio_list(isadev, &isa->portio_list, base, (s->hw_driver ? &isa_parallel_portio_hw_list[0] : &isa_parallel_portio_sw_list[0]), From patchwork Thu Dec 21 15:07:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13502238 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 64444C35274 for ; Thu, 21 Dec 2023 15:10:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGKen-0008Ag-95; Thu, 21 Dec 2023 10:08:17 -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 1rGKel-00089K-75; Thu, 21 Dec 2023 10:08:15 -0500 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGKei-0004JW-21; Thu, 21 Dec 2023 10:08:13 -0500 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2cc6c028229so9855181fa.2; Thu, 21 Dec 2023 07:08:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703171288; x=1703776088; 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=LzCBxca0nCRHR665JCCwURJqMXPSu7RYmWln7L2TOQo=; b=JKxZYdui59DdItgYhwY8P7dMQ9OsiuU8NmSo6YpUBCZdfXpNlNkt/RRMOOwgqDJUMc VU9SUomlYKJDj20iGtTY9gKgijecGsrdipO/EOkIlFnzrgYJlKvomS5dhqJzmm6BBMbq wkn3INitpN/PCBOb8PJe/Z3fUOma6WkRdlJXN0/7BqkRVaEnXtSpu/r8UTwXZjgunMju rGsvcBed6I5att+0XqbdhxR/QMzERo76w+trMbjHhDhvzgEV8RKfXwmswsAUkAuVj4LN GYNz6Mtbkba+d4lUMlxBtFK9evksPJZWxiXM/OSl6rkvL0BgfRsq9TNuyPgoXZlPHNlc mUiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703171288; x=1703776088; 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=LzCBxca0nCRHR665JCCwURJqMXPSu7RYmWln7L2TOQo=; b=gUCgLeDCVShWCnMR3v/XN/c5O4buUGQ7tFe1Nz3ecwiPPVaxOhlAU85ks/kC7xCSkM P2g6ouyghD6IMM6taz26Yp38XulX5bWbWcqRyzasH/cbfNWN0xPPAHeQaHrVNTftJnHH 1UOdy4cx9U7DcWRUvEpBGfv3ezEGvsyihyBCcfwytrWX17273b6EF2kXt5PhXoqjYYvc dFz+cdLzmxN/1sjmcZo2BAXBpmlIm/yUy9GeC588oPoFM8UvTJm1Ig3ivYV0MWp3E7OF RefR47cdnuewQdqbf/kZOEN5v6VJpWLoZAfGz11adOQOmSjwAE4XvBIUCxwV8mhcKpIU STNQ== X-Gm-Message-State: AOJu0YwfagY2t7S3eumgOSd3S6hMk6hDYt+8DtV5YnmoqArWFKgLytCo DaJBGXK7TzU/AnVu0TxPf5Vyz+uQAMoO8w== X-Google-Smtp-Source: AGHT+IGogPbot+5m01Kk0sVdVFgQ2NLvxnk+ZqKclIUOMLRrZpPgMazyd3DjXbdpEWzls++vQVJhQQ== X-Received: by 2002:a2e:b60b:0:b0:2cc:6b59:d346 with SMTP id r11-20020a2eb60b000000b002cc6b59d346mr3671549ljn.17.1703171287564; Thu, 21 Dec 2023 07:08:07 -0800 (PST) Received: from archlinux.. (pd95ed842.dip0.t-ipconnect.de. [217.94.216.66]) by smtp.gmail.com with ESMTPSA id t25-20020a056402241900b00553b6b5bb44sm1264264eda.67.2023.12.21.07.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 07:08:07 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Juan Quintela , =?utf-8?q?Herv=C3=A9_Poussineau?= , Hanna Reitz , Fabiano Rosas , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Mark Cave-Ayland , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Eduardo Habkost , Thomas Huth , Peter Xu , Jiaxun Yang , qemu-ppc@nongnu.org, Kevin Wolf , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , Sergio Lopez , John Snow , Artyom Tarasenko , David Hildenbrand , Nicholas Piggin , Marcel Apfelbaum , BALATON Zoltan , qemu-block@nongnu.org, Richard Henderson , Leonardo Bras , "Michael S. Tsirkin" , Bernhard Beschow Subject: [PATCH v3 04/11] exec/ioport: Resolve redundant .base attribute in struct MemoryRegionPortio Date: Thu, 21 Dec 2023 16:07:43 +0100 Message-ID: <20231221150750.5435-5-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221150750.5435-1-shentey@gmail.com> References: <20231221150750.5435-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=shentey@gmail.com; helo=mail-lj1-x233.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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org portio_list_add_1() creates a MemoryRegionPortioList instance which holds a MemoryRegion `mr` and an array of MemoryRegionPortio elements named `ports`. Each element in the array gets assigned the same value for its .base attribute. The same value also ends up as the .addr attribute of `mr` due to the memory_region_add_subregion() call. This means that all .base attributes are the same as `mr.addr`. The only usages of MemoryRegionPortio::base were in portio_read() and portio_write(). Both functions get above MemoryRegionPortioList as their opaque parameter. In both cases find_portio() can only return one of the MemoryRegionPortio elements of the `ports` array. Due to above observation any element will have the same .base value equal to `mr.addr` which is also accessible. Hence, `mrpio->mr.addr` is equivalent to `mrp->base` and MemoryRegionPortio::base is redundant and can be removed. Signed-off-by: Bernhard Beschow --- include/exec/ioport.h | 1 - system/ioport.c | 13 ++++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/exec/ioport.h b/include/exec/ioport.h index e34f668998..95f1dc30d0 100644 --- a/include/exec/ioport.h +++ b/include/exec/ioport.h @@ -35,7 +35,6 @@ typedef struct MemoryRegionPortio { unsigned size; uint32_t (*read)(void *opaque, uint32_t address); void (*write)(void *opaque, uint32_t address, uint32_t data); - uint32_t base; /* private field */ } MemoryRegionPortio; #define PORTIO_END_OF_LIST() { } diff --git a/system/ioport.c b/system/ioport.c index 1824aa808c..a59e58b716 100644 --- a/system/ioport.c +++ b/system/ioport.c @@ -181,13 +181,13 @@ static uint64_t portio_read(void *opaque, hwaddr addr, unsigned size) data = ((uint64_t)1 << (size * 8)) - 1; if (mrp) { - data = mrp->read(mrpio->portio_opaque, mrp->base + addr); + data = mrp->read(mrpio->portio_opaque, mrpio->mr.addr + addr); } else if (size == 2) { mrp = find_portio(mrpio, addr, 1, false); if (mrp) { - data = mrp->read(mrpio->portio_opaque, mrp->base + addr); + data = mrp->read(mrpio->portio_opaque, mrpio->mr.addr + addr); if (addr + 1 < mrp->offset + mrp->len) { - data |= mrp->read(mrpio->portio_opaque, mrp->base + addr + 1) << 8; + data |= mrp->read(mrpio->portio_opaque, mrpio->mr.addr + addr + 1) << 8; } else { data |= 0xff00; } @@ -203,13 +203,13 @@ static void portio_write(void *opaque, hwaddr addr, uint64_t data, const MemoryRegionPortio *mrp = find_portio(mrpio, addr, size, true); if (mrp) { - mrp->write(mrpio->portio_opaque, mrp->base + addr, data); + mrp->write(mrpio->portio_opaque, mrpio->mr.addr + addr, data); } else if (size == 2) { mrp = find_portio(mrpio, addr, 1, true); if (mrp) { - mrp->write(mrpio->portio_opaque, mrp->base + addr, data & 0xff); + mrp->write(mrpio->portio_opaque, mrpio->mr.addr + addr, data & 0xff); if (addr + 1 < mrp->offset + mrp->len) { - mrp->write(mrpio->portio_opaque, mrp->base + addr + 1, data >> 8); + mrp->write(mrpio->portio_opaque, mrpio->mr.addr + addr + 1, data >> 8); } } } @@ -244,7 +244,6 @@ static void portio_list_add_1(PortioList *piolist, /* Adjust the offsets to all be zero-based for the region. */ for (i = 0; i < count; ++i) { mrpio->ports[i].offset -= off_low; - mrpio->ports[i].base = start + off_low; } /* From patchwork Thu Dec 21 15:07:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13502235 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 66A5AC35274 for ; Thu, 21 Dec 2023 15:10:01 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGKeq-0008ED-Et; Thu, 21 Dec 2023 10:08:22 -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 1rGKel-00089U-NX; Thu, 21 Dec 2023 10:08:15 -0500 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGKej-0004Jo-CH; Thu, 21 Dec 2023 10:08:15 -0500 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2cc9fa5e8e1so7889071fa.3; Thu, 21 Dec 2023 07:08:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703171289; x=1703776089; 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=dAVGWN1SPHpUXrz0I2hkwmpe5VJKf6+xuSizlPV5vEs=; b=TeQUi0l6j0JNx+ANpnCGILCWpASNwEfDLvW4hib0BdT6Vm/38pDP3EoXAkWvylhNnz otFHR9br5UBdoO70aUK2BpSAwUytXlLecnUbGbDDYvF0vfoeIsqDMD3mG29Yu04DKFMB J4DHqri3rnUNmQIkIDYCldC4sY5rqTENVqV09JAJwCaZqycGlHWhNqkLz/ZRA5AKD1d8 nqKQhHETOTMJM5ZjN4+A0klIF3TDKM8cCgTM2GK6lD0USxuxy56dLvjefKopQupwJjgW 06bYJ8zMSph9SPOGCHcbXI54OmU7xCm0aOgDqmAEn817xt91mxPgZXIYwmxPfwstU24Z UY7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703171289; x=1703776089; 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=dAVGWN1SPHpUXrz0I2hkwmpe5VJKf6+xuSizlPV5vEs=; b=ac/crxK9DVeJyovnXpuCoPNzJrZ8lXd0loBQg20P4s9BA5XjAIKLKKaYDlcj3cRrMv MGAK/0aVfglCwWMuc39jX8Kexwy6olgJ6xjIJROjYpb/9yVuJqfOY/oOi+Lu8HRxgZW3 8dEYngRDYnZbSt8f9Gvq9ToVkMHojaMYGW5QYafEPWPgzEIxGDrd7rNvr+3XrH3fnn1m CEVblcbT504/+G33/zQBNxB8dVVVLmaPeMd8s/ZjclN2MhLMI2PnFDO2kS2aJLYfKV0W xHMfCgkB2+1pkZw1IBznXmTaWCtav11n2vNLhdpqWull22pvTFMJtcgCx/5jt39PTvN5 IaQA== X-Gm-Message-State: AOJu0YwVu3ohKAmpdgIfl9avZyStMHg9q5fOm+2LFzeZsJ3jpJiRmI6v oG0n8jxXkzN1MqcpS6tBGmq76mptXRTHFQ== X-Google-Smtp-Source: AGHT+IEvcAepzDsO8kCQXktjHwLw4/SeO8b/S8khq2eD+cbrZU3Mab6MkOeCa3RZZFwurjmKLnjh9w== X-Received: by 2002:a2e:9e0f:0:b0:2cc:9506:9bb with SMTP id e15-20020a2e9e0f000000b002cc950609bbmr1324792ljk.97.1703171289237; Thu, 21 Dec 2023 07:08:09 -0800 (PST) Received: from archlinux.. (pd95ed842.dip0.t-ipconnect.de. [217.94.216.66]) by smtp.gmail.com with ESMTPSA id t25-20020a056402241900b00553b6b5bb44sm1264264eda.67.2023.12.21.07.08.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 07:08:08 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Juan Quintela , =?utf-8?q?Herv=C3=A9_Poussineau?= , Hanna Reitz , Fabiano Rosas , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Mark Cave-Ayland , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Eduardo Habkost , Thomas Huth , Peter Xu , Jiaxun Yang , qemu-ppc@nongnu.org, Kevin Wolf , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , Sergio Lopez , John Snow , Artyom Tarasenko , David Hildenbrand , Nicholas Piggin , Marcel Apfelbaum , BALATON Zoltan , qemu-block@nongnu.org, Richard Henderson , Leonardo Bras , "Michael S. Tsirkin" , Bernhard Beschow Subject: [PATCH v3 05/11] exec/ioport: Add portio_list_set_address() Date: Thu, 21 Dec 2023 16:07:44 +0100 Message-ID: <20231221150750.5435-6-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221150750.5435-1-shentey@gmail.com> References: <20231221150750.5435-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22a; envelope-from=shentey@gmail.com; helo=mail-lj1-x22a.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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Some SuperI/O devices such as the VIA south bridges or the PC87312 controller are able to relocate their SuperI/O functions. Add a convenience function for implementing this in the VIA south bridges. This convenience function relies on previous simplifications in exec/ioport which avoids some duplicate synchronization of I/O port base addresses. The naming of the function is inspired by its memory_region_set_address() pendant. Signed-off-by: Bernhard Beschow --- docs/devel/migration.rst | 5 +++-- include/exec/ioport.h | 2 ++ system/ioport.c | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/devel/migration.rst b/docs/devel/migration.rst index ec55089b25..dc35a17461 100644 --- a/docs/devel/migration.rst +++ b/docs/devel/migration.rst @@ -452,10 +452,10 @@ data doesn't match the stored device data well; it allows an intermediate temporary structure to be populated with migration data and then transferred to the main structure. -If you use memory API functions that update memory layout outside +If you use memory or portio_list API functions that update memory layout outside initialization (i.e., in response to a guest action), this is a strong indication that you need to call these functions in a ``post_load`` callback. -Examples of such memory API functions are: +Examples of such API functions are: - memory_region_add_subregion() - memory_region_del_subregion() @@ -464,6 +464,7 @@ Examples of such memory API functions are: - memory_region_set_enabled() - memory_region_set_address() - memory_region_set_alias_offset() + - portio_list_set_address() Iterative device migration -------------------------- diff --git a/include/exec/ioport.h b/include/exec/ioport.h index 95f1dc30d0..96858e5ac3 100644 --- a/include/exec/ioport.h +++ b/include/exec/ioport.h @@ -54,6 +54,7 @@ typedef struct PortioList { const struct MemoryRegionPortio *ports; Object *owner; struct MemoryRegion *address_space; + uint32_t addr; unsigned nr; struct MemoryRegion **regions; void *opaque; @@ -70,5 +71,6 @@ void portio_list_add(PortioList *piolist, struct MemoryRegion *address_space, uint32_t addr); void portio_list_del(PortioList *piolist); +void portio_list_set_address(PortioList *piolist, uint32_t addr); #endif /* IOPORT_H */ diff --git a/system/ioport.c b/system/ioport.c index a59e58b716..000e0ee1af 100644 --- a/system/ioport.c +++ b/system/ioport.c @@ -133,6 +133,7 @@ void portio_list_init(PortioList *piolist, piolist->nr = 0; piolist->regions = g_new0(MemoryRegion *, n); piolist->address_space = NULL; + piolist->addr = 0; piolist->opaque = opaque; piolist->owner = owner; piolist->name = name; @@ -282,6 +283,7 @@ void portio_list_add(PortioList *piolist, unsigned int off_low, off_high, off_last, count; piolist->address_space = address_space; + piolist->addr = start; /* Handle the first entry specially. */ off_last = off_low = pio_start->offset; @@ -322,6 +324,23 @@ void portio_list_del(PortioList *piolist) } } +void portio_list_set_address(PortioList *piolist, uint32_t addr) +{ + MemoryRegionPortioList *mrpio; + unsigned i, j; + + for (i = 0; i < piolist->nr; ++i) { + mrpio = container_of(piolist->regions[i], MemoryRegionPortioList, mr); + memory_region_set_address(&mrpio->mr, + mrpio->mr.addr - piolist->addr + addr); + for (j = 0; mrpio->ports[j].size; ++j) { + mrpio->ports[j].offset += addr - piolist->addr; + } + } + + piolist->addr = addr; +} + static void memory_region_portio_list_finalize(Object *obj) { MemoryRegionPortioList *mrpio = MEMORY_REGION_PORTIO_LIST(obj); From patchwork Thu Dec 21 15:07:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13502231 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 30C69C46CCD for ; Thu, 21 Dec 2023 15:09:28 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGKf5-0008U9-N4; Thu, 21 Dec 2023 10:08:36 -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 1rGKep-0008Cl-Ag; Thu, 21 Dec 2023 10:08:19 -0500 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGKem-0004L1-EI; Thu, 21 Dec 2023 10:08:18 -0500 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5534abbc637so1083878a12.0; Thu, 21 Dec 2023 07:08:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703171291; x=1703776091; 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=jnJPE2oIDz97YP6esr/R8SX7Cf88AF/hpec8jnAAEHQ=; b=eZfM4HqD7L95UKMGOHomaoZ/DuASISzypNAmjzb7PQhcfLO7JygA9ckEOiv1ehaTSb FdAWyohR6Jk+VKd7rv0lury6DBmkeYAYIuROB10RV0a96LqJvpBuuNTjuosdvzSL2yQw MjNNZWSl0jjqhhAfYGIbFpfYt4mb8i5JTZ7gwkap0Un/qb6Y764wxQ6PigX1yv1gMX43 DyAegexAl579IW8oQ7GrUGnIwjKmyN67Id6YNmUe8jiw0Mn1Iktc3PFDc2EDwVKB1VU8 nKuVSRvO4sl+wdJjHrc4mWN7ZJ8POPEYhzbIrsUuNZMPM3PQcrgK/epk8NqcI9C2lIeO cjcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703171291; x=1703776091; 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=jnJPE2oIDz97YP6esr/R8SX7Cf88AF/hpec8jnAAEHQ=; b=RaMREkSIpFpm4JnHXGyYQP3gDCIS4b8dxo402Fr/uHBGIISMyc/0RRGyriYqyiiaiy mFwbI2Zf91ymTldIQ6cGwAjjKe67yeZK6keUEghbw0DnHNvsIn1ZxCPXirTRjKmTnjh0 Wx2KCjEZqcYoAaAuSD5/Mq/Dll8XSxJBN7XVbJX8pOtV6MuE3rTHcHGjeOb1SI3/kqkT 1Fo3MOUWEBLxMApLlYGriPXweM1gWDwpxPFAcNT26RL9x6SRtAUlt5WmAT0yuETwJfkn 2QeT7ujcw/irDyDudsHJT8pFsHeCVaTmXukG0yJNhNZ+g/74BcKn6Tt4fW86K6yLTCYy Rfcg== X-Gm-Message-State: AOJu0YyBc0D+H97Twt/+wLiqyezBkSFqK9WM5hyS4nKCOhSQ1QnIXN0y cNRUUHxf4rOHPNcDUlnTDHDS1b3FroK5cg== X-Google-Smtp-Source: AGHT+IEmIIJhrkZ2CesxRAAKb6pW/IuBPs2Oj/qoz1th0BOzqmdaMMnZS6KPvGvI1ef3wKjIrD/hyA== X-Received: by 2002:a50:bb41:0:b0:552:f56d:eb81 with SMTP id y59-20020a50bb41000000b00552f56deb81mr5488736ede.66.1703171291036; Thu, 21 Dec 2023 07:08:11 -0800 (PST) Received: from archlinux.. (pd95ed842.dip0.t-ipconnect.de. [217.94.216.66]) by smtp.gmail.com with ESMTPSA id t25-20020a056402241900b00553b6b5bb44sm1264264eda.67.2023.12.21.07.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 07:08:10 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Juan Quintela , =?utf-8?q?Herv=C3=A9_Poussineau?= , Hanna Reitz , Fabiano Rosas , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Mark Cave-Ayland , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Eduardo Habkost , Thomas Huth , Peter Xu , Jiaxun Yang , qemu-ppc@nongnu.org, Kevin Wolf , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , Sergio Lopez , John Snow , Artyom Tarasenko , David Hildenbrand , Nicholas Piggin , Marcel Apfelbaum , BALATON Zoltan , qemu-block@nongnu.org, Richard Henderson , Leonardo Bras , "Michael S. Tsirkin" , Bernhard Beschow Subject: [PATCH v3 06/11] exec/ioport: Add portio_list_set_enabled() Date: Thu, 21 Dec 2023 16:07:45 +0100 Message-ID: <20231221150750.5435-7-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221150750.5435-1-shentey@gmail.com> References: <20231221150750.5435-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=shentey@gmail.com; helo=mail-ed1-x52e.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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Some SuperI/O devices such as the VIA south bridges or the PC87312 controller allow to enable or disable their SuperI/O functions. Add a convenience function for implementing this in the VIA south bridges. The naming of the functions is inspired by its memory_region_set_enabled() pendant. Signed-off-by: Bernhard Beschow --- docs/devel/migration.rst | 1 + include/exec/ioport.h | 1 + system/ioport.c | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/docs/devel/migration.rst b/docs/devel/migration.rst index dc35a17461..9317091d1a 100644 --- a/docs/devel/migration.rst +++ b/docs/devel/migration.rst @@ -465,6 +465,7 @@ Examples of such API functions are: - memory_region_set_address() - memory_region_set_alias_offset() - portio_list_set_address() + - portio_list_set_enabled() Iterative device migration -------------------------- diff --git a/include/exec/ioport.h b/include/exec/ioport.h index 96858e5ac3..4397f12f93 100644 --- a/include/exec/ioport.h +++ b/include/exec/ioport.h @@ -71,6 +71,7 @@ void portio_list_add(PortioList *piolist, struct MemoryRegion *address_space, uint32_t addr); void portio_list_del(PortioList *piolist); +void portio_list_set_enabled(PortioList *piolist, bool enabled); void portio_list_set_address(PortioList *piolist, uint32_t addr); #endif /* IOPORT_H */ diff --git a/system/ioport.c b/system/ioport.c index 000e0ee1af..fd551d0375 100644 --- a/system/ioport.c +++ b/system/ioport.c @@ -324,6 +324,15 @@ void portio_list_del(PortioList *piolist) } } +void portio_list_set_enabled(PortioList *piolist, bool enabled) +{ + unsigned i; + + for (i = 0; i < piolist->nr; ++i) { + memory_region_set_enabled(piolist->regions[i], enabled); + } +} + void portio_list_set_address(PortioList *piolist, uint32_t addr) { MemoryRegionPortioList *mrpio; From patchwork Thu Dec 21 15:07:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13502230 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 4E208C35274 for ; Thu, 21 Dec 2023 15:09:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGKf9-00005J-OZ; Thu, 21 Dec 2023 10:08:39 -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 1rGKex-0008KC-Oe; Thu, 21 Dec 2023 10:08:28 -0500 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGKen-0004M3-8L; Thu, 21 Dec 2023 10:08:27 -0500 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2cc6863d43aso8862441fa.1; Thu, 21 Dec 2023 07:08:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703171293; x=1703776093; 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=+iquediHwxiTNDcXJ44lhoBWeyM5ESXdCgXvXlhjLxU=; b=mmTs/f8r2VZoGqWVOD2cr1M8Ttu3sLpn0yFOE4to34ep9gtxvtKddStIemB0ZsC4SR aM9cePzAknbOnnknAWt9CbG6QISs/ZAvy1g4dJE696gpsJQL/DuvdWXXpXZQ8AJDgzWW fh8fNKw+70IQT4B7aML+JtEF4FkpyWXqtYlKGC19DsY2i9LEpcdwUdi1IAi0jhTluAcS 7y6GFADsI4EZ7UsY1jkTy6yTi8pKnjnty1hT8vEqyGKrXaP1ZDHNfFbYIzWD+ZOXXFpf gBYWB55Qip5OEJqY+Oix0eI+9uitxoowcf4Nxqb6pNVwqRVSlvCTgwVtb4jWh0jG3tr4 6x+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703171293; x=1703776093; 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=+iquediHwxiTNDcXJ44lhoBWeyM5ESXdCgXvXlhjLxU=; b=FL5XK2lE7tPT/nFP6yp+qfJsQ1sYevXddG/qYhARWbcoMk2pTDXtmOEGiLGu/L7l16 83zyL7FhdH+UQpygLo26/NRymnmZReZRQWDSRgy4qmQBsHbgp9wDbQXwyCMluawPvdNz ZuLtrqx3/tFnWPfsmEFK3IZHeOcFy9P6A27Np7fInmHjmQHP67jZUaLZqqXpXsC7/QCe g/cQSakFnnVFIGxGnpuq15GrYgMgWX+vq9DF/rijedzYf7oh/NS6W9vsuyBE5ufVHZEg Adty2mOvneCCjVpRaoz+25pgNhizLd3rjCJKH698QQYA73mwDSyXlByVQgpa2Olkqc2E kgpw== X-Gm-Message-State: AOJu0Yzte2Nfy+qKss6j6Zjz2gJqTiBtrSfP9BLwj3V+b2VSQ6MLY2ik BzAkTuqBRKLS0T4XD0QrKwxQaUhd9OHb2w== X-Google-Smtp-Source: AGHT+IH1ExdNDRtE+22ptgOee0aQrp0ByMejiBOxpId0oKXMxgEgYaoAkqHTUfI/FOd2cziNwf3Wxw== X-Received: by 2002:a2e:b172:0:b0:2cc:7c8e:2f79 with SMTP id a18-20020a2eb172000000b002cc7c8e2f79mr2317583ljm.107.1703171292664; Thu, 21 Dec 2023 07:08:12 -0800 (PST) Received: from archlinux.. (pd95ed842.dip0.t-ipconnect.de. [217.94.216.66]) by smtp.gmail.com with ESMTPSA id t25-20020a056402241900b00553b6b5bb44sm1264264eda.67.2023.12.21.07.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 07:08:12 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Juan Quintela , =?utf-8?q?Herv=C3=A9_Poussineau?= , Hanna Reitz , Fabiano Rosas , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Mark Cave-Ayland , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Eduardo Habkost , Thomas Huth , Peter Xu , Jiaxun Yang , qemu-ppc@nongnu.org, Kevin Wolf , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , Sergio Lopez , John Snow , Artyom Tarasenko , David Hildenbrand , Nicholas Piggin , Marcel Apfelbaum , BALATON Zoltan , qemu-block@nongnu.org, Richard Henderson , Leonardo Bras , "Michael S. Tsirkin" , Bernhard Beschow Subject: [PATCH v3 07/11] hw/block/fdc-isa: Implement relocation and enabling/disabling for TYPE_ISA_FDC Date: Thu, 21 Dec 2023 16:07:46 +0100 Message-ID: <20231221150750.5435-8-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221150750.5435-1-shentey@gmail.com> References: <20231221150750.5435-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22a; envelope-from=shentey@gmail.com; helo=mail-lj1-x22a.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, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The real SuperI/O chips emulated by QEMU allow for relocating and enabling or disabling their SuperI/O functions via software. So far this is not implemented. Prepare for that by adding isa_fdc_set_{enabled,iobase}. Signed-off-by: Bernhard Beschow --- include/hw/block/fdc.h | 3 +++ hw/block/fdc-isa.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/hw/block/fdc.h b/include/hw/block/fdc.h index 35248c0837..c367c5efea 100644 --- a/include/hw/block/fdc.h +++ b/include/hw/block/fdc.h @@ -14,6 +14,9 @@ void fdctrl_init_sysbus(qemu_irq irq, hwaddr mmio_base, DriveInfo **fds); void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base, DriveInfo **fds, qemu_irq *fdc_tc); +void isa_fdc_set_iobase(ISADevice *fdc, hwaddr iobase); +void isa_fdc_set_enabled(ISADevice *fdc, bool enabled); + FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i); int cmos_get_fd_drive_type(FloppyDriveType fd0); diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c index b4c92b40b3..c989325de3 100644 --- a/hw/block/fdc-isa.c +++ b/hw/block/fdc-isa.c @@ -192,6 +192,20 @@ static Aml *build_fdinfo_aml(int idx, FloppyDriveType type) return dev; } +void isa_fdc_set_iobase(ISADevice *fdc, hwaddr iobase) +{ + FDCtrlISABus *isa = ISA_FDC(fdc); + + fdc->ioport_id = iobase; + isa->iobase = iobase; + portio_list_set_address(&isa->portio_list, isa->iobase); +} + +void isa_fdc_set_enabled(ISADevice *fdc, bool enabled) +{ + portio_list_set_enabled(&ISA_FDC(fdc)->portio_list, enabled); +} + int cmos_get_fd_drive_type(FloppyDriveType fd0) { int val; From patchwork Thu Dec 21 15:07:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13502233 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 1F001C46CCD for ; Thu, 21 Dec 2023 15:09:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGKf8-0008Vm-6v; Thu, 21 Dec 2023 10:08:38 -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 1rGKes-0008Gd-9I; Thu, 21 Dec 2023 10:08:22 -0500 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGKep-0004NL-IR; Thu, 21 Dec 2023 10:08:22 -0500 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5534dcfdd61so1638340a12.0; Thu, 21 Dec 2023 07:08:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703171294; x=1703776094; 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=Jf2Frpf/cWzzHNSpTj0JllWtoYDJKF8fvZF01FoVocs=; b=YBs84vSwznnJHz5GDTdS7jjiEJ+WzZ/oqXVYEnoOeAQheCECNKtHwoMZsN2q9YSuh/ cfO9SAqTj1/hWVYVd3Zo/aKyhtDcGXk9PKAv6nsTrT4oaClSCTB8b6IsxbGo8Bu0qf1D bf2xkVmhfx7EX/Y/gvpiFux5pR3Z4dQKVKa/UcULSBIoMJIT9W3MUHaWSG9rh5d6ahjl rv+XawCDkqxs04MtRAmzHUzDb9+EKFntkekWUMdl7NYWX52yHNJa2im8A9TtvjhTkwyN LQbcfOS+GlZFDgCaeev7+oi+M7DVeGYIwY1j0kMCAABoZ0D6iAiQWePWkYtNrv0NPJmF dRiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703171294; x=1703776094; 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=Jf2Frpf/cWzzHNSpTj0JllWtoYDJKF8fvZF01FoVocs=; b=ZXtcU03M9MfuYwXGvw+pqQRTlfzr+4RWvk2aKWa0hrpQCI7m/7bmiI+TMv5mYiuiRR x8EKqbtHRo9pSAEXR08C8dKlB3ZI1wsMvWrpEi6Q3oCIphDOhgzmGC3/EGVZzqh6zZ1p RCZigvM9wWbn2KaCAmrYPi0x7zEBLF3TQGoYe35SRogvTnnz/XVYx1GYCneqGdnKTx3G Rw7XM4GYyu97hng+byfvxAoKRcZgmBtuzmTZs1ofyAt9Q3YltP6MP0jfU6HN1Ogrwooe HR0GhvDpPdqLv+vWYGHGfeRiKNdqHl3xbAtotG4sFsT0Qm5KY3Pb28fhSj6Ee4bBK+sf K7+g== X-Gm-Message-State: AOJu0YzQ3HvvC9i7xcZgR8yotsNgcwmyiXB00IPrgKGd8uUgNuqXVyba viMJVpo6mBz7rXTBScW/ubqR+5qc8oaB5A== X-Google-Smtp-Source: AGHT+IHfGDcR3gelstRDI3O3+ocZ3/ETvaa7z7pjrSqQQPVpMtsrv58PkOR+Zhoe8SnSRjb6IPZxbA== X-Received: by 2002:a50:baec:0:b0:552:d75b:c6d9 with SMTP id x99-20020a50baec000000b00552d75bc6d9mr857577ede.7.1703171294333; Thu, 21 Dec 2023 07:08:14 -0800 (PST) Received: from archlinux.. (pd95ed842.dip0.t-ipconnect.de. [217.94.216.66]) by smtp.gmail.com with ESMTPSA id t25-20020a056402241900b00553b6b5bb44sm1264264eda.67.2023.12.21.07.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 07:08:13 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Juan Quintela , =?utf-8?q?Herv=C3=A9_Poussineau?= , Hanna Reitz , Fabiano Rosas , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Mark Cave-Ayland , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Eduardo Habkost , Thomas Huth , Peter Xu , Jiaxun Yang , qemu-ppc@nongnu.org, Kevin Wolf , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , Sergio Lopez , John Snow , Artyom Tarasenko , David Hildenbrand , Nicholas Piggin , Marcel Apfelbaum , BALATON Zoltan , qemu-block@nongnu.org, Richard Henderson , Leonardo Bras , "Michael S. Tsirkin" , Bernhard Beschow Subject: [PATCH v3 08/11] hw/char/serial-isa: Implement relocation and enabling/disabling for TYPE_ISA_SERIAL Date: Thu, 21 Dec 2023 16:07:47 +0100 Message-ID: <20231221150750.5435-9-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221150750.5435-1-shentey@gmail.com> References: <20231221150750.5435-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=shentey@gmail.com; helo=mail-ed1-x530.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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The real SuperI/O chips emulated by QEMU allow for relocating and enabling or disabling their SuperI/O functions via software. So far this is not implemented. Prepare for that by adding isa_serial_set_{enabled,iobase}. Signed-off-by: Bernhard Beschow --- include/hw/char/serial.h | 2 ++ hw/char/serial-isa.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 8ba7eca3d6..6e14099ee7 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -112,5 +112,7 @@ SerialMM *serial_mm_init(MemoryRegion *address_space, #define TYPE_ISA_SERIAL "isa-serial" void serial_hds_isa_init(ISABus *bus, int from, int to); +void isa_serial_set_iobase(ISADevice *serial, hwaddr iobase); +void isa_serial_set_enabled(ISADevice *serial, bool enabled); #endif diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index 141a6cb168..62fb529e39 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -184,3 +184,17 @@ void serial_hds_isa_init(ISABus *bus, int from, int to) } } } + +void isa_serial_set_iobase(ISADevice *serial, hwaddr iobase) +{ + ISASerialState *s = ISA_SERIAL(serial); + + serial->ioport_id = iobase; + s->iobase = iobase; + memory_region_set_address(&s->state.io, s->iobase); +} + +void isa_serial_set_enabled(ISADevice *serial, bool enabled) +{ + memory_region_set_enabled(&ISA_SERIAL(serial)->state.io, enabled); +} From patchwork Thu Dec 21 15:07:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13502241 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 BA401C35274 for ; Thu, 21 Dec 2023 15:11:20 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGKf8-0008WQ-If; Thu, 21 Dec 2023 10:08:38 -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 1rGKet-0008Hr-Im; Thu, 21 Dec 2023 10:08:24 -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 1rGKeq-0004OV-EA; Thu, 21 Dec 2023 10:08:23 -0500 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5534abbc637so1083996a12.0; Thu, 21 Dec 2023 07:08:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703171296; x=1703776096; 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=BO3joJYDTtGUerfBs3WaLe5gIZcBp9HzTmPOq+TE/bA=; b=G1ocIemBrYqYRIWuhSebdpusH+cbQw7h+1bdj+rzaLMdV/NpKv+KVZ8xIRtrPS3wSk oC9GqkNcuhH960eo7O2raNAyP8rXvOuh7kXxTTyI791kx2pjuqnDOAx6fiUHPgmjepr1 FyvbwNFDHouy8hRshuG06Lt623TujYUdYEmOvCotMvkXpPi7IS7u/+sacoIuvRoxOMiO NyEpVG04lCY5I22Upb+XhyuHJ8Yp731RX2PtFxRfYtLnRO3lf23P0nCRGLY6I+Cnd6kq 1HeCL5kJ4VSdNp/jvcJAshCB0ZrfrEUmFsc78P4H/weONGrNcdxu6nwPVp0WLj+ChspI 2Iuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703171296; x=1703776096; 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=BO3joJYDTtGUerfBs3WaLe5gIZcBp9HzTmPOq+TE/bA=; b=dHj2k5gYnC0Hd+oSuxhR73pNPzfYyVlTCLMzf1c6BCOblgnJm3IKPeYC4iRDV7/VxY WbtsCY7+VxY2/TNGxunkBlN95NU/trA+mZ2rA93yYkkhis2qaoxI1GIAITtOmzWSckw5 NSVJ/HP0RaGCr7rrpGuJlXFgWQneZ2qUzvBTRPZGInVukd6PzoBdLCH0xWnRSuLEQAEU duP7qfwF/lAO9+tPSwx1gOJLixlHNFavMX+Sa6+bbv9jSITTCFVsj1YtHbcqn/YMI6Fh 8DDUXJtdnHLUhEN+WhBCWedyYqJn5pB1mmuI7LBVcd8IZTLeZbgLT8a+aZEa6OSy2PKv 5dVA== X-Gm-Message-State: AOJu0Yyug/iPYd4gsIYz5B6zCAOGPuIYfKXwYAL8WchbTUcrWIia+p6D 4+j/oTyJWdsZmpNKlsXIGmu2Y8BFptzlng== X-Google-Smtp-Source: AGHT+IEBB87s9FCGSUtqFl4nYjhemJodzncrkMjNs40N8le6X5tLHi5sDdECFZ/KT72OO+I19DHysg== X-Received: by 2002:a50:c908:0:b0:551:12f7:84e with SMTP id o8-20020a50c908000000b0055112f7084emr9254468edh.28.1703171295970; Thu, 21 Dec 2023 07:08:15 -0800 (PST) Received: from archlinux.. (pd95ed842.dip0.t-ipconnect.de. [217.94.216.66]) by smtp.gmail.com with ESMTPSA id t25-20020a056402241900b00553b6b5bb44sm1264264eda.67.2023.12.21.07.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 07:08:15 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Juan Quintela , =?utf-8?q?Herv=C3=A9_Poussineau?= , Hanna Reitz , Fabiano Rosas , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Mark Cave-Ayland , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Eduardo Habkost , Thomas Huth , Peter Xu , Jiaxun Yang , qemu-ppc@nongnu.org, Kevin Wolf , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , Sergio Lopez , John Snow , Artyom Tarasenko , David Hildenbrand , Nicholas Piggin , Marcel Apfelbaum , BALATON Zoltan , qemu-block@nongnu.org, Richard Henderson , Leonardo Bras , "Michael S. Tsirkin" , Bernhard Beschow Subject: [PATCH v3 09/11] hw/char/parallel-isa: Implement relocation and enabling/disabling for TYPE_ISA_PARALLEL Date: Thu, 21 Dec 2023 16:07:48 +0100 Message-ID: <20231221150750.5435-10-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221150750.5435-1-shentey@gmail.com> References: <20231221150750.5435-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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The real SuperI/O chips emulated by QEMU allow for relocating and enabling or disabling their SuperI/O functions via software. So far this is not implemented. Prepare for that by adding isa_parallel_set_{enabled,iobase}. Signed-off-by: Bernhard Beschow --- include/hw/char/parallel-isa.h | 3 +++ hw/char/parallel-isa.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/hw/char/parallel-isa.h b/include/hw/char/parallel-isa.h index 3b783bd08d..5284b2ffec 100644 --- a/include/hw/char/parallel-isa.h +++ b/include/hw/char/parallel-isa.h @@ -29,4 +29,7 @@ struct ISAParallelState { PortioList portio_list; }; +void isa_parallel_set_iobase(ISADevice *parallel, hwaddr iobase); +void isa_parallel_set_enabled(ISADevice *parallel, bool enabled); + #endif /* HW_PARALLEL_ISA_H */ diff --git a/hw/char/parallel-isa.c b/hw/char/parallel-isa.c index ab0f879998..a5ce6ee13a 100644 --- a/hw/char/parallel-isa.c +++ b/hw/char/parallel-isa.c @@ -41,3 +41,17 @@ void parallel_hds_isa_init(ISABus *bus, int n) } } } + +void isa_parallel_set_iobase(ISADevice *parallel, hwaddr iobase) +{ + ISAParallelState *s = ISA_PARALLEL(parallel); + + parallel->ioport_id = iobase; + s->iobase = iobase; + portio_list_set_address(&s->portio_list, s->iobase); +} + +void isa_parallel_set_enabled(ISADevice *parallel, bool enabled) +{ + portio_list_set_enabled(&ISA_PARALLEL(parallel)->portio_list, enabled); +} From patchwork Thu Dec 21 15:07:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13502236 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 D4694C35274 for ; Thu, 21 Dec 2023 15:10:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGKf9-00004r-76; Thu, 21 Dec 2023 10:08:39 -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 1rGKet-0008IS-V2; Thu, 21 Dec 2023 10:08:25 -0500 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGKes-0004Qg-79; Thu, 21 Dec 2023 10:08:23 -0500 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2cc7087c6c4so10395641fa.2; Thu, 21 Dec 2023 07:08:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703171297; x=1703776097; 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=beCClsHMmqcMkMYgwQdfXIKn37AYMjOXEPxAk81UJRk=; b=RP1dVioZXE92LFektlr828zirS1A6m7nko5AxvynabhnhDpGdBRWhZZvvMrzeB0rbu vviSNX1MsYBxbkbAOYtOvnyUCIRyFdfdOq14EvnwWCuihbRQByNRods68bUBv0IptLJr BTz+Xg/HmR3jazxvAKVZJpAYfigYeUKtNJSlcMXwoQ/3oiJXr3VtyC0udUhrNe8gJpBu TiwwVe+Ml3vVDbdq0PeRnAIIj2fwleke5pxcch63i0XuDw2Pw/GeTS7bJufQy+KL1FL0 AMf552bnv+g9aYoDcg+DsAl3X6Ib069uImVSVG1t7qTTijdJCLSRpwDMI+Tv+TevGpTd xyqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703171297; x=1703776097; 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=beCClsHMmqcMkMYgwQdfXIKn37AYMjOXEPxAk81UJRk=; b=PyiKZn+hAy7JqarD3/qyisRrillM9xkliY4a6r46QZI3dxCUu7Ifvc7xBd1Sgp0/0F xWBPBM1hqw6X1jVQfR6O2eGgEPxFlPrkBolo5BcoGccSZG2SVw7SIkklcXrvFVa81Vf+ BJj/ReV1Rrn74BaXJSzOK51WlDcKXzzRkHr9CMKkEeIX/ON7R8Chvl82Mu8C/QtHixhs 60fytxozUsGDAxdFVNSaEEGmJg3TqC4wTHeIN9ekDX6UhkkaxYARlp1S5k+i94hstpj3 XE/502QfjW+ATyd8sOZaVMR3NWuCVk7WnHJG4vTqeyUgCEz1ub2JhT2raAs33yvfy6x8 +S0g== X-Gm-Message-State: AOJu0YzJU1okunGNACuMZuGUYMbbbQyj+BdHlGBcH1YRgUabG2yPdWV0 ND7QsjtAyF40czqggKjrEG/ECXW22FFi8A== X-Google-Smtp-Source: AGHT+IEMmv25K9ZUsLFy1NWNv43RU+9liAW5zTzuXLR+LqkRFnsebJUbupQwa0hlZmO9NQ5Egzkxfw== X-Received: by 2002:a2e:beac:0:b0:2cc:9985:462 with SMTP id a44-20020a2ebeac000000b002cc99850462mr890619ljr.24.1703171297629; Thu, 21 Dec 2023 07:08:17 -0800 (PST) Received: from archlinux.. (pd95ed842.dip0.t-ipconnect.de. [217.94.216.66]) by smtp.gmail.com with ESMTPSA id t25-20020a056402241900b00553b6b5bb44sm1264264eda.67.2023.12.21.07.08.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 07:08:17 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Juan Quintela , =?utf-8?q?Herv=C3=A9_Poussineau?= , Hanna Reitz , Fabiano Rosas , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Mark Cave-Ayland , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Eduardo Habkost , Thomas Huth , Peter Xu , Jiaxun Yang , qemu-ppc@nongnu.org, Kevin Wolf , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , Sergio Lopez , John Snow , Artyom Tarasenko , David Hildenbrand , Nicholas Piggin , Marcel Apfelbaum , BALATON Zoltan , qemu-block@nongnu.org, Richard Henderson , Leonardo Bras , "Michael S. Tsirkin" , Bernhard Beschow Subject: [PATCH v3 10/11] hw/ppc/pegasos2: Let pegasos2 machine configure SuperI/O functions Date: Thu, 21 Dec 2023 16:07:49 +0100 Message-ID: <20231221150750.5435-11-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221150750.5435-1-shentey@gmail.com> References: <20231221150750.5435-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=shentey@gmail.com; helo=mail-lj1-x22b.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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This is a preparation for implementing relocation and toggling of SuperI/O functions in the VT8231 device model. Upon reset, all SuperI/O functions will be deactivated, so in case if no -bios is given, let the machine configure those functions the same way Pegasos II firmware would do. Signed-off-by: Bernhard Beschow --- hw/ppc/pegasos2.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 3203a4a728..0a40ebd542 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -285,6 +285,15 @@ static void pegasos2_pci_config_write(Pegasos2MachineState *pm, int bus, pegasos2_mv_reg_write(pm, pcicfg + 4, len, val); } +static void pegasos2_superio_write(Pegasos2MachineState *pm, uint32_t addr, + uint32_t val) +{ + AddressSpace *as = CPU(pm->cpu)->as; + + stb_phys(as, PCI1_IO_BASE + 0x3f0, addr); + stb_phys(as, PCI1_IO_BASE + 0x3f1, val); +} + static void pegasos2_machine_reset(MachineState *machine, ShutdownCause reason) { Pegasos2MachineState *pm = PEGASOS2_MACHINE(machine); @@ -310,6 +319,12 @@ static void pegasos2_machine_reset(MachineState *machine, ShutdownCause reason) pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) | PCI_INTERRUPT_LINE, 2, 0x9); + pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) | + 0x50, 1, 0x6); + pegasos2_superio_write(pm, 0xf4, 0xbe); + pegasos2_superio_write(pm, 0xf6, 0xef); + pegasos2_superio_write(pm, 0xf7, 0xfc); + pegasos2_superio_write(pm, 0xf2, 0x14); pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) | 0x50, 1, 0x2); pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) | From patchwork Thu Dec 21 15:07:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13502240 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 99E93C35274 for ; Thu, 21 Dec 2023 15:11:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGKf8-0008WV-Oy; Thu, 21 Dec 2023 10:08:38 -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 1rGKeu-0008IY-MC; Thu, 21 Dec 2023 10:08:26 -0500 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGKes-0004Qv-Lz; Thu, 21 Dec 2023 10:08:24 -0500 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5532b45c286so1020320a12.0; Thu, 21 Dec 2023 07:08:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703171299; x=1703776099; 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=cc21D1GGvynIIeBFBQCCZYU8WGyS+4JieBQBphT8ERs=; b=bXpbKr6fXQBNIpHhMvxk/zCPZTM4e2tMm3TKGnwG6HuECKkAqBVnVrCmuQ07EykKL0 cb7IIBLGWK4TC48jafHFxRT87H3UDZvAq7ZlSU6spIKIaJqpdYdxJMWWjEm79v2p9/Ur 9R/y1IBQE7cE60OZzHl/AlRfrYWev8THrtDqiVzuqHa48LCOL0d8eUjG+A0PD2+3byLR /wZ7auUggGd2PqIcl1qzvbj2H+e3zpP54wYHVZPEq+0X8lOgf+4Tj/gc1nTfiFbglHLy Nxr1qIIhg70z0XiqDQU28xiZcxHmDi8wUuuv4N+2h6HyKvaAlgxWC4JVNo9ZeVPdmVZQ 9urw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703171299; x=1703776099; 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=cc21D1GGvynIIeBFBQCCZYU8WGyS+4JieBQBphT8ERs=; b=VA0yqJLar0uruy61yM10qfeH8mYnYCo9qslL8Yb93c9hPlWfk3Qysz0xcQssgvAWqr PJGe/6hHOQ7TJvu8x0o+Ephw1rCpH0XV/IeXgbuB0fQS8PjNJ0rNlIyOSI4JKRnqEuMz WNBieb0ZHnlNBnv9bryoEy5xt9zMryJrwftq2xqkpcND1KqmltsIJTvR86fNbQNCq2ja C75ojzW6aq9Q8yy05Uzuc8KrjD+Gk4bjasKZgJjCs0gvMiDl1fZ/IHaulr6UU7H6ptp1 rNWRLAVINF8XChhD82t2IBfLFlYJkp3vxWmBN0kgvj3U37NMaCe3YLG5VJ8fgBLCmnVN ZFWQ== X-Gm-Message-State: AOJu0YzBf+3rvsJ9oROJDBrljMjpSqodHPJ5Y/IipOO7oLcpuq5CN5rm zgUsFQwWWtOcrI/S2win9KXg3pMQvKy2Mw== X-Google-Smtp-Source: AGHT+IGwn2DltZlhBGwngmAj0rGqWWT/qPbvmce/2Pkk1i9yes56Wg8yvZhUJfKhCXOwrHXr4RiGzg== X-Received: by 2002:a50:c014:0:b0:554:1b95:2634 with SMTP id r20-20020a50c014000000b005541b952634mr403969edb.20.1703171299360; Thu, 21 Dec 2023 07:08:19 -0800 (PST) Received: from archlinux.. (pd95ed842.dip0.t-ipconnect.de. [217.94.216.66]) by smtp.gmail.com with ESMTPSA id t25-20020a056402241900b00553b6b5bb44sm1264264eda.67.2023.12.21.07.08.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 07:08:18 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Juan Quintela , =?utf-8?q?Herv=C3=A9_Poussineau?= , Hanna Reitz , Fabiano Rosas , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Mark Cave-Ayland , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Eduardo Habkost , Thomas Huth , Peter Xu , Jiaxun Yang , qemu-ppc@nongnu.org, Kevin Wolf , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , Sergio Lopez , John Snow , Artyom Tarasenko , David Hildenbrand , Nicholas Piggin , Marcel Apfelbaum , BALATON Zoltan , qemu-block@nongnu.org, Richard Henderson , Leonardo Bras , "Michael S. Tsirkin" , Bernhard Beschow Subject: [PATCH v3 11/11] hw/isa/vt82c686: Implement relocation and toggling of SuperI/O functions Date: Thu, 21 Dec 2023 16:07:50 +0100 Message-ID: <20231221150750.5435-12-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221150750.5435-1-shentey@gmail.com> References: <20231221150750.5435-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=shentey@gmail.com; helo=mail-ed1-x536.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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The VIA south bridges are able to relocate and toggle (enable or disable) their SuperI/O functions. So far this is hardcoded such that all functions are always enabled and are located at fixed addresses. Some PC BIOSes seem to probe for I/O occupancy before activating such a function and issue an error in case of a conflict. Since the functions are currently enabled on reset, conflicts are always detected. Prevent that by implementing relocation and toggling of the SuperI/O functions. Note that all SuperI/O functions are now deactivated upon reset (except for VT82C686B's serial ports where Fuloong 2e's rescue-yl seems to expect them to be enabled by default). Rely on firmware to configure the functions accordingly. Signed-off-by: Bernhard Beschow --- hw/isa/vt82c686.c | 115 +++++++++++++++++++++++++++++++++------------- 1 file changed, 84 insertions(+), 31 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 9c2333a277..983cb321b9 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -15,6 +15,9 @@ #include "qemu/osdep.h" #include "hw/isa/vt82c686.h" +#include "hw/block/fdc.h" +#include "hw/char/parallel-isa.h" +#include "hw/char/serial.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" #include "hw/ide/pci.h" @@ -343,6 +346,32 @@ static const TypeInfo via_superio_info = { #define TYPE_VT82C686B_SUPERIO "vt82c686b-superio" +static void vt82c686b_superio_update(ViaSuperIOState *s) +{ + isa_parallel_set_enabled(s->superio.parallel[0], + (s->regs[0xe2] & 0x3) != 3); + isa_serial_set_enabled(s->superio.serial[0], s->regs[0xe2] & BIT(2)); + isa_serial_set_enabled(s->superio.serial[1], s->regs[0xe2] & BIT(3)); + isa_fdc_set_enabled(s->superio.floppy, s->regs[0xe2] & BIT(4)); + + isa_fdc_set_iobase(s->superio.floppy, (s->regs[0xe3] & 0xfc) << 2); + isa_parallel_set_iobase(s->superio.parallel[0], s->regs[0xe6] << 2); + isa_serial_set_iobase(s->superio.serial[0], (s->regs[0xe7] & 0xfe) << 2); + isa_serial_set_iobase(s->superio.serial[1], (s->regs[0xe8] & 0xfe) << 2); +} + +static int vmstate_vt82c686b_superio_post_load(void *opaque, int version_id) +{ + vt82c686b_superio_update(opaque); + return 0; +} + +static const VMStateDescription vmstate_vt82c686b_superio = { + .name = "vt82c686b_superio", + .version_id = 1, + .post_load = vmstate_vt82c686b_superio_post_load, +}; + static void vt82c686b_superio_cfg_write(void *opaque, hwaddr addr, uint64_t data, unsigned size) { @@ -368,7 +397,11 @@ static void vt82c686b_superio_cfg_write(void *opaque, hwaddr addr, case 0xfd ... 0xff: /* ignore write to read only registers */ return; - /* case 0xe6 ... 0xe8: Should set base port of parallel and serial */ + case 0xe2 ... 0xe3: + case 0xe6 ... 0xe8: + sc->regs[idx] = data; + vt82c686b_superio_update(sc); + return; default: qemu_log_mask(LOG_UNIMP, "via_superio_cfg: unimplemented register 0x%x\n", idx); @@ -393,25 +426,24 @@ static void vt82c686b_superio_reset(DeviceState *dev) memset(s->regs, 0, sizeof(s->regs)); /* Device ID */ - vt82c686b_superio_cfg_write(s, 0, 0xe0, 1); - vt82c686b_superio_cfg_write(s, 1, 0x3c, 1); - /* Function select - all disabled */ - vt82c686b_superio_cfg_write(s, 0, 0xe2, 1); - vt82c686b_superio_cfg_write(s, 1, 0x03, 1); + s->regs[0xe0] = 0x3c; + /* + * Function select - only serial enabled + * Fuloong 2e's rescue-yl prints to the serial console w/o enabling it. This + * suggests that the serial ports are enabled by default, so override the + * datasheet. + */ + s->regs[0xe2] = 0x0f; /* Floppy ctrl base addr 0x3f0-7 */ - vt82c686b_superio_cfg_write(s, 0, 0xe3, 1); - vt82c686b_superio_cfg_write(s, 1, 0xfc, 1); + s->regs[0xe3] = 0xfc; /* Parallel port base addr 0x378-f */ - vt82c686b_superio_cfg_write(s, 0, 0xe6, 1); - vt82c686b_superio_cfg_write(s, 1, 0xde, 1); + s->regs[0xe6] = 0xde; /* Serial port 1 base addr 0x3f8-f */ - vt82c686b_superio_cfg_write(s, 0, 0xe7, 1); - vt82c686b_superio_cfg_write(s, 1, 0xfe, 1); + s->regs[0xe7] = 0xfe; /* Serial port 2 base addr 0x2f8-f */ - vt82c686b_superio_cfg_write(s, 0, 0xe8, 1); - vt82c686b_superio_cfg_write(s, 1, 0xbe, 1); + s->regs[0xe8] = 0xbe; - vt82c686b_superio_cfg_write(s, 0, 0, 1); + vt82c686b_superio_update(s); } static void vt82c686b_superio_init(Object *obj) @@ -429,6 +461,7 @@ static void vt82c686b_superio_class_init(ObjectClass *klass, void *data) sc->parallel.count = 1; sc->ide.count = 0; /* emulated by via-ide */ sc->floppy.count = 1; + dc->vmsd = &vmstate_vt82c686b_superio; } static const TypeInfo vt82c686b_superio_info = { @@ -443,6 +476,30 @@ static const TypeInfo vt82c686b_superio_info = { #define TYPE_VT8231_SUPERIO "vt8231-superio" +static void vt8231_superio_update(ViaSuperIOState *s) +{ + isa_parallel_set_enabled(s->superio.parallel[0], + (s->regs[0xf2] & 0x3) != 3); + isa_serial_set_enabled(s->superio.serial[0], s->regs[0xf2] & BIT(2)); + isa_fdc_set_enabled(s->superio.floppy, s->regs[0xf2] & BIT(4)); + + isa_serial_set_iobase(s->superio.serial[0], (s->regs[0xf4] & 0xfe) << 2); + isa_parallel_set_iobase(s->superio.parallel[0], s->regs[0xf6] << 2); + isa_fdc_set_iobase(s->superio.floppy, (s->regs[0xf7] & 0xfc) << 2); +} + +static int vmstate_vt8231_superio_post_load(void *opaque, int version_id) +{ + vt8231_superio_update(opaque); + return 0; +} + +static const VMStateDescription vmstate_vt8231_superio = { + .name = "vt8231_superio", + .version_id = 1, + .post_load = vmstate_vt8231_superio_post_load, +}; + static void vt8231_superio_cfg_write(void *opaque, hwaddr addr, uint64_t data, unsigned size) { @@ -465,6 +522,12 @@ static void vt8231_superio_cfg_write(void *opaque, hwaddr addr, case 0xfd: /* ignore write to read only registers */ return; + case 0xf2: + case 0xf4: + case 0xf6 ... 0xf7: + sc->regs[idx] = data; + vt8231_superio_update(sc); + return; default: qemu_log_mask(LOG_UNIMP, "via_superio_cfg: unimplemented register 0x%x\n", idx); @@ -493,19 +556,15 @@ static void vt8231_superio_reset(DeviceState *dev) /* Device revision */ s->regs[0xf1] = 0x01; /* Function select - all disabled */ - vt8231_superio_cfg_write(s, 0, 0xf2, 1); - vt8231_superio_cfg_write(s, 1, 0x03, 1); + s->regs[0xf2] = 0x03; /* Serial port base addr */ - vt8231_superio_cfg_write(s, 0, 0xf4, 1); - vt8231_superio_cfg_write(s, 1, 0xfe, 1); + s->regs[0xf4] = 0xfe; /* Parallel port base addr */ - vt8231_superio_cfg_write(s, 0, 0xf6, 1); - vt8231_superio_cfg_write(s, 1, 0xde, 1); + s->regs[0xf6] = 0xde; /* Floppy ctrl base addr */ - vt8231_superio_cfg_write(s, 0, 0xf7, 1); - vt8231_superio_cfg_write(s, 1, 0xfc, 1); + s->regs[0xf7] = 0xfc; - vt8231_superio_cfg_write(s, 0, 0, 1); + vt8231_superio_update(s); } static void vt8231_superio_init(Object *obj) @@ -513,12 +572,6 @@ static void vt8231_superio_init(Object *obj) VIA_SUPERIO(obj)->io_ops = &vt8231_superio_cfg_ops; } -static uint16_t vt8231_superio_serial_iobase(ISASuperIODevice *sio, - uint8_t index) -{ - return 0x2f8; /* FIXME: This should be settable via registers f2-f4 */ -} - static void vt8231_superio_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -526,10 +579,10 @@ static void vt8231_superio_class_init(ObjectClass *klass, void *data) dc->reset = vt8231_superio_reset; sc->serial.count = 1; - sc->serial.get_iobase = vt8231_superio_serial_iobase; sc->parallel.count = 1; sc->ide.count = 0; /* emulated by via-ide */ sc->floppy.count = 1; + dc->vmsd = &vmstate_vt8231_superio; } static const TypeInfo vt8231_superio_info = {