From patchwork Sun Jan 14 12:39:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13519151 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 C7476C4707B for ; Sun, 14 Jan 2024 12:44:56 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOzm4-0003F2-FV; Sun, 14 Jan 2024 07:39: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 1rOzlz-0003DC-B6; Sun, 14 Jan 2024 07:39:32 -0500 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rOzlx-0001Yg-1y; Sun, 14 Jan 2024 07:39:31 -0500 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-50e7d6565b5so9223724e87.0; Sun, 14 Jan 2024 04:39:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705235965; x=1705840765; 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=Blu6OuTjSPsdfd3EbHeR0ttbZLV058NKotTs2DtlESs=; b=e8zL+0lXzIqWvSAGbaxDxZF1ruuppUcHrTwFlBz18MVRkriszdlZyBahIFmpDBzLIB g1RR0sW9GahmRUdRgYmJDAlcRlRGAoNPFn78xl5mMX081CmB9pSMC8yFTL2HvNGfKtiL DhKNzk0BJutuguZiR1eCQRkTHFbHMhcNO2yMHeS+nzE6eCUgxrRc3H692NQJZMYcB0Lq Ts9qJQ+QEPxx2YdWNCjUK0g3ApMghSlQrrhS4PkYgsNbV+0/W+L8oWqWgvHXfDURIZyQ z3afzcsvdEJm+xuFzOYrva8WZ3KQ/Oyxcp5f+aJhbMy/mjwAZ4K3NG9FDA64nUHfjGdC ZcQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705235965; x=1705840765; 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=Blu6OuTjSPsdfd3EbHeR0ttbZLV058NKotTs2DtlESs=; b=O2JwVjboT6pWC+dBnr/mOWaBL5vjbl9UerZUH9qcTYajsZ2Y3tBLitbDWJvR+Qvl38 gFMD0As+IANInHEdNaL3K6yDWC/qFMgo9xEv3NI096HqI1EDvY+qCwOy3iUlyyDZkzFB b7doprPDpyAD+iVVOtDTntn3PqbX7UzvRldpvMgTWWwQYy0+LPJt1FY22OJq62eDzJGL j/c3wyi34vItRwV1qZzIOlseUpDEW82L/qKMO2KNsIEkMQQVYmT1PTzjS7wL0mS3J7yy AyrdtAI0DI+dSjz5HpKHosls5F77Su4l3Cr5tZdEKcvkoxCFZnu6X6GuoUErBis16B62 qCjw== X-Gm-Message-State: AOJu0YyfIKk9RG+agnZ27t7sc2XYMPSOlHfOawZMFM0pFBAjGphgjd77 3YeeOxhxFGOMESVyaUGJ8alpHOeiDNk= X-Google-Smtp-Source: AGHT+IEBsmbm58nPQH4Hjg5RrwhCkRVAcO0Rd3js4FhncHG9B83nyPXe1zUnwDlkk5p0HH1nL/VHQQ== X-Received: by 2002:a05:6512:10cd:b0:50e:2bfe:ef43 with SMTP id k13-20020a05651210cd00b0050e2bfeef43mr2105583lfg.115.1705235964652; Sun, 14 Jan 2024 04:39:24 -0800 (PST) Received: from archlinux.. (dynamic-077-183-249-018.77.183.pool.telefonica.de. [77.183.249.18]) by smtp.gmail.com with ESMTPSA id s2-20020a170906354200b00a293c6cc184sm4023734eja.24.2024.01.14.04.39.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 04:39:23 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-block@nongnu.org, Sergio Lopez , =?utf-8?b?RnLDqWTDqXJpYyBCYXJyYXQ=?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-ppc@nongnu.org, Artyom Tarasenko , Fabiano Rosas , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Hanna Reitz , Jiaxun Yang , John Snow , Thomas Huth , Peter Xu , Paolo Bonzini , Mark Cave-Ayland , Leonardo Bras , "Michael S. Tsirkin" , Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Marcel Apfelbaum , BALATON Zoltan , Aleksandar Rikalo , Kevin Wolf , David Hildenbrand , Bernhard Beschow Subject: [PATCH v5 01/11] hw/block/fdc-isa: Move portio_list from FDCtrl to FDCtrlISABus Date: Sun, 14 Jan 2024 13:39:01 +0100 Message-ID: <20240114123911.4877-2-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240114123911.4877-1-shentey@gmail.com> References: <20240114123911.4877-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=shentey@gmail.com; helo=mail-lf1-x133.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 ad0921c7d3..2d8a98ce7d 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 Sun Jan 14 12:39:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13519150 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 D509FC47077 for ; Sun, 14 Jan 2024 12:44:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOzm4-0003F1-DM; Sun, 14 Jan 2024 07:39: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 1rOzm1-0003Dg-7h; Sun, 14 Jan 2024 07:39:34 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rOzlz-0001aT-FW; Sun, 14 Jan 2024 07:39:32 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40e5f746ac4so40782325e9.1; Sun, 14 Jan 2024 04:39:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705235968; x=1705840768; 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=5+9ZapGs110KfVKNFzaiA44RoY0VoVZdYmH4JCjTMrQ=; b=RlHvsf3NTfmfJjoRODzMsxzZYC/84sjcNW/vtHgGoX3w0Kkt0gm9fJidkYH+zlWn5f WdhfZdcVc7A/22eWIlYaxtAfsd9MjXWCX7+A1ApPbn/3LAISiaHeqh3TwUzsn/yiuIM8 M49NhvfHSA3YkUNfOn9fH8yOuKSDqPQ8DrONub5nu5CSivIHLz6T4Kd/eVPPaKnYxkLn fgU2tUAtwEPs1K6d+v+xfMJYgo/GMOqQ4uv7zmlzAe2XqIn2EpcHsW0GC4J6y9iAENJ+ V0GrDTfk3KcrsHXQgkfP/VzRb0OA0wZnalaYQUA/v0HyucM0sbOHgtqmqkl8TnF+Cov8 LkLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705235968; x=1705840768; 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=5+9ZapGs110KfVKNFzaiA44RoY0VoVZdYmH4JCjTMrQ=; b=R3WwPKisBoTtmZomZdV3vy1yPWyFwY9K1EN7U9rNvl6OyFHQiGZm4n2Lj61Y3yqTxS 6LkZ8CZ2bdM2WHExJEkEs+DGv2YSpTSvrlFfaEB976VYJz6rXRMMVZ2kC+N6AJEfIj+I 9OjGVkvaaK9PIquMLs1jZeYk4PO3C6g26XjQsuduLq+Kn9QA3mCAEEYe+vjjYKUEMvc1 ZjCDqoyGzbSHQVjDyTq9BvScWgKsglnBWpDF7jlT0yw9z09rU9NZ53kK2vr1OyAZEy7G hrCbrcW20khm/Y73YAOhePu4fJkZLExjLiaGdWZ4dCsuRiNCBWQdAcRxDaQiO15eix+4 kC1Q== X-Gm-Message-State: AOJu0Yw6Fhqjm1Fd8t87vx6LqgCQEM0JdF8ylAI3MmPRNKclzpaW6lxp MeQhzFpRqXzVJpMsoA3vLf1c3G2j8WE= X-Google-Smtp-Source: AGHT+IErOcbIpe83fjdXOFuOXp0Js87h3sYLJTW60HMicr/amRmSEj71Sp14D+50+9xVHz89+kXTYg== X-Received: by 2002:a7b:cb04:0:b0:40e:50c1:4e79 with SMTP id u4-20020a7bcb04000000b0040e50c14e79mr2280188wmj.45.1705235967569; Sun, 14 Jan 2024 04:39:27 -0800 (PST) Received: from archlinux.. (dynamic-077-183-249-018.77.183.pool.telefonica.de. [77.183.249.18]) by smtp.gmail.com with ESMTPSA id s2-20020a170906354200b00a293c6cc184sm4023734eja.24.2024.01.14.04.39.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 04:39:26 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-block@nongnu.org, Sergio Lopez , =?utf-8?b?RnLDqWTDqXJpYyBCYXJyYXQ=?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-ppc@nongnu.org, Artyom Tarasenko , Fabiano Rosas , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Hanna Reitz , Jiaxun Yang , John Snow , Thomas Huth , Peter Xu , Paolo Bonzini , Mark Cave-Ayland , Leonardo Bras , "Michael S. Tsirkin" , Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Marcel Apfelbaum , BALATON Zoltan , Aleksandar Rikalo , Kevin Wolf , David Hildenbrand , Bernhard Beschow Subject: [PATCH v5 02/11] hw/block/fdc-sysbus: Move iomem from FDCtrl to FDCtrlSysBus Date: Sun, 14 Jan 2024 13:39:02 +0100 Message-ID: <20240114123911.4877-3-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240114123911.4877-1-shentey@gmail.com> References: <20240114123911.4877-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=shentey@gmail.com; helo=mail-wm1-x336.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 266bc4d145..035bc08975 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 Sun Jan 14 12:39:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13519147 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 39FD0C4707B for ; Sun, 14 Jan 2024 12:42:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOzm4-0003Ez-1S; Sun, 14 Jan 2024 07:39: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 1rOzm2-0003Dp-LH; Sun, 14 Jan 2024 07:39:34 -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 1rOzm1-0001c0-30; Sun, 14 Jan 2024 07:39:34 -0500 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a2821884a09so661176966b.2; Sun, 14 Jan 2024 04:39:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705235970; x=1705840770; 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=cBLwkrwr8Jj7XdQH7raQa9Nj1TEuOiCXih1DV9ONnp0=; b=LcVVTIPdvsWkbmWzE3fw4M4DLx83zOYWUKWI264Do+ahvd9BUA21P19S2Cdb9JOL/h rBoZGjDlg3Ljw4FqTv3NL8Z9yA5+xXH37q8xv6HKgEu1fJtBQdWHFRBVKtwmlN8IzJ38 M8OI0necIwv7/Xofy9XwvfzyVJQsboGfLS15B9iqhka08XdF05v6rxnLYkI75U9B9w2T 7X456ODOGRjK4SseBYDGkt7QDX6wUfnJeB63awv8opVpVkGRFfCMnTwGOnQfzihZqfon bdynABoTEPN4KDCDX0ZrypOpxcmqaNDJZfcmFTKgeHfvyj0ou7rvmLtjnf49insUrB1m Lj0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705235970; x=1705840770; 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=cBLwkrwr8Jj7XdQH7raQa9Nj1TEuOiCXih1DV9ONnp0=; b=FDF3Vzi5Giop8iaxiEhPt9hfA3XFnBIcA64pswf98OK5m+tthnqlMhJ6ZCdvw83Md3 nLGxRG0+2BlXBj2sb4uDqvF2HWY70GTZx6NmVwgAs1swtYUiJ+zxvukt/Yx0wdDwSHuS LqdvkpOA/1+RHu2zghbrayLePE/VcU2HJoM31BwEU7NHL5Cc28NMFrc328rUzs+4dQE3 m25rUq4IulOWWr0hVkndcBYwm/wz6/ssBGnMtCBQ00sYNGlliM1+j+dVhUWS7bRuUxex D1xek3Fr6oI0sI/I+Zbgl/A7ljgWR1WZwaqkCS6xVWsAyDLcfwxQj7QdiiSUr1WVR2gU uXtg== X-Gm-Message-State: AOJu0Yy0kasWLQDWzlO5UfNHO3LAwQhCXBa8VBEqrVLagE1hnheGWYjA LBrhx0mRNanMbBKNsat/cNdlU8lXyI8= X-Google-Smtp-Source: AGHT+IHYk9nCkTF+HhCXDlLk1qqNAtlMtHVac3SFDz5o/jdJpjcMzan3+2q6qfrfV0CB9dYFBKwohQ== X-Received: by 2002:a17:906:591:b0:a28:b6b6:af90 with SMTP id 17-20020a170906059100b00a28b6b6af90mr2132368ejn.71.1705235970083; Sun, 14 Jan 2024 04:39:30 -0800 (PST) Received: from archlinux.. (dynamic-077-183-249-018.77.183.pool.telefonica.de. [77.183.249.18]) by smtp.gmail.com with ESMTPSA id s2-20020a170906354200b00a293c6cc184sm4023734eja.24.2024.01.14.04.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 04:39:28 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-block@nongnu.org, Sergio Lopez , =?utf-8?b?RnLDqWTDqXJpYyBCYXJyYXQ=?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-ppc@nongnu.org, Artyom Tarasenko , Fabiano Rosas , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Hanna Reitz , Jiaxun Yang , John Snow , Thomas Huth , Peter Xu , Paolo Bonzini , Mark Cave-Ayland , Leonardo Bras , "Michael S. Tsirkin" , Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Marcel Apfelbaum , BALATON Zoltan , Aleksandar Rikalo , Kevin Wolf , David Hildenbrand , Bernhard Beschow Subject: [PATCH v5 03/11] hw/char/parallel: Move portio_list from ParallelState to ISAParallelState Date: Sun, 14 Jan 2024 13:39:03 +0100 Message-ID: <20240114123911.4877-4-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240114123911.4877-1-shentey@gmail.com> References: <20240114123911.4877-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, 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 bd488cd7f9..c394635ada 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 Sun Jan 14 12:39:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13519142 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 51C70C47DA2 for ; Sun, 14 Jan 2024 12:40:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOzm7-0003Ih-Ib; Sun, 14 Jan 2024 07:39: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 1rOzm6-0003G0-6D; Sun, 14 Jan 2024 07:39:38 -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 1rOzm3-0001eE-Jx; Sun, 14 Jan 2024 07:39:37 -0500 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a28ab7ae504so751275866b.3; Sun, 14 Jan 2024 04:39:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705235972; x=1705840772; 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=R+4YzVSaOixGv8SI8D+rtdIbBCbTSynv4mr9A5RKf6Xpx3kKxYkmHkO5x/ry/dLRf4 COEDcHQPjSfOioZVm3Z0Q7Ef5MbEq8SRb1oQaAmt0V+HOqDwFIbvV0VxQbSi432m1ejM I7lJh4szIfBuoxwGMMfCZbTOJ5Evp6V+wcBm68N2KO9+A7bMiUp4fVxsRA7SiMH5nDz5 P5IsvUHKvsbk8AKubgPy13KaAh4tl/xcHtMwQiA9fbgWe9t5Snb7EuE+Mpiu8t9dkYJQ O5mt+5QXOn7QtyNLZ6J5tfo4KPKSokOeFGZF+PdNRCJvTI8IyfVHQcN+mv1tAN8Npa/u 85ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705235972; x=1705840772; 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=MG+yA2uVFDhL2AOgnuvv5r9xgrSVoZfvOocOSrO2qWEq28W5c1FiOqao7hCrrE+SLF LBtz8xngVe6+d+/y5Qt90sWlHeoZJvZ9GCJRXZLyxOixpA+b11bDnjSk5w6XOE53gwK9 P1J6sqpVQFpejAqFvF/gTI1TRfCKy3XNI+EoeW8DqSVfu4lk7M8tMWrgS8GM+4+h3niH l+458qHTu1FHmNqxDS6+Y76UqcfH53bIiMPf/2M7mOx4eIHlKoZc65NMTclgJMe3GqYM Cvu6Hr4NVvLmji8kw6lJqHpiS5Yteg/2A96tJa6wEj8ABGrL4/9BBgvGHyKIoIGc5wkK Gj5g== X-Gm-Message-State: AOJu0YzD3CdCEWybxe2CkQiWPVutgHQ+2XEboffEUEWiVl/8+CK0X9AI jSvXSU5huA8WuPY5hPgpwjNuIbIR+V0= X-Google-Smtp-Source: AGHT+IExDEBbKKzXK0q/e+qgxMzzycbVzZx9NcqByiyHmvLI6Z07oZd9r8tEIlvczoOIuKUlM5G7gA== X-Received: by 2002:a17:906:4bc8:b0:a2a:18ad:ebb4 with SMTP id x8-20020a1709064bc800b00a2a18adebb4mr1713945ejv.62.1705235972480; Sun, 14 Jan 2024 04:39:32 -0800 (PST) Received: from archlinux.. (dynamic-077-183-249-018.77.183.pool.telefonica.de. [77.183.249.18]) by smtp.gmail.com with ESMTPSA id s2-20020a170906354200b00a293c6cc184sm4023734eja.24.2024.01.14.04.39.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 04:39:31 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-block@nongnu.org, Sergio Lopez , =?utf-8?b?RnLDqWTDqXJpYyBCYXJyYXQ=?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-ppc@nongnu.org, Artyom Tarasenko , Fabiano Rosas , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Hanna Reitz , Jiaxun Yang , John Snow , Thomas Huth , Peter Xu , Paolo Bonzini , Mark Cave-Ayland , Leonardo Bras , "Michael S. Tsirkin" , Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Marcel Apfelbaum , BALATON Zoltan , Aleksandar Rikalo , Kevin Wolf , David Hildenbrand , Bernhard Beschow Subject: [PATCH v5 04/11] exec/ioport: Resolve redundant .base attribute in struct MemoryRegionPortio Date: Sun, 14 Jan 2024 13:39:04 +0100 Message-ID: <20240114123911.4877-5-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240114123911.4877-1-shentey@gmail.com> References: <20240114123911.4877-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, 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 Sun Jan 14 12:39:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13519143 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 53973C47077 for ; Sun, 14 Jan 2024 12:40:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOzmA-0003LF-Ey; Sun, 14 Jan 2024 07:39:42 -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 1rOzm8-0003KQ-UO; Sun, 14 Jan 2024 07:39:40 -0500 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rOzm6-0001f4-Ko; Sun, 14 Jan 2024 07:39:40 -0500 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a28b1095064so876134466b.2; Sun, 14 Jan 2024 04:39:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705235975; x=1705840775; 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=kpEcA88cRod9dP4VaT6aI75tyeAltviYyOMgF+q17FQ=; b=kbQjCUMIdEHzDtl4kaX2V/G3rT7eN6v6tAIptA+tv7CdD/diFQpS9ILEe9RYEUz+6Y JWC5lhLYOz55SPJrqBl3qzs1vAfsUlpiLtS3nFliy1lb/bw/3+Q4sZSog3aQlX1Olm19 5enquQBeSjvVHWLzsgHbAAuc0bd/+i5X5FAcYwBke9KBODR0fT0BO0QzrTaFg5EPxLux eg33btUBRT76AsyqCxsu03lcipXtWn84QlypaaoII3kseGYHBFeVEEEc7RHLdmFY/sG9 TUWnTbjhhV2Zm5U3ZYMb/0o9a3AtwbdEJdi1W78WzEwVi+KFBmCSmgyqzUN5rHPRyWc7 Kaew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705235975; x=1705840775; 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=kpEcA88cRod9dP4VaT6aI75tyeAltviYyOMgF+q17FQ=; b=mBF/S8GQSGfklimUDk81No1KNHjhl8mpDQgD587ZcvcxINIl3WKY70Qvq/JhkWuvCe CcIe0Pcd7EPngXXWxgXYg1E/URJE0FXjHbUWJvLhg/Wjg+MhXbLfo/hs0IxIN2OSQErf SZSe6w/KMQHfOQlbzjhfRQzMCw43Bdoi84sjjC8cSGn/do5pAz6W2sw6hZcdwerTpwWo Blk7u9tG1JawIPWFfnjLRhz7eSJz6N48mby2MEfJS2E9t7mbZV6Mq6Cjgxw/UrUYj6g6 tap45JIa8eGB7fpkiBUpVB7hmp9hJe08S+3ybwCKsXzAAItHXZGWcwob9V+E/PRuqveo d3AQ== X-Gm-Message-State: AOJu0Yxj1jIjhGUdQ+FeqxxtGIGJfwJqxYtGq4hG2VvJnkdKMGXdVq8Y 7Nh3Mx4j3eeljblaLxUz7UiXCB9yDck= X-Google-Smtp-Source: AGHT+IGQi48VndYlJg97lVNKOTVDYwWLT6ubnWar1GScAV7aR7TeuAF5yLm3gA6oksfpHMuBSXla+g== X-Received: by 2002:a17:906:1d4e:b0:a2c:22ae:e729 with SMTP id o14-20020a1709061d4e00b00a2c22aee729mr804631ejh.2.1705235975294; Sun, 14 Jan 2024 04:39:35 -0800 (PST) Received: from archlinux.. (dynamic-077-183-249-018.77.183.pool.telefonica.de. [77.183.249.18]) by smtp.gmail.com with ESMTPSA id s2-20020a170906354200b00a293c6cc184sm4023734eja.24.2024.01.14.04.39.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 04:39:34 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-block@nongnu.org, Sergio Lopez , =?utf-8?b?RnLDqWTDqXJpYyBCYXJyYXQ=?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-ppc@nongnu.org, Artyom Tarasenko , Fabiano Rosas , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Hanna Reitz , Jiaxun Yang , John Snow , Thomas Huth , Peter Xu , Paolo Bonzini , Mark Cave-Ayland , Leonardo Bras , "Michael S. Tsirkin" , Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Marcel Apfelbaum , BALATON Zoltan , Aleksandar Rikalo , Kevin Wolf , David Hildenbrand , Bernhard Beschow Subject: [PATCH v5 05/11] exec/ioport: Add portio_list_set_address() Date: Sun, 14 Jan 2024 13:39:05 +0100 Message-ID: <20240114123911.4877-6-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240114123911.4877-1-shentey@gmail.com> References: <20240114123911.4877-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=shentey@gmail.com; helo=mail-ej1-x636.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 95351ba51f..30b05f0f74 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 Sun Jan 14 12:39:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13519140 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 24540C4707B for ; Sun, 14 Jan 2024 12:40:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOzmC-0003Ma-NH; Sun, 14 Jan 2024 07:39:44 -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 1rOzmA-0003LL-TL; Sun, 14 Jan 2024 07:39:42 -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 1rOzm9-0001ho-Bj; Sun, 14 Jan 2024 07:39:42 -0500 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a28cc85e6b5so934738566b.1; Sun, 14 Jan 2024 04:39:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705235978; x=1705840778; 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=yLhGyFxoalYrWwXJ5TMnYbhPZmyPAPZBcWGnzyg4yTg=; b=iuFWxMdOTLrQjcinmgEIqnbwR9d1oG91G9hFt4TYuMSpU2xQvjiU1omhhQOF0NZL48 P1KNbiBXq80Wd+UIJynLOHx+dKlmxIWC5lyAXRMhM+L2Wbqe9l6Z70J7IVO0BwYCxoyw 4Fk5no4M5ciUSltH82T7CqulUhZG62Umr1WS4Fd8mPpQQZkJ1THsqzzveKidq42BoSu5 lps7oHOsvzq6FMNVp9ePOuln7ndUyAOu4ViWnD3uU4OkirsiYTSr+5S7feIynwsPr4tA jtrnVyiOxtmT2krgsXBLFKtaElbXe5dF4pzAe5WAblFybFI8mQQBz3/wJc84mAbUDC3O Up8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705235978; x=1705840778; 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=yLhGyFxoalYrWwXJ5TMnYbhPZmyPAPZBcWGnzyg4yTg=; b=AmrU2h0nlxEIa159Dg7mU1Youc057G7eUpaOOhuq5F3tpXkoStkpyvwzHK2++qxOlz N0wYONMa1dUE6crY/XRLGyEVzf2O4ahFZwISJIGirxhBMrFt0eJCj5cJ8k2nHNGWASai v6v9ESQASslCGfhAgCVmpNHjsuuO7saSEnr2tJm07qtDiQOzSBwrHAZdd4nTiXN86Z9W RgDOtpVP3ElUt6OXGzHNiz/vEp9Wa6ZyGqQPIjMWmU6nqRS1q+dUKESsQfMxY6gFWj+m du51lk35oDkjlOhVur2MxEw9jt+IR91DXmt1EJDkUrSyani7F36B4zz3Jr/MINjUnaqC +htg== X-Gm-Message-State: AOJu0Ywn3WS1GdgNmeNXgTpp/haAXFEnJN2Y2NgyE/inw71Hs9EXqglt aDFSWolfAOWoFb5NkTCfIPAJMxhrR9Q= X-Google-Smtp-Source: AGHT+IGwrazloDR1nYvPODY8e1lcZ2nn0lj58EZTJpfqhV7VnhKysJIu+HqpMi/ROE4AUO+2VpR78w== X-Received: by 2002:a17:907:9504:b0:a2c:b993:d0b7 with SMTP id ew4-20020a170907950400b00a2cb993d0b7mr1028420ejc.233.1705235978425; Sun, 14 Jan 2024 04:39:38 -0800 (PST) Received: from archlinux.. (dynamic-077-183-249-018.77.183.pool.telefonica.de. [77.183.249.18]) by smtp.gmail.com with ESMTPSA id s2-20020a170906354200b00a293c6cc184sm4023734eja.24.2024.01.14.04.39.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 04:39:37 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-block@nongnu.org, Sergio Lopez , =?utf-8?b?RnLDqWTDqXJpYyBCYXJyYXQ=?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-ppc@nongnu.org, Artyom Tarasenko , Fabiano Rosas , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Hanna Reitz , Jiaxun Yang , John Snow , Thomas Huth , Peter Xu , Paolo Bonzini , Mark Cave-Ayland , Leonardo Bras , "Michael S. Tsirkin" , Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Marcel Apfelbaum , BALATON Zoltan , Aleksandar Rikalo , Kevin Wolf , David Hildenbrand , Bernhard Beschow Subject: [PATCH v5 06/11] exec/ioport: Add portio_list_set_enabled() Date: Sun, 14 Jan 2024 13:39:06 +0100 Message-ID: <20240114123911.4877-7-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240114123911.4877-1-shentey@gmail.com> References: <20240114123911.4877-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, 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 30b05f0f74..1683fc6026 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 Sun Jan 14 12:39:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13519141 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 4DBE3C47422 for ; Sun, 14 Jan 2024 12:40:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOzmF-0003Nr-Rk; Sun, 14 Jan 2024 07:39: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 1rOzmE-0003NM-5i; Sun, 14 Jan 2024 07:39:46 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rOzmC-0001jN-Ev; Sun, 14 Jan 2024 07:39:45 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40e63bc90f2so24762105e9.2; Sun, 14 Jan 2024 04:39:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705235981; x=1705840781; 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=t/DnmwsZ7xP8YAXiG+Ug2+agkl77mYRu9Wp28MfNLeE=; b=TvhOHXCG+T9ueMTz3X7pk9CVszmsZiVT0mros0s7gJ5P6gULpedZTx64Gq0YQ9qfpp OlofSh8qw0hOwZbwpLK+AsAduKmLKovWNLj3dYJsGiYr+cJas3kv5O1P3nCYsWnXaD3n L/yWNLNylggQu3Kk9RybGJnUCVv1Yfpm+2V362IXFOMNVoTf0uYTHYlTifz3xnJTVYzZ q3/eDTJQM5Y5gKOVe4BK7qFeyOOmSb+5KWl0NJvN5CPFOKmL/h38sKEEZISWYcS0T3H7 VoAcHmt+HXox9ZsNr8enNiW0WyUvB1t7oWLg8nTcIExAsTgEpSn+u2M03PeZ8p3NxBE4 7fMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705235981; x=1705840781; 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=t/DnmwsZ7xP8YAXiG+Ug2+agkl77mYRu9Wp28MfNLeE=; b=fV0QrSfksF8UsqbB3LRvnllJbwxlKGQmL4P7dAChmx+33uiCh0kyLtN1rXj2yqJ1qX DNZ7ig26+MR01YK2CCU0Pgta1CApe3TedO9ZjBbA1dCvVyB9Srtou7nGVwtAf45v9eCO e6bYDwLnNUcYDLoyVOsHO4ViNgv3U57pvBefpULB9/DVPeu/8V3nT4J7wnsOnvhMUQOm Ws89Ungu6Uwr9jX09b6YrfgI/CCcShZTw2wD/ik8izVB71bOVpGQnc++rxqIA/ZdIfUI E1/5IyKUysWUsHs55UyjyCJpbrK2i/iM7GBjXhxD7ZcG/oaYi34LsxhcEj4ltiEMm69T 0a/w== X-Gm-Message-State: AOJu0YxpjZV4F4eAxfnXI7NBC+RL44lbNTZB85sCAwvinvhWuvrSrt1C ocFx/1wG9NLxXjLaH2O3oLckKaUeTvk= X-Google-Smtp-Source: AGHT+IHd8Z37S+Z8k7S+pRomCbI3yME/rVdXQCWk5EUCJhJvuRxiHOBRGfdf10qKEJPTKEV9RBOOXg== X-Received: by 2002:a05:600c:5d1:b0:40e:70c0:830c with SMTP id p17-20020a05600c05d100b0040e70c0830cmr679197wmd.15.1705235981294; Sun, 14 Jan 2024 04:39:41 -0800 (PST) Received: from archlinux.. (dynamic-077-183-249-018.77.183.pool.telefonica.de. [77.183.249.18]) by smtp.gmail.com with ESMTPSA id s2-20020a170906354200b00a293c6cc184sm4023734eja.24.2024.01.14.04.39.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 04:39:39 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-block@nongnu.org, Sergio Lopez , =?utf-8?b?RnLDqWTDqXJpYyBCYXJyYXQ=?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-ppc@nongnu.org, Artyom Tarasenko , Fabiano Rosas , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Hanna Reitz , Jiaxun Yang , John Snow , Thomas Huth , Peter Xu , Paolo Bonzini , Mark Cave-Ayland , Leonardo Bras , "Michael S. Tsirkin" , Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Marcel Apfelbaum , BALATON Zoltan , Aleksandar Rikalo , Kevin Wolf , David Hildenbrand , Bernhard Beschow Subject: [PATCH v5 07/11] hw/block/fdc-isa: Implement relocation and enabling/disabling for TYPE_ISA_FDC Date: Sun, 14 Jan 2024 13:39:07 +0100 Message-ID: <20240114123911.4877-8-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240114123911.4877-1-shentey@gmail.com> References: <20240114123911.4877-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=shentey@gmail.com; helo=mail-wm1-x32a.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_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 2d8a98ce7d..e43dc532af 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 Sun Jan 14 12:39:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13519145 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 7A83FC47077 for ; Sun, 14 Jan 2024 12:41:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOzmJ-0003R3-5v; Sun, 14 Jan 2024 07:39:51 -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 1rOzmG-0003OC-BD; Sun, 14 Jan 2024 07:39:48 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rOzmE-0001km-PB; Sun, 14 Jan 2024 07:39:48 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40b5155e154so99108915e9.3; Sun, 14 Jan 2024 04:39:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705235984; x=1705840784; 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=py92FQejKDlLtWW57eF8TnbqU3TrVAOsFf1Pvat3KP0=; b=ZXw04qH0zOo5Lqd0SoFrI4UZIBbMvj71MbxOKXDf9au8/WhQzqyrjRPHVEA9bVZYEs X3l9l0561cEQa9x5++2zzVIqPwsgmG7fYVNZqYQr1ShOKqhE2E9ghJ6Bx5ANh+2UjOkW Aa1U3FsWp1glranN2w978kleWLGCC52gfpZfaqB2ETXNW0KUbTfH/EN1GIMR2v7t7kXO ZVX6jhxNAdblZN38t/NR/+83k28m6efHp+3Ow9xNRi6nHzZrMa6/oDDMB0IFBVv4PMbU b3V7wQZpWe3EWvW/ertM/Xos/Cpp13U7AfzzXyXDEjXFF5SaeEcxeJ813WoyRKUPjvKb lS/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705235984; x=1705840784; 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=py92FQejKDlLtWW57eF8TnbqU3TrVAOsFf1Pvat3KP0=; b=DzUeXe+F/fQyIjjrPd/fNKFlXqPDZbWusLPxYI7CrkzTBScnuQllzZ/j4ZNkimTOOE T9zh9AWXaiOdmlMkMggAYtp5ZvdCqwOexgv4klbL2UxISruega3JnthR6aGJhmtZOfgT HlWkpam+02n0bpCLqWF21Dm8hNDDqJdE3XmZ86TSfa0Iyvidi/IRPz70SanisAZ5wepZ 55AA42whUVZvtey7UUOZXjPJp466EgkmnFlRtFJni/Es1EFwN5hV0Rt2LoTG4DL6Jqz+ TKJXqAIe/n/wJsncmggeTOLzOjjz1zupPp0R+vFueRB/S5vODOCQS+6ag+oTkbrENRNd CO0Q== X-Gm-Message-State: AOJu0Yyy7HhVz+WhQqf9mac+sH7/7zMsC81wKepVoUH4PyLycPzfjF1t MEEsBrpXkPt6uL1ZSTgP70o/ph/JCfY= X-Google-Smtp-Source: AGHT+IFGbSXyitt7K4m7I8zZWCmULOkOrSj1QUV2ekxQATdQftbyUYosF4zunSkCkV+ps3YAW7ifrA== X-Received: by 2002:a05:600c:3224:b0:40e:46ff:6e54 with SMTP id r36-20020a05600c322400b0040e46ff6e54mr2086123wmp.58.1705235983692; Sun, 14 Jan 2024 04:39:43 -0800 (PST) Received: from archlinux.. (dynamic-077-183-249-018.77.183.pool.telefonica.de. [77.183.249.18]) by smtp.gmail.com with ESMTPSA id s2-20020a170906354200b00a293c6cc184sm4023734eja.24.2024.01.14.04.39.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 04:39:42 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-block@nongnu.org, Sergio Lopez , =?utf-8?b?RnLDqWTDqXJpYyBCYXJyYXQ=?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-ppc@nongnu.org, Artyom Tarasenko , Fabiano Rosas , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Hanna Reitz , Jiaxun Yang , John Snow , Thomas Huth , Peter Xu , Paolo Bonzini , Mark Cave-Ayland , Leonardo Bras , "Michael S. Tsirkin" , Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Marcel Apfelbaum , BALATON Zoltan , Aleksandar Rikalo , Kevin Wolf , David Hildenbrand , Bernhard Beschow Subject: [PATCH v5 08/11] hw/char/serial-isa: Implement relocation and enabling/disabling for TYPE_ISA_SERIAL Date: Sun, 14 Jan 2024 13:39:08 +0100 Message-ID: <20240114123911.4877-9-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240114123911.4877-1-shentey@gmail.com> References: <20240114123911.4877-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=shentey@gmail.com; helo=mail-wm1-x32f.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 1c793b20f7..329b352b9a 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 Sun Jan 14 12:39:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13519144 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 5A5C2C47077 for ; Sun, 14 Jan 2024 12:41:30 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOzmK-0003TG-1q; Sun, 14 Jan 2024 07:39: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 1rOzmI-0003QN-B0; Sun, 14 Jan 2024 07:39:50 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rOzmG-0001mv-Oq; Sun, 14 Jan 2024 07:39:50 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-40d6b4e2945so91836005e9.0; Sun, 14 Jan 2024 04:39:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705235986; x=1705840786; 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=CgakkSV3E3rN13pvgi1WIQ1IUAdBtGFScyMxa2osmU4H5sWqCUoUcWwcpvYfB3QPRK 7u2VnoqGAtMsiQA3tu+XP35ZJfSCdghUkru29+y/gRUyDOMa/4t14e1Q6a+/FH1rZc/l LMuUluF5z9+S8bNMl5tjGXQEBSQJgJUo6R1qsRFR0UBnxs9Q+roIm2j8rX3huhlrDInU qHbYfX4g2ArKGmM8TNsiFIK4m6Pipg9xzBllKt+t/BPJUPx4vSTxKzH7s5qcxM7GWBy8 GTummwb3iogvm4MpLtQKosBPLLkC54DLtqu3Zq9rAdeZbHb/rdMJRHnHoUTifoe318rQ 0qrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705235986; x=1705840786; 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=V0jD6pocAMkMk9Wikjtt8oBp3atxDjzzPmoHSoF+GbMdZaX3XYqOrSLtqDQ7Yb68Cj /NbCvaHaTlvJtKFJekypcw+rZZTyK2BxlpgVm2wl4y8QiiOhEjAYf94dugcjEzwHnUnR PKoriLbjcmYyoP75atnA196w+WfsgLttvl9kPScR/elyDA8Yk730Tot+Z0DqmmXm1mUB 5D+gMEXFM+4CNwYHLcf3s461oQ+mWUzJUjpHGNZfVLjmm+N+nsUlRpvlvo5SmlPbaCaf d8cTKrmR0ZCFPR3uQI3c4sXpJs9EO75b/Sz4bWY0npCdTiBjLh7XJWeWX7weselGI2yI JlLg== X-Gm-Message-State: AOJu0YyE8mYmJnIA/ojpl1xbf8JzMaXSyj9CyHNlIZeYQwK2RJ70dd/k +KPJEXYpICIvlDQy+uuIdq56tYNlCCg= X-Google-Smtp-Source: AGHT+IFrzxpg8JExJ+T1ucz+AaYLELfrlgkLvIZeKTOJfN2VbWlSVa8tjdL1POEa8MiewSq3fG636A== X-Received: by 2002:a05:600c:a684:b0:40e:4833:813b with SMTP id ip4-20020a05600ca68400b0040e4833813bmr1448393wmb.181.1705235985678; Sun, 14 Jan 2024 04:39:45 -0800 (PST) Received: from archlinux.. (dynamic-077-183-249-018.77.183.pool.telefonica.de. [77.183.249.18]) by smtp.gmail.com with ESMTPSA id s2-20020a170906354200b00a293c6cc184sm4023734eja.24.2024.01.14.04.39.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 04:39:44 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-block@nongnu.org, Sergio Lopez , =?utf-8?b?RnLDqWTDqXJpYyBCYXJyYXQ=?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-ppc@nongnu.org, Artyom Tarasenko , Fabiano Rosas , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Hanna Reitz , Jiaxun Yang , John Snow , Thomas Huth , Peter Xu , Paolo Bonzini , Mark Cave-Ayland , Leonardo Bras , "Michael S. Tsirkin" , Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Marcel Apfelbaum , BALATON Zoltan , Aleksandar Rikalo , Kevin Wolf , David Hildenbrand , Bernhard Beschow Subject: [PATCH v5 09/11] hw/char/parallel-isa: Implement relocation and enabling/disabling for TYPE_ISA_PARALLEL Date: Sun, 14 Jan 2024 13:39:09 +0100 Message-ID: <20240114123911.4877-10-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240114123911.4877-1-shentey@gmail.com> References: <20240114123911.4877-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=shentey@gmail.com; helo=mail-wm1-x333.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 Sun Jan 14 12:39:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13519149 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 93FCDC4707B for ; Sun, 14 Jan 2024 12:43:42 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOzmN-0003j1-BU; Sun, 14 Jan 2024 07:39:55 -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 1rOzmL-0003ZV-IX; Sun, 14 Jan 2024 07:39:53 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rOzmJ-0001oo-ON; Sun, 14 Jan 2024 07:39:53 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40e69b3149fso19056365e9.3; Sun, 14 Jan 2024 04:39:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705235988; x=1705840788; 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=G+Ml+Ge4Mh6egWEf/ah2KrW32CCxomhm5UQDIgErVxU=; b=BTFHMtTzpnFzSHh4puPmSplaj/dPfBqREzfPhcvamaCqlrJmxnTOkxUyhbvDjeKChT yGsT3qHUCSIpRMRJVF/C0PAehLAaxpV2gECnLOzOXMNh7yLLB2d4eLJ4DLNj8ZPcyy0b RHL0axe16p8KFEgeTuxS/QpILhTbNAgwDTE8qvzTvFbh9sRTSp4ymbsjLvmRR1n+Gqwo kemp849ihrUUHZuJPOC+rgjXFRwRc0cp3+hB+XT8bjc3Gz9bYSXmapIXeOOlqpI0+4uk s8RWiP/EYxlY3qriJ88K2qzSZSL1osJEyt5WNH1WsgYmPPe0iuMP1vo3M4K6qXnsP0Fl z1ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705235988; x=1705840788; 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=G+Ml+Ge4Mh6egWEf/ah2KrW32CCxomhm5UQDIgErVxU=; b=aB6CuzTyCmCVNy06oAMpTSfVR/l+J+wervX64rN+rO20PjsZpfPvbv/ELWfePS2j3d wX5m2ZXWmh9OYnfNWdYCOsbTUh0E1Yg7ZoKRZaXbg6mGgW7GjrvbD184pCS0D4ilotS2 Lim/tNPTpK47zOZxapPBizI0qnOVlKZTLA0oFqWKV/aCn8jlvvZCWgMWLwmdXlqReCYk O/xOEPyzs56a2BtvSINAvz27kWJOZkBsM54pjJ39VvqZ4eKAENnmH6WvJHAjEXU8bvYa STf3OH5L8cNAWufV+ljWlMFyT6g9rYJrAXIOOLqTLLGyQbpEbARrdoT7DzsA8qqwpOLF Cnyg== X-Gm-Message-State: AOJu0Yy4MJgsxBCl8lBlFI8UQujMfsVbeIrIEPjWpVzp/oNrIcUCe7N+ RHIL5iEmulPHErsgEs2OTh5TEcX4O2E= X-Google-Smtp-Source: AGHT+IFlYoX9ml4I7bLZ+BzbDjDuVS3CtcstueG+VwbcJvrqU8pUFx92yQex4OcGk5STjE9Xb/bfew== X-Received: by 2002:a05:600c:4fd5:b0:40d:6f89:a839 with SMTP id o21-20020a05600c4fd500b0040d6f89a839mr2643053wmq.30.1705235988517; Sun, 14 Jan 2024 04:39:48 -0800 (PST) Received: from archlinux.. (dynamic-077-183-249-018.77.183.pool.telefonica.de. [77.183.249.18]) by smtp.gmail.com with ESMTPSA id s2-20020a170906354200b00a293c6cc184sm4023734eja.24.2024.01.14.04.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 04:39:47 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-block@nongnu.org, Sergio Lopez , =?utf-8?b?RnLDqWTDqXJpYyBCYXJyYXQ=?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-ppc@nongnu.org, Artyom Tarasenko , Fabiano Rosas , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Hanna Reitz , Jiaxun Yang , John Snow , Thomas Huth , Peter Xu , Paolo Bonzini , Mark Cave-Ayland , Leonardo Bras , "Michael S. Tsirkin" , Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Marcel Apfelbaum , BALATON Zoltan , Aleksandar Rikalo , Kevin Wolf , David Hildenbrand , Bernhard Beschow Subject: [PATCH v5 10/11] hw/ppc/pegasos2: Let pegasos2 machine configure SuperI/O functions Date: Sun, 14 Jan 2024 13:39:10 +0100 Message-ID: <20240114123911.4877-11-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240114123911.4877-1-shentey@gmail.com> References: <20240114123911.4877-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=shentey@gmail.com; helo=mail-wm1-x329.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 Reviewed-by: BALATON Zoltan --- hw/ppc/pegasos2.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index d84f3f977d..04d6decb2b 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -285,6 +285,12 @@ static void pegasos2_pci_config_write(Pegasos2MachineState *pm, int bus, pegasos2_mv_reg_write(pm, pcicfg + 4, len, val); } +static void pegasos2_superio_write(uint8_t addr, uint8_t val) +{ + cpu_physical_memory_write(PCI1_IO_BASE + 0x3f0, &addr, 1); + cpu_physical_memory_write(PCI1_IO_BASE + 0x3f1, &val, 1); +} + static void pegasos2_machine_reset(MachineState *machine, ShutdownCause reason) { Pegasos2MachineState *pm = PEGASOS2_MACHINE(machine); @@ -310,6 +316,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(0xf4, 0xbe); + pegasos2_superio_write(0xf6, 0xef); + pegasos2_superio_write(0xf7, 0xfc); + pegasos2_superio_write(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 Sun Jan 14 12:39:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13519146 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 B6400C47422 for ; Sun, 14 Jan 2024 12:41:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOzmR-0003m1-M7; Sun, 14 Jan 2024 07:39:59 -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 1rOzmP-0003kA-7B; Sun, 14 Jan 2024 07:39:57 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rOzmN-0001s5-C0; Sun, 14 Jan 2024 07:39:56 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40e68d0dbf9so19635355e9.2; Sun, 14 Jan 2024 04:39:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705235992; x=1705840792; 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=DfI6LM71rZVhWLOGIPzk+FrbCZHFu6H7pIfxJhGta/0=; b=mFEGnk4SMKraZbrhVq5l1DEqWw2xUjFmSEn4ApsXqCOHXzgxoxXlf3nuyZ4K6Tzvpa pnjOzFtuXKcfu+OfUXoHSBPw9KoMY4daTJk9BKnwT5gAaXZ4+6fl90x1kidabVwImnSU rnH9tUZBGibigK8FACJ9IT0ar4AzpNh2gFpRTFYM4+8fpdiZaxAtl8adTkhohMX8w8/F 8DpTY8F6GYzpoDsBuYZM53m5ICVYGQxMhYtwMj6U7uqhv9/LyTA5YNtA9sGwLgS7UX40 4O18zeKE/pF5kp64zk9f0E+YQq15N34NuPPBlErJIxuIu7X9+9Ul06+hYan+KT4/bCEH arfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705235992; x=1705840792; 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=DfI6LM71rZVhWLOGIPzk+FrbCZHFu6H7pIfxJhGta/0=; b=qj/zdP+jU37l8JrXSfIlOR2nmtthyPZswWpt+m/iG754nDgNiLE4HMe47kFpC81FFl 3fUqCX0SB6M+EQsihXL9VS4hLA90RdheH33MwIdPQ7wzgfwYDmhTW/ezeTW065Mc71qz ygCGWZa+BLsM1aWEH13bpCeqFwtZn7PBK4+jPjp0G8WFs63Z7FzT3tmjV9Yyu4fIV8hC Y29m92hDy0izDfhsWXi+Sd5nNB+3Rb8uVyOhpJtYAX0z7K2ieTX6TiKnja/vm4po+3Cv tP7knfA3ayhFNdECyw8/wvR0tVviFx3Al38yC7tkvQUL0LXuatvl0JcrlWLfPwyNDJI2 kEJw== X-Gm-Message-State: AOJu0YyQ1VMkGY7PZzKIa8jSSlJV3GEk8RUp8BwiJ2+uTTZttOzoPuAD 9ii4ihC84SH1cdNlQEqz6xklVAITWKw= X-Google-Smtp-Source: AGHT+IEX5gXRrWi7Qmyl7/puukbGi2JFUvxxsdiNrBsL+KX+dck3OJAu0+RZoz2mhtmhYTueaqQGYQ== X-Received: by 2002:a05:600c:4a9b:b0:40e:5be9:8ed6 with SMTP id b27-20020a05600c4a9b00b0040e5be98ed6mr1272030wmp.90.1705235991802; Sun, 14 Jan 2024 04:39:51 -0800 (PST) Received: from archlinux.. (dynamic-077-183-249-018.77.183.pool.telefonica.de. [77.183.249.18]) by smtp.gmail.com with ESMTPSA id s2-20020a170906354200b00a293c6cc184sm4023734eja.24.2024.01.14.04.39.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 04:39:50 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-block@nongnu.org, Sergio Lopez , =?utf-8?b?RnLDqWTDqXJpYyBCYXJyYXQ=?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-ppc@nongnu.org, Artyom Tarasenko , Fabiano Rosas , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Hanna Reitz , Jiaxun Yang , John Snow , Thomas Huth , Peter Xu , Paolo Bonzini , Mark Cave-Ayland , Leonardo Bras , "Michael S. Tsirkin" , Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Marcel Apfelbaum , BALATON Zoltan , Aleksandar Rikalo , Kevin Wolf , David Hildenbrand , Bernhard Beschow Subject: [PATCH v5 11/11] hw/isa/vt82c686: Implement relocation and toggling of SuperI/O functions Date: Sun, 14 Jan 2024 13:39:11 +0100 Message-ID: <20240114123911.4877-12-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240114123911.4877-1-shentey@gmail.com> References: <20240114123911.4877-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=shentey@gmail.com; helo=mail-wm1-x335.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 Reviewed-by: BALATON Zoltan --- hw/isa/vt82c686.c | 65 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index d3e0f6d01f..485bb685b7 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" @@ -323,6 +326,17 @@ static uint64_t via_superio_cfg_read(void *opaque, hwaddr addr, unsigned size) return val; } +static void via_superio_devices_enable(ViaSuperIOState *s, uint8_t data) +{ + ISASuperIOClass *ic = ISA_SUPERIO_GET_CLASS(s); + + isa_parallel_set_enabled(s->superio.parallel[0], (data & 0x3) != 3); + for (int i = 0; i < ic->serial.count; i++) { + isa_serial_set_enabled(s->superio.serial[i], data & BIT(i + 2)); + } + isa_fdc_set_enabled(s->superio.floppy, data & BIT(4)); +} + static void via_superio_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -368,7 +382,25 @@ 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: + data &= 0x1f; + via_superio_devices_enable(sc, data); + break; + case 0xe3: + data &= 0xfc; + isa_fdc_set_iobase(sc->superio.floppy, data << 2); + break; + case 0xe6: + isa_parallel_set_iobase(sc->superio.parallel[0], data << 2); + break; + case 0xe7: + data &= 0xfe; + isa_serial_set_iobase(sc->superio.serial[0], data << 2); + break; + case 0xe8: + data &= 0xfe; + isa_serial_set_iobase(sc->superio.serial[1], data << 2); + break; default: qemu_log_mask(LOG_UNIMP, "via_superio_cfg: unimplemented register 0x%x\n", idx); @@ -395,9 +427,14 @@ static void vt82c686b_superio_reset(DeviceState *dev) /* Device ID */ vt82c686b_superio_cfg_write(s, 0, 0xe0, 1); vt82c686b_superio_cfg_write(s, 1, 0x3c, 1); - /* Function select - all disabled */ + /* + * 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. + */ vt82c686b_superio_cfg_write(s, 0, 0xe2, 1); - vt82c686b_superio_cfg_write(s, 1, 0x03, 1); + vt82c686b_superio_cfg_write(s, 1, 0x0f, 1); /* Floppy ctrl base addr 0x3f0-7 */ vt82c686b_superio_cfg_write(s, 0, 0xe3, 1); vt82c686b_superio_cfg_write(s, 1, 0xfc, 1); @@ -465,6 +502,21 @@ static void vt8231_superio_cfg_write(void *opaque, hwaddr addr, case 0xfd: /* ignore write to read only registers */ return; + case 0xf2: + data &= 0x17; + via_superio_devices_enable(sc, data); + break; + case 0xf4: + data &= 0xfe; + isa_serial_set_iobase(sc->superio.serial[0], data << 2); + break; + case 0xf6: + isa_parallel_set_iobase(sc->superio.parallel[0], data << 2); + break; + case 0xf7: + data &= 0xfc; + isa_fdc_set_iobase(sc->superio.floppy, data << 2); + break; default: qemu_log_mask(LOG_UNIMP, "via_superio_cfg: unimplemented register 0x%x\n", idx); @@ -513,12 +565,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,7 +572,6 @@ 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;