From patchwork Sat Jan 6 21:05:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13512806 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 8E817C46CD2 for ; Sat, 6 Jan 2024 21:08:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMDrd-0005YC-Ev; Sat, 06 Jan 2024 16:05:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rMDrb-0005XM-3G; Sat, 06 Jan 2024 16:05:51 -0500 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rMDrZ-000180-Ai; Sat, 06 Jan 2024 16:05:50 -0500 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-555144cd330so766719a12.2; Sat, 06 Jan 2024 13:05:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704575146; x=1705179946; 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=D6lhQ0IwMBM6MkkvGPL7lP2DjMoGA+jtLIjImN75v+fXb+GwXpbdxZ2gw3NVLRXiB7 vO4GgkC5fGZXlGdrZdwOUR9Drb1hJdgNp6hAZJg+aetezQhvzWyTerk+WVkmsI2ax6CX tmOup6tNLOZquX8nBHx5nT0JhQ6EIEIy+4TuuF4clRGxKI9akczEc+5MqFcNyWUlwkIX 5zoU8mYT0sM6N77UlHUEa6PCm+M3/ATfmNCP0/QPCm7IJGOaeTh8MNFHUaChf73c9DRO UGWqqcry9EHNtwQUEuSn5He66i4foVBwU1dXOqsyJ/uhOWlGrF007l/jZ6axCykb7CVX AsAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704575146; x=1705179946; 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=oakW2a0CtM31GQjhXKdrNIu7gq1tC3WxuvQrdWCFQMpnO2sbDCfZNZoHXNXgrCgo+I 2KBqWTomtxHhZTPPHXL6eO5frzdJLBssvx6lB2P3L9nm3B/pVEhFIg7clSnOxFZBurih iJp8mt6EO0u5eOeKeYwiYfl+SM9SKxg0mjkO4jVXf4v6ZnHqpt1PdbT5kiNqlRANWKbr dhlz4EGmsjKq94G2QOGUUxr7jnqa/5arOAD3DhRlMa3kl7mfIADCGHhOqcUkh7dvwFZk v9P05XjU/DK21YeIBi9a/WLExEnL/sWfAMpxTcdcfObF5loelTofHVf357fgQc+rFv13 uIQQ== X-Gm-Message-State: AOJu0YxeHMOe4jNsJ9XkJWeFlSdaiQjewB0jeK2q+ZSEQOJ6VwZyXhRk 2HNTRkDU3SMQxvMmBhirzW3NYiyizpw= X-Google-Smtp-Source: AGHT+IFvNpxU3KqeNE3EAiRL3EZ6yzxTOCnaezhIgQ8bDM0i2lcWRih+ZI7AqEo4G/08JhHZz7XmDQ== X-Received: by 2002:a50:8a93:0:b0:557:cee:5f38 with SMTP id j19-20020a508a93000000b005570cee5f38mr774098edj.5.1704575146039; Sat, 06 Jan 2024 13:05:46 -0800 (PST) Received: from archlinux.. (dynamic-077-011-174-094.77.11.pool.telefonica.de. [77.11.174.94]) by smtp.gmail.com with ESMTPSA id f20-20020a056402195400b005576f4471besm624922edz.42.2024.01.06.13.05.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 13:05:45 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Artyom Tarasenko , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Fabiano Rosas , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , John Snow , qemu-block@nongnu.org, Kevin Wolf , Thomas Huth , Richard Henderson , Nicholas Piggin , Aleksandar Rikalo , Peter Xu , BALATON Zoltan , Leonardo Bras , Paolo Bonzini , "Michael S. Tsirkin" , Juan Quintela , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, David Hildenbrand , Marcel Apfelbaum , Sergio Lopez , Hanna Reitz , Mark Cave-Ayland , =?utf-8?q?Herv=C3=A9_Pous?= =?utf-8?q?sineau?= , Bernhard Beschow Subject: [PATCH v4 01/11] hw/block/fdc-isa: Move portio_list from FDCtrl to FDCtrlISABus Date: Sat, 6 Jan 2024 22:05:21 +0100 Message-ID: <20240106210531.140542-2-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240106210531.140542-1-shentey@gmail.com> References: <20240106210531.140542-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=shentey@gmail.com; helo=mail-ed1-x532.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 Sat Jan 6 21:05:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13512798 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 8AE19C47074 for ; Sat, 6 Jan 2024 21:06:56 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMDre-0005aG-Km; Sat, 06 Jan 2024 16:05:54 -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 1rMDrd-0005YT-CJ; Sat, 06 Jan 2024 16:05:53 -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 1rMDrb-00018a-Kn; Sat, 06 Jan 2024 16:05:53 -0500 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2cd17a979bcso5594581fa.0; Sat, 06 Jan 2024 13:05:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704575148; x=1705179948; 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=ibqzl6xOqzXDApHiCdM4mwO3Tlg/v1oZzfSzY+YI4UFyFkyMOA7ApCwpic3LJkByD6 msrsZMJvupHxyjlzq4ksTg3OfW+mOMkl89Fqkv6LE9hBjp7w1pLvnIt3n94wjlCx2OIQ l/7KSXNn8qyg6XfJ70QtMb3hYCWotPKX2bNyGHbT+HhUMMBg2GMTXsYXfsk0fyahuj7j M19DCmD1yEYbUbel37/1wMALyHECsu93EwdK9G4V7vPlwxcWHGM1J77vA4PyAvpIU6+i BkZtip2RyevsdJs1T3ehRz8hAy13wHSsAFtI6a7L3Ts0Vy71/7x5uHFQHI9pkQHQZncU xyDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704575148; x=1705179948; 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=aOERpy0V1v1N21Q2zqmSPQ1nnqPrrgHegTU46MlBFljOuL+Hn2+LDnHHUL1TYDEFe2 Mcoc83qhfskDXXgFTTZT76TW9/Q8ZbSVLyUAtmZf+MjUoGeIDJp6mnz8NrWE4ZglNoJ2 1fmLIXzGJWLj5YNuDPbSgQG9afzODZeKM2C822jN8FDvEqo5SuNDhmRpHryXkdSakRpc qASjF5UVtA6p7QwrfVwWHjqCHV9VbkVjJo7lN/7ZvlhUgNqnhkaVIKy/ntzGaukcW6t1 SBeCC8agNNqCfQlscT6hXXHPogvgXoZDtQRcA/uVvZ35G6nKNxFQ0iMf0x0RFXNKqGGb 5dmQ== X-Gm-Message-State: AOJu0YzTXg7Co9b+vifeRtnYMo1k/8eM7BfRxpHNuzZTqsa0GWL++4Ik krPrKPOlGajsJsrtmT/jlhImISFO0D8= X-Google-Smtp-Source: AGHT+IHzE4IeiJR+Q85AjXB2FVM0Gdzjh6JaEkHPuINONpCi1dNx01zUuHHd21CoyijjkXT5rW5Aeg== X-Received: by 2002:a05:6512:e91:b0:50e:6202:dad6 with SMTP id bi17-20020a0565120e9100b0050e6202dad6mr287912lfb.142.1704575147700; Sat, 06 Jan 2024 13:05:47 -0800 (PST) Received: from archlinux.. (dynamic-077-011-174-094.77.11.pool.telefonica.de. [77.11.174.94]) by smtp.gmail.com with ESMTPSA id f20-20020a056402195400b005576f4471besm624922edz.42.2024.01.06.13.05.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 13:05:47 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Artyom Tarasenko , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Fabiano Rosas , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , John Snow , qemu-block@nongnu.org, Kevin Wolf , Thomas Huth , Richard Henderson , Nicholas Piggin , Aleksandar Rikalo , Peter Xu , BALATON Zoltan , Leonardo Bras , Paolo Bonzini , "Michael S. Tsirkin" , Juan Quintela , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, David Hildenbrand , Marcel Apfelbaum , Sergio Lopez , Hanna Reitz , Mark Cave-Ayland , =?utf-8?q?Herv=C3=A9_Pous?= =?utf-8?q?sineau?= , Bernhard Beschow Subject: [PATCH v4 02/11] hw/block/fdc-sysbus: Move iomem from FDCtrl to FDCtrlSysBus Date: Sat, 6 Jan 2024 22:05:22 +0100 Message-ID: <20240106210531.140542-3-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240106210531.140542-1-shentey@gmail.com> References: <20240106210531.140542-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 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 Sat Jan 6 21:05:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13512796 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 744F1C46CD2 for ; Sat, 6 Jan 2024 21:06:56 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMDrg-0005bF-Gm; Sat, 06 Jan 2024 16:05:56 -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 1rMDre-0005aF-Fg; Sat, 06 Jan 2024 16:05:54 -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 1rMDrc-00018w-SR; Sat, 06 Jan 2024 16:05:54 -0500 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-55778f7662bso443992a12.1; Sat, 06 Jan 2024 13:05:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704575150; x=1705179950; 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=MNiJfEmSezxWQKi6ifbpvLqhZPRwT05aXo9RuVFC8WZMypV514YTtR6xjqgl2k7mXW 8DPArYBitmsFJerzVWW1cjP/S7SoJhhjqkz3VuW011UkUtamWxEQY2gx51cw14xBQYHI gNVwYAC8RVwGeYpaS0q7s+23G5zJEj3j/u0IKDk+kNTXQfjP0aMJEhH4Y7zuUGIYpKzA pqusrY8MmMhZ7wqzgPdY0hOoafqdRUsBMEQoGqzvSRtlMK8THn/drv6KvFR4vIr11adD wKtTkJfZnN7AXv8rb+uz/st41zSCNjew1rfRPpTNevpdjhSSrf4hOS6oT7lV3FcWvpgL VMPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704575150; x=1705179950; 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=LsqUDRX/GGhxiPh/hMbmiqHN1FRFNZPTTAPbDWiC6kST9SMxgJ4oV6pQztAPuFJ5Im VzdPlR4rESqJQZJoZgB2foypfCXA0VIPfc7Pki1KJcbPN9UH7KXaHZDcUn84YJWCscvT 05e/X3+XA/bd8SCaBxMoYrIW0Cq0XfbozhSnjip0BWmkhCrcSfYmu1D/Usv6vrRkH0wR kRSWsA1g6BXP7lbu/uSVulFv4miPUJsDeWn2eO4tarPOZljIcdzqnGTeTR+DFUPXHAW+ 0klcdJ/FIfU+i+qY8Rv9elOBrxgiPnRgYa+Pz8HXENgArvgsiI4PJQrANvPpBFr75tZ2 IbCw== X-Gm-Message-State: AOJu0Yyt0t975PSt9CRtu8JSmHh+yHk3bMDgOz6RrzAcjwZPawmH0UzS Ub9s8K3cB6bslH8L//9rPRTT6a8BNKo= X-Google-Smtp-Source: AGHT+IEPygpyBoxm/Okl0EbRqcvKq1fg2xBH35wVgGDfSoYMFXQq4sFNMTleAKNtjAaafowjmLssWg== X-Received: by 2002:a05:6402:3584:b0:557:1cde:812f with SMTP id y4-20020a056402358400b005571cde812fmr3781465edc.8.1704575149956; Sat, 06 Jan 2024 13:05:49 -0800 (PST) Received: from archlinux.. (dynamic-077-011-174-094.77.11.pool.telefonica.de. [77.11.174.94]) by smtp.gmail.com with ESMTPSA id f20-20020a056402195400b005576f4471besm624922edz.42.2024.01.06.13.05.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 13:05:49 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Artyom Tarasenko , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Fabiano Rosas , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , John Snow , qemu-block@nongnu.org, Kevin Wolf , Thomas Huth , Richard Henderson , Nicholas Piggin , Aleksandar Rikalo , Peter Xu , BALATON Zoltan , Leonardo Bras , Paolo Bonzini , "Michael S. Tsirkin" , Juan Quintela , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, David Hildenbrand , Marcel Apfelbaum , Sergio Lopez , Hanna Reitz , Mark Cave-Ayland , =?utf-8?q?Herv=C3=A9_Pous?= =?utf-8?q?sineau?= , Bernhard Beschow Subject: [PATCH v4 03/11] hw/char/parallel: Move portio_list from ParallelState to ISAParallelState Date: Sat, 6 Jan 2024 22:05:23 +0100 Message-ID: <20240106210531.140542-4-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240106210531.140542-1-shentey@gmail.com> References: <20240106210531.140542-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 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 Sat Jan 6 21:05:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13512799 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 10CCEC46CD2 for ; Sat, 6 Jan 2024 21:07:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMDri-0005d8-Q5; Sat, 06 Jan 2024 16:05:58 -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 1rMDrg-0005bp-RS; Sat, 06 Jan 2024 16:05:56 -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 1rMDrf-00019M-1Y; Sat, 06 Jan 2024 16:05:56 -0500 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2ccabf5a4beso5467971fa.2; Sat, 06 Jan 2024 13:05:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704575152; x=1705179952; 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=XEIb5HsFdQquUOCJ5vytLm0aBmLn5nH+8ng6zYlv9+kASKNmHFNeTv5CptW9f0PTMW B4ECioAmBbxrWmIX4CtJlrp5+Ln4iiUIJ2gExVIdv1/WYBvs7FUCJhFcXCKYmn+LLymo Ff3aIiQHI7ZEdv2i/oTzbYFqrSF6x61o5EBL4uhluqOrjlw5bWcOPa4DAg3ET1bXf9Qn hDOuUf8oBd16IPu71FLmtTkveldI8QPzDrjH9mDihnOj/U7aW9KJFGxUnCD39FdbhTmv MF8JMv415wOUkVasPPpsdeTCrdWLLllHWXVjWf4CW9wlVpsQ4+EP3i27rfYC/AXrSxS8 LfJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704575152; x=1705179952; 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=Q9Ys+hjXW/eKBBUpp26FtEUadoi2lzXDrXPpHJdi0aLBzp9lpWzRbfUgjtzNIN7Vo8 APEPJ4ZEDQL9nFtrfEyGokKSkL4JyMZyjyKeV6tzGCtSpnYbGfW0Aqm/UX4clpImmu/W 3R7fcMXWvJOFo9huBlGJFOvp/NX+mZKqCHnT5rl/aAIvtDoj0bu7ofBZFI1gh9HNGRRn 2tAYlVrQta062h2Ozn4XgZtCRLUrhpJNPI6HWmLwaenw6XQNvgUW1ppwOlXobvDk5Qez Kt2Kga+qvKqv8tfbgqUnggG0NXYvbjd6vinpzbsDik0ZNUS/XC8hpHJ3fmWlyhjY5G9d 2jEA== X-Gm-Message-State: AOJu0YzW7qE+5bmMISMgcsW9IdKSBsDk3/Cg26sWmbf3ijFgOPeGoKHE oPV/TCS8upNOvEQdgQHRE0SFGIr1Fto= X-Google-Smtp-Source: AGHT+IFNjD5sQIPeMGd/1cWzvaGT9Us26llRzYnA3++xOIZ5ZxXphK1jYmYK41FgbR+YQ72FxNzjjw== X-Received: by 2002:a2e:848d:0:b0:2cd:475:18f3 with SMTP id b13-20020a2e848d000000b002cd047518f3mr270134ljh.126.1704575151810; Sat, 06 Jan 2024 13:05:51 -0800 (PST) Received: from archlinux.. (dynamic-077-011-174-094.77.11.pool.telefonica.de. [77.11.174.94]) by smtp.gmail.com with ESMTPSA id f20-20020a056402195400b005576f4471besm624922edz.42.2024.01.06.13.05.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 13:05:51 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Artyom Tarasenko , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Fabiano Rosas , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , John Snow , qemu-block@nongnu.org, Kevin Wolf , Thomas Huth , Richard Henderson , Nicholas Piggin , Aleksandar Rikalo , Peter Xu , BALATON Zoltan , Leonardo Bras , Paolo Bonzini , "Michael S. Tsirkin" , Juan Quintela , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, David Hildenbrand , Marcel Apfelbaum , Sergio Lopez , Hanna Reitz , Mark Cave-Ayland , =?utf-8?q?Herv=C3=A9_Pous?= =?utf-8?q?sineau?= , Bernhard Beschow Subject: [PATCH v4 04/11] exec/ioport: Resolve redundant .base attribute in struct MemoryRegionPortio Date: Sat, 6 Jan 2024 22:05:24 +0100 Message-ID: <20240106210531.140542-5-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240106210531.140542-1-shentey@gmail.com> References: <20240106210531.140542-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 Sat Jan 6 21:05:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13512801 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 DC2FDC46CD2 for ; Sat, 6 Jan 2024 21:07:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMDrk-0005e2-JE; Sat, 06 Jan 2024 16:06:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rMDri-0005d7-Mp; Sat, 06 Jan 2024 16:05:58 -0500 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rMDrg-00019t-Vo; Sat, 06 Jan 2024 16:05:58 -0500 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5537114380bso521018a12.3; Sat, 06 Jan 2024 13:05:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704575154; x=1705179954; 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=kG124pNvvBBXgKdlbUVv3P9Lf23amA2OJTnuBGJK5a5o/561v+FJnJpgDaWicP3CpJ 6u15MwAx2FKlB03P2QHe9h+GzQLjFdHXN34OsyDxBCIxtIgp3B5FdNymXZVL6JKd1ueR 7fiOOpr4rJeCdt2ZJlOcKswYW2w3Gh+CMlVf0x4LlDe+lKdmOX6eLi4sxaV2hfkfBWXi E1TcU1/NU/ye5NhjVBS2tnPydZsVl9LC//LBpGVEN/x4da7VMgF9aVD4rSaumOjC9DFf RM6zVbeqkRUCDcBvTTXF/rrLGwV3yVdlsFI09g74BW+AQxC8H5up3Tk598gm5KDk4Voh CV+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704575154; x=1705179954; 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=dbqGNJMcnQhOd0Ngm/j2Jnp/6Zlj11FuEIFd2NMfxtGpMtD1yRf3SbWuhbPNzSUvFu eSjR5u18m5YWk+ud5UcDLMe0XEgSeR03ZCVarfXhU78IKZbXNjv5d9EXKPQWJiBHIt86 sPFPoXD0hz1C7tbzohl03s5B6yhVW9riEn/zcz88n566Nrr+joGEXKp1Nu/onYDDJHuY yKQ41KTbni5XNYvgLkcJTu0wTaBTt/3aNkEJExpDBLi5raJiBJMPNL7MPBdWB0FShw1Q x4lHE4S6x3pNfeCwYghXBJPta3QTPH2J+d+wt3TEry7f0pBlaRol8YIP60G/m33nRXy4 sprw== X-Gm-Message-State: AOJu0YzGJnT8nZQzjkeRoDiDhk96Kw6uPyL3h1124leVSj2YzGK+SQY7 zbT1nJlgCBstjF167or69jaivh5R3aM= X-Google-Smtp-Source: AGHT+IENYIdxkdE1rCadPLo6XT+K1UXZvjSx71X6xdpeqC7Tk6nq9C4EpM/rJQWJE/jx/bAszQ9TcQ== X-Received: by 2002:a50:a68b:0:b0:557:1006:40a8 with SMTP id e11-20020a50a68b000000b00557100640a8mr761463edc.5.1704575153946; Sat, 06 Jan 2024 13:05:53 -0800 (PST) Received: from archlinux.. (dynamic-077-011-174-094.77.11.pool.telefonica.de. [77.11.174.94]) by smtp.gmail.com with ESMTPSA id f20-20020a056402195400b005576f4471besm624922edz.42.2024.01.06.13.05.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 13:05:53 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Artyom Tarasenko , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Fabiano Rosas , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , John Snow , qemu-block@nongnu.org, Kevin Wolf , Thomas Huth , Richard Henderson , Nicholas Piggin , Aleksandar Rikalo , Peter Xu , BALATON Zoltan , Leonardo Bras , Paolo Bonzini , "Michael S. Tsirkin" , Juan Quintela , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, David Hildenbrand , Marcel Apfelbaum , Sergio Lopez , Hanna Reitz , Mark Cave-Ayland , =?utf-8?q?Herv=C3=A9_Pous?= =?utf-8?q?sineau?= , Bernhard Beschow Subject: [PATCH v4 05/11] exec/ioport: Add portio_list_set_address() Date: Sat, 6 Jan 2024 22:05:25 +0100 Message-ID: <20240106210531.140542-6-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240106210531.140542-1-shentey@gmail.com> References: <20240106210531.140542-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=shentey@gmail.com; helo=mail-ed1-x533.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 Sat Jan 6 21:05:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13512804 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 B3A61C46CD2 for ; Sat, 6 Jan 2024 21:08:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMDrm-0005ei-QK; Sat, 06 Jan 2024 16:06:02 -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 1rMDrl-0005eI-77; Sat, 06 Jan 2024 16:06:01 -0500 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rMDri-0001AI-BD; Sat, 06 Jan 2024 16:06:00 -0500 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-554fe147ddeso699716a12.3; Sat, 06 Jan 2024 13:05:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704575155; x=1705179955; 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=VAvM5leyQE6vhP4jRn0s/a/Z7ewPozeTUBWESN6j5dqp02wtXqDpAT5GEqM6bNoGiG d99wWchDxu13Tcq7mNE89D9zMyZ5gtw5FfOe/n22iwzSs22+iQ0mtX2LQa9f4waz3YF0 JiC4C7ku0LOFZeO1eeVR1yHwu3ifgAT0kocKzAjGQVzVaCS1Nfa0UqjUjqZDhuyv3cAW EOsNVosG/rcS9xAX2qKyYMKUBGwMl4Rv6EZLnnxFvMtXQBeRzfRguBc93MEaNvVSAogU 8ErWW4tE/1YZLbogntgG55dHEdAWHpdynk/l5+69CmwaQ2+kZrskDO14z9OSxQyDdSFr wDeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704575155; x=1705179955; 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=LG+lChS91Hjym7D/sZaKVAOLmwyxe+4qOSWH18aYh7WHT9x3ccJmbHXS9Doz0B5KYH er6tv14XIVaehrZKJZUY/7fVVPGM19CWj1On8L9tBZBdXgeMpWLrjDMLSpFMZRgubEqO 3RQVKyBD9jFeiL417IAXarvx+KcLBoD3DAH+Hh6LZly1jc8hPT7ay4qeKp8lsBTAgOiE UxY4k3xa1EVfyKBWZFVfZvzx6EABo+qk3+4Tgm2TeJGlJUUxCa9umz0dvAQrPZI47V8r 4/zZGgqNc9m2MtN1F7U9+Fl8DZxTp9k/4J21QJ4hYvdEAssVFp4QRcZqWu7WIQv88ecW /86g== X-Gm-Message-State: AOJu0YwmSziBswQekAFL6Gr+eRyMiQ5yzPy4w+VgRmNMHKmSmeY/ZM5v FZtR8V7502E/kLeGe9t6iy6PAG6SYIo= X-Google-Smtp-Source: AGHT+IG0QVo0nfdw4Hc/7KoEBaE/DajehiPo/GEWgPzwVaGDHw6ipDxYRpPwKdt83hwXu7V76vbYDQ== X-Received: by 2002:a50:955a:0:b0:557:2c3e:206a with SMTP id v26-20020a50955a000000b005572c3e206amr619482eda.0.1704575155608; Sat, 06 Jan 2024 13:05:55 -0800 (PST) Received: from archlinux.. (dynamic-077-011-174-094.77.11.pool.telefonica.de. [77.11.174.94]) by smtp.gmail.com with ESMTPSA id f20-20020a056402195400b005576f4471besm624922edz.42.2024.01.06.13.05.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 13:05:55 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Artyom Tarasenko , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Fabiano Rosas , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , John Snow , qemu-block@nongnu.org, Kevin Wolf , Thomas Huth , Richard Henderson , Nicholas Piggin , Aleksandar Rikalo , Peter Xu , BALATON Zoltan , Leonardo Bras , Paolo Bonzini , "Michael S. Tsirkin" , Juan Quintela , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, David Hildenbrand , Marcel Apfelbaum , Sergio Lopez , Hanna Reitz , Mark Cave-Ayland , =?utf-8?q?Herv=C3=A9_Pous?= =?utf-8?q?sineau?= , Bernhard Beschow Subject: [PATCH v4 06/11] exec/ioport: Add portio_list_set_enabled() Date: Sat, 6 Jan 2024 22:05:26 +0100 Message-ID: <20240106210531.140542-7-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240106210531.140542-1-shentey@gmail.com> References: <20240106210531.140542-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=shentey@gmail.com; helo=mail-ed1-x532.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 Sat Jan 6 21:05:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13512797 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 77D3BC4707C for ; Sat, 6 Jan 2024 21:06:56 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMDrq-0005gL-2j; Sat, 06 Jan 2024 16:06:06 -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 1rMDrn-0005fH-Qf; Sat, 06 Jan 2024 16:06:04 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rMDrm-0001Af-8D; Sat, 06 Jan 2024 16:06:03 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3368abe1093so631412f8f.2; Sat, 06 Jan 2024 13:06:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704575158; x=1705179958; 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=OJTvaIsE03wJqP0DmNEqYo7PrFR+epFXHRFVbJJAUABbwbkg4nxgf7met5CgSAt47U dF6/9YuLwIynNT3H7nqrg0DS6OrSy8N4yFdJ9qt3PhoLS3+1nBnpxZCDLM9HxAtwKnRi bcjV8Up+9Lqj4Gy+Mwoh0GNyM+DMlEQwfZcbHypfP6Y26DQ4DcgMtyC5lFVhsFfcj4JO mEQN2DIMSDtuhgmvj2l560anQNJd3Cn4rereLwgUXCFI4Bfnl30hykLw6xMm/qEey9Zr EmK6IP1T9F4rCyx9lOaDX6V7FUWKTpYbTU+7NFv4wSNaR7kUWlRL24M1OBUBpM+H74t6 svLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704575158; x=1705179958; 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=o/YTnULqwX30XZTsSkX7Ke3+yfUv2Uw4ik8YoLYD76EC+LoO61rQ4kUnylHI+zI72G p3xlu3vLZ32i2kVPWvhvJZ4FQnY2aFr2gbHADTqOT9tqdRrtOI0aHcsmrsOCBLYgyyv4 2a2mHeknGhBMIvM2bkmPNkRHI5o1T/YJychBEZ8ukWCWHOd+73cQaVVMK17ibLHf2ZCB gWLx3FUXQfl3HZwXmDswJwG21KBwEbF6ql+C55JgwL69CoNX+PUv/k5dc3FTe5nYWR28 /4qxRqK2331yoa3yxU1+Hdx4TuqysmFywaJc64hno99WSDAJBP+QB98sDMiR9Ykx/+wT QPcQ== X-Gm-Message-State: AOJu0Yyh/ADlgzRlTrSL8216yNLR28ueWk1oAcqJ26J2eHXWGK4DcxjW PaJiI46lYtXX9cUTmkj9hIMGsvbJSbE= X-Google-Smtp-Source: AGHT+IHhalljsJT/0csqKr/rwDF2CMzpSFNjT0vQQ4dyeFph8JRw6xTd8IWJO/gC+R9KNpRWhxPiHg== X-Received: by 2002:adf:fe03:0:b0:336:5f08:bbe0 with SMTP id n3-20020adffe03000000b003365f08bbe0mr700600wrr.101.1704575157677; Sat, 06 Jan 2024 13:05:57 -0800 (PST) Received: from archlinux.. (dynamic-077-011-174-094.77.11.pool.telefonica.de. [77.11.174.94]) by smtp.gmail.com with ESMTPSA id f20-20020a056402195400b005576f4471besm624922edz.42.2024.01.06.13.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 13:05:57 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Artyom Tarasenko , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Fabiano Rosas , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , John Snow , qemu-block@nongnu.org, Kevin Wolf , Thomas Huth , Richard Henderson , Nicholas Piggin , Aleksandar Rikalo , Peter Xu , BALATON Zoltan , Leonardo Bras , Paolo Bonzini , "Michael S. Tsirkin" , Juan Quintela , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, David Hildenbrand , Marcel Apfelbaum , Sergio Lopez , Hanna Reitz , Mark Cave-Ayland , =?utf-8?q?Herv=C3=A9_Pous?= =?utf-8?q?sineau?= , Bernhard Beschow Subject: [PATCH v4 07/11] hw/block/fdc-isa: Implement relocation and enabling/disabling for TYPE_ISA_FDC Date: Sat, 6 Jan 2024 22:05:27 +0100 Message-ID: <20240106210531.140542-8-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240106210531.140542-1-shentey@gmail.com> References: <20240106210531.140542-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=shentey@gmail.com; helo=mail-wr1-x435.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 Sat Jan 6 21:05:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13512800 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 9242AC47074 for ; Sat, 6 Jan 2024 21:07:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMDro-0005fp-Op; Sat, 06 Jan 2024 16:06:04 -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 1rMDrn-0005ev-D2; Sat, 06 Jan 2024 16:06:03 -0500 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rMDrl-0001Ai-SZ; Sat, 06 Jan 2024 16:06:03 -0500 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5576fd0ded7so412300a12.0; Sat, 06 Jan 2024 13:06:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704575159; x=1705179959; 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=bdpwCToRsGOSXQnrJy0laaxQgKwYM4xwd+OAo8RCCLjugKnJb+mX2XiGRZ23Qvgyrb AXJqlPElryp9cEB6lwePkteDGmp51l3qlvrmVT5XZJeV7jHw8bz/W1fisvZyYqBOzsgO UhH3gOqWEsj1kd09KJvmyWPlA7Ew3nNjpqZet9Z3uggElSjpeHJ1zZjOrmsMax6NkOQj liejEM61u9Tk2gksQ0GpknQWSUxAu6W44o/DLRPzxbC/ot2K48ppTS0EW42JGmecWmLd JWmEV2A3pFvwH2NV/nziRzUkOr9D4clMB1nZVZnn3/mvEmt//IAcQ0p25AHGxf7GarvP gTAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704575159; x=1705179959; 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=o3K700/VL6BXrvvhMaAoYXuVp1t+bTtKfQWGSe31bGJxSKRu2w+xzB+nH8oyjOvzRv ZNeu8yTJEa9CTBeg4pLIn2SPPK495EG0wt4CPEqyg231KdgHmHkPhr6ggutSbqCyOd7l fv4W+kNsgmrZsbu3FE4PgdDVBvNh4NrORN1udqIp26piXHmoLyT+c2pNvqdxyVg59OH1 xk4PYnB3t9HrIzu15WyIih1PWcIVmWnwnib2R5icnPohddq9ffKHnLe6onn5jJo8R8os TZQfxYEcgLbGctfaNLarruKJQDlXG0YgZIusTKDf2mt2bKi6g1T7rPKFwyt7v0jG+7lH W0uA== X-Gm-Message-State: AOJu0YwUW0ag8ymWv/h3NgOmp/YCjv7IC7g3NhTKOQS7nvpJoXGr0aEJ 62ZOjCzrlQJJlVU2aAg4n911yGkde9k= X-Google-Smtp-Source: AGHT+IELw8mPxKFc41Q8uSbl5gicbbEH8EpGDEMqaJFg+sXFiIQ7hN7Fvfa0BLQAWVt8elDR2pE5jw== X-Received: by 2002:a50:d7d7:0:b0:557:7c2:1114 with SMTP id m23-20020a50d7d7000000b0055707c21114mr524894edj.171.1704575159369; Sat, 06 Jan 2024 13:05:59 -0800 (PST) Received: from archlinux.. (dynamic-077-011-174-094.77.11.pool.telefonica.de. [77.11.174.94]) by smtp.gmail.com with ESMTPSA id f20-20020a056402195400b005576f4471besm624922edz.42.2024.01.06.13.05.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 13:05:58 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Artyom Tarasenko , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Fabiano Rosas , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , John Snow , qemu-block@nongnu.org, Kevin Wolf , Thomas Huth , Richard Henderson , Nicholas Piggin , Aleksandar Rikalo , Peter Xu , BALATON Zoltan , Leonardo Bras , Paolo Bonzini , "Michael S. Tsirkin" , Juan Quintela , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, David Hildenbrand , Marcel Apfelbaum , Sergio Lopez , Hanna Reitz , Mark Cave-Ayland , =?utf-8?q?Herv=C3=A9_Pous?= =?utf-8?q?sineau?= , Bernhard Beschow Subject: [PATCH v4 08/11] hw/char/serial-isa: Implement relocation and enabling/disabling for TYPE_ISA_SERIAL Date: Sat, 6 Jan 2024 22:05:28 +0100 Message-ID: <20240106210531.140542-9-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240106210531.140542-1-shentey@gmail.com> References: <20240106210531.140542-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=shentey@gmail.com; helo=mail-ed1-x533.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 Sat Jan 6 21:05:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13512805 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 9FB7BC47074 for ; Sat, 6 Jan 2024 21:08:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMDrr-0005if-Up; Sat, 06 Jan 2024 16:06:07 -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 1rMDrp-0005gO-Vq; Sat, 06 Jan 2024 16:06:06 -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 1rMDro-0001B7-Cb; Sat, 06 Jan 2024 16:06:05 -0500 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-554fe147ddeso699752a12.3; Sat, 06 Jan 2024 13:06:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704575161; x=1705179961; 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=dQ6Sbkj/jhYOmhqYCQ7QuApRs9soCMHda5EgaqnFOEl3fCOkE8dw4QpnAOOQbqz3ws CzV9MIwzHp9IbeUD1a8AitK9/iX9vv5nAFo1fSdfIFTt7wIeRVRdngc5YYVOlnLBnM8x U2s0kwSOGzmSqvf45lIXQ15ngRguHyJv1CSZPHVqGsK9sXkwtxiWN25A2+8Roh72kXiN gGm/n/R3DVLNaDYHyvUfWriuZOiLUf185sxiqzwSy+F2qavy9gbNbaFJgjTW4KBc9T2W lj4p9XrA3w2hBYxj4go5SAJ7mheqc3xTASG2TT2tU+6XhOmzopXRL0DMb4VCRdxBvxo2 bO3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704575161; x=1705179961; 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=D0YQeaLcjWY4hbc15x1ISqCmZEG8X7di1l5+CggMrQJVatJPuNIsgHsogySgJ57PmW 4thmDwMs0yO/Zz37aK6PzJCbIzcuDNsZHPpawytdPjjnUx3NEjypDZk3T1UB3I57wgGo g/Qy1BH0WvUhZWjKHVIs2zRPLMNiv7jjyfIMxJMpfB0cpweRSMxozBPkoKZIzKhSSisS nvmhiUh7vs63iTbjHqn4zcjkTMd+fw9WEl2QnVDGFTO1KimPwRrITvEQGff9E/JHg5iM ZtQU+5o8Svqapc54p8JDIoiIJTT5pxfq+1KwxDYM68iLIbdIcaN8MblcziuR7rOSgTe0 8Biw== X-Gm-Message-State: AOJu0YwUhxuLT2/xjat9qV/eb0rekB1C8Jk2eNegtVNXAVDWUV8TbemJ o/eQdRpOsjmEdDC0wQfweb9RePeX61k= X-Google-Smtp-Source: AGHT+IFifs91QStc18KDRYn+mCVXA1173sWpbHPJyqCQAfvLTfGDTDLiK4Jn9Dbn1N/T5MSrbigOyw== X-Received: by 2002:a50:8d4f:0:b0:54c:d9c5:f9ef with SMTP id t15-20020a508d4f000000b0054cd9c5f9efmr454637edt.8.1704575161062; Sat, 06 Jan 2024 13:06:01 -0800 (PST) Received: from archlinux.. (dynamic-077-011-174-094.77.11.pool.telefonica.de. [77.11.174.94]) by smtp.gmail.com with ESMTPSA id f20-20020a056402195400b005576f4471besm624922edz.42.2024.01.06.13.05.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 13:06:00 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Artyom Tarasenko , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Fabiano Rosas , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , John Snow , qemu-block@nongnu.org, Kevin Wolf , Thomas Huth , Richard Henderson , Nicholas Piggin , Aleksandar Rikalo , Peter Xu , BALATON Zoltan , Leonardo Bras , Paolo Bonzini , "Michael S. Tsirkin" , Juan Quintela , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, David Hildenbrand , Marcel Apfelbaum , Sergio Lopez , Hanna Reitz , Mark Cave-Ayland , =?utf-8?q?Herv=C3=A9_Pous?= =?utf-8?q?sineau?= , Bernhard Beschow Subject: [PATCH v4 09/11] hw/char/parallel-isa: Implement relocation and enabling/disabling for TYPE_ISA_PARALLEL Date: Sat, 6 Jan 2024 22:05:29 +0100 Message-ID: <20240106210531.140542-10-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240106210531.140542-1-shentey@gmail.com> References: <20240106210531.140542-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 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 Sat Jan 6 21:05:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13512802 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 C89A5C47074 for ; Sat, 6 Jan 2024 21:07:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMDru-0005kH-4F; Sat, 06 Jan 2024 16:06: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 1rMDrr-0005hh-E4; Sat, 06 Jan 2024 16:06:07 -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 1rMDrp-0001BU-NZ; Sat, 06 Jan 2024 16:06:07 -0500 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-555e07761acso716881a12.0; Sat, 06 Jan 2024 13:06:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704575163; x=1705179963; 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=DgPDNcF8drqPgAcBBrzGxS/dfz5BBaz1q9H35ny5BTx2wS283LHzK+xjX0pCRqa7Pp 0dRt9+4mSiDvWIft7HAJmIbJ3VeqOiT6XaJ7ZsRQH1s7RDnVHsLqlFhftFItELV2NqHl tkZF42/1HiKn8nwbvcxln1dvX1u0RcFHAsYARVq6/Lmld2Q0PbVywcr3bNYduhgsE8JH 3EE6CvBQRuHKm0u7KofGET4gCkWJ+BuueVoSCYnhXRoKw63z5Bri1M3tujEqn43ZlH+v YcQyGgfRJK/8U0rzdaY5uXUeR4PDuU3HUWrfWqfm6XcrELbXkmxD/bQy2lTAOah2F7lD MmsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704575163; x=1705179963; 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=O9sP9I5ykDPHLSez4kWQKo2bMTvjtf9H4i4EuYcIzE77GbjTV5DRIhjFNEvcnKj8HS DjlXug4NK0ks3G0z8SEwZem6jqp63wrV94rPhYgZbwu5LKWYlrjT9cZDsNMtJHoakYJ2 lkvBbNiPJLW+CwktDqQ3+OQsWKclUZ9FrMYkLBxBGxppbnu2XvIzo3cyEJl7xhaTP0tR 2vyw6NJJ1ojQEBUJHnBJFLoOfcgA/uGGkyLPsWli4z3Td69XJsaRM8yNxvxEbRCzn1J8 qCrqHGZsuBK6a6bSe/gZUvysIBz3PiBC7TSQSrlUojcGwNWn5rtX2UOgyW4HXb0QjyxE czPQ== X-Gm-Message-State: AOJu0YxNHaW+1zrZuIu5LHDWuzMVK+c0KOHR9ezqM1gJ5cVhLwbwRki+ 76XgUnRCwQOXzQn3Xx+ZrvkIymlRlSM= X-Google-Smtp-Source: AGHT+IFMwTHj4D+JHoC4lxMaM3UMO8U5yzCZNNCv0vBsKo6BEwB7nI6hVlmYOq3JaNqbyow8FiTg+A== X-Received: by 2002:a05:6402:1cab:b0:556:9ccb:33c9 with SMTP id cz11-20020a0564021cab00b005569ccb33c9mr480617edb.111.1704575163282; Sat, 06 Jan 2024 13:06:03 -0800 (PST) Received: from archlinux.. (dynamic-077-011-174-094.77.11.pool.telefonica.de. [77.11.174.94]) by smtp.gmail.com with ESMTPSA id f20-20020a056402195400b005576f4471besm624922edz.42.2024.01.06.13.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 13:06:02 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Artyom Tarasenko , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Fabiano Rosas , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , John Snow , qemu-block@nongnu.org, Kevin Wolf , Thomas Huth , Richard Henderson , Nicholas Piggin , Aleksandar Rikalo , Peter Xu , BALATON Zoltan , Leonardo Bras , Paolo Bonzini , "Michael S. Tsirkin" , Juan Quintela , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, David Hildenbrand , Marcel Apfelbaum , Sergio Lopez , Hanna Reitz , Mark Cave-Ayland , =?utf-8?q?Herv=C3=A9_Pous?= =?utf-8?q?sineau?= , Bernhard Beschow Subject: [PATCH v4 10/11] hw/ppc/pegasos2: Let pegasos2 machine configure SuperI/O functions Date: Sat, 6 Jan 2024 22:05:30 +0100 Message-ID: <20240106210531.140542-11-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240106210531.140542-1-shentey@gmail.com> References: <20240106210531.140542-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 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 | 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 Sat Jan 6 21:05:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13512803 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 8052FC47074 for ; Sat, 6 Jan 2024 21:07:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMDrx-0005lo-D0; Sat, 06 Jan 2024 16:06: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 1rMDrt-0005kD-KJ; Sat, 06 Jan 2024 16:06:09 -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 1rMDrr-0001Bm-K9; Sat, 06 Jan 2024 16:06:09 -0500 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-55569b59f81so712691a12.1; Sat, 06 Jan 2024 13:06:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704575165; x=1705179965; 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=SQJaG4msRC45GYACTCpBnEbUr/gM4yroph6dN8fqHqA=; b=CeToJXJCVsM5A4x1ODEQdegoybpii6WhBFszdlUytzW8lU0FiFmQx8JTEC8YDaU5FN bkQGrpQZ1MnvZh2Rf7gW33Dl3cLnknXgrsB6di8O+wbsbEiNHav4FK+lwE2zCm4yKVZ/ NMi9fIPwunYieqqZYzizRUynnbqpbEsMjY2XiatIowRqLuDlT4aTDGkSSi9rAXC/bOYF ylfFsQYz90tkyeAxZh3+9pACGc9iPYHZxQ47ROO07TUBAkEx9grtQwde7iNV+phGo75V LBihRxEUOJLDn0ELz2c5KrkY6e2MHM5OswWoImevhPWCBMPswrIPZln00bDdHAbADMQc FDeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704575165; x=1705179965; 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=SQJaG4msRC45GYACTCpBnEbUr/gM4yroph6dN8fqHqA=; b=qjnlvtGTWFEXgF9FVlLFZ32s3G0V0TJ3p+K59xI0gBmImz8lIBZRE+WD1P3/dae17t 1l+VEWMptA526VwTnTM5pNO+ezcuan1KLDhTskBb6pnRj1kr642VaJINmFk7Z6/WwtJI N15TaZmwjKXdU6X7UYYnqXpQDTq7FbKmH0Ki8ws3iLGzKD1hmgktnYlyEDgKjc1MSg1s 8Y2qFJEucdeWb1Oj2OBiXRiG29RsKmPO0HOrP3ieTIwjXuRjqbfm6YCX6KFttXsGIaf1 8hHWDRnL6gZU3occaqruf0DJqnvNrs8Ngd7cITEXC6ky1GjK4u5rdCzaWrktNyc91OOV LdnA== X-Gm-Message-State: AOJu0YyPBxTErSHzmHTPFm+FbmGR5Tl7r7GQK6V0FPaoe038bFvWWAVh 2OmuuuYE3OEsYm7T8hZV9kh10uOfqeY= X-Google-Smtp-Source: AGHT+IGHvl3kLqrw8oxidii2FKoNPqAsLGE26Pd0E8SyNSaFrQB9sAIvjYn/nviADxKlgchv2NXXWQ== X-Received: by 2002:a50:9ead:0:b0:557:1a73:c91d with SMTP id a42-20020a509ead000000b005571a73c91dmr665802edf.9.1704575165074; Sat, 06 Jan 2024 13:06:05 -0800 (PST) Received: from archlinux.. (dynamic-077-011-174-094.77.11.pool.telefonica.de. [77.11.174.94]) by smtp.gmail.com with ESMTPSA id f20-20020a056402195400b005576f4471besm624922edz.42.2024.01.06.13.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 13:06:04 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Artyom Tarasenko , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Fabiano Rosas , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , John Snow , qemu-block@nongnu.org, Kevin Wolf , Thomas Huth , Richard Henderson , Nicholas Piggin , Aleksandar Rikalo , Peter Xu , BALATON Zoltan , Leonardo Bras , Paolo Bonzini , "Michael S. Tsirkin" , Juan Quintela , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, David Hildenbrand , Marcel Apfelbaum , Sergio Lopez , Hanna Reitz , Mark Cave-Ayland , =?utf-8?q?Herv=C3=A9_Pous?= =?utf-8?q?sineau?= , Bernhard Beschow Subject: [PATCH v4 11/11] hw/isa/vt82c686: Implement relocation and toggling of SuperI/O functions Date: Sat, 6 Jan 2024 22:05:31 +0100 Message-ID: <20240106210531.140542-12-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240106210531.140542-1-shentey@gmail.com> References: <20240106210531.140542-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 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 | 66 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 10 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index d3e0f6d01f..9f62fb5964 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,18 @@ 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); + size_t i; + + isa_parallel_set_enabled(s->superio.parallel[0], (data & 0x3) != 3); + for (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 +383,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 +428,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 +503,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 +566,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 +573,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;