From patchwork Sat Feb 4 15:10:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13128740 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 CECADC61DA4 for ; Sat, 4 Feb 2023 15:12:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOKBy-0002Oa-96; Sat, 04 Feb 2023 10:11: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 1pOKBw-0002NZ-4J; Sat, 04 Feb 2023 10:11:00 -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 1pOKBu-0006a3-Cu; Sat, 04 Feb 2023 10:10:59 -0500 Received: by mail-ej1-x634.google.com with SMTP id m2so22876227ejb.8; Sat, 04 Feb 2023 07:10:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7iycG/CYzi5qr7Pya6NhclvK6Ts8hrm+dv8CLlGtddE=; b=IL6I6keXxU5QiwlRSgq7W9jNNPgXuQ+RbXsuVIon+EsEhFk2Pz7ZetpZl5Py9AzYWO EbGSd+Op3hWJvy9nNbOTaGwb7xAjfRFTVutXM9RH49Ryc0hrr2LYNhTi85DL9fWvl+JL iymufPr/sGw39TNTaNoATAA1F48Sr0hJlZOQWY/Ui2471xJz8LF96f0Lr8yKOVE4DOBy uFm0ajU5i0CxXyncHv3ux45llDNPNsBfUAeqpyVXx7ej+HXxaFF93RcljYyG8rqn9BP6 rvEOv9nZCFEITBr/FigYg1oGLHAfXT3QjuShjJEU60owV3DtXu7ipCjZzfgpYe3lNs9c OYbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7iycG/CYzi5qr7Pya6NhclvK6Ts8hrm+dv8CLlGtddE=; b=NSnCGtqQ6sAgSdvpNfeu9ZSKIR4k/3MJaf8jmnMEc4VtTFSP2JeKtPueJvSWbpSzyL 3ZFKrDpREA7z4Zx38PE9s0hw24ndOHRFBN+qJZ4EGzxOzZ9JL+TAKrywTzkx0SavF61v DidBbQ6qZ8T1fosRI2qOgCDKCibBDp0Wf7DN5I12nNSHoB0sTDwI303ZKtgTYfSQqLlQ wxzJ5yccq8jSZwixRvdqwRd8GRaDdbhiKD3wtXu5k76JAWdsHix9VK6WCNjemUm4iviI kXNSjzePcJSKkOeOhhOhoGgokI5mefriBFktON4HJZqVCAAhwaQRaAwgKc6f0S0oRkEf RDXg== X-Gm-Message-State: AO0yUKXa7vUbuJ78iwJxwoA68GdO/DqwBPOIFS4DcXHvOz9qJUMS4GVk 1U4FLWVLPYPxON5f5jX9hd4O04NzXvc= X-Google-Smtp-Source: AK7set+HvxgNr+CeLGIYEV8hD5SgMiQsb06bB125tFisVIP6N+RrReltkNmig0jZ+FVVL+4xs/vKTQ== X-Received: by 2002:a17:907:8d16:b0:812:d53e:1222 with SMTP id tc22-20020a1709078d1600b00812d53e1222mr14342456ejc.31.1675523456421; Sat, 04 Feb 2023 07:10:56 -0800 (PST) Received: from localhost.localdomain (dynamic-077-183-077-083.77.183.pool.telefonica.de. [77.183.77.83]) by smtp.gmail.com with ESMTPSA id 17-20020a170906211100b0088a2aebb146sm2937922ejt.52.2023.02.04.07.10.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 07:10:56 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Thomas Huth , Richard Henderson , Eduardo Habkost , qemu-trivial@nongnu.org, BALATON Zoltan , Laurent Vivier , Sunil Muthuswamy , Marcel Apfelbaum , Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Bernhard Beschow Subject: [PATCH v3 1/9] hw/pci-host/i440fx: Inline sysbus_add_io() Date: Sat, 4 Feb 2023 16:10:19 +0100 Message-Id: <20230204151027.39007-2-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230204151027.39007-1-shentey@gmail.com> References: <20230204151027.39007-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=shentey@gmail.com; helo=mail-ej1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org sysbus_add_io() just wraps memory_region_add_subregion() while also obscuring where the memory is attached. So use memory_region_add_subregion() directly and attach it to the existing memory region s->bus->address_space_io which is set as an alias to get_system_io() by the pc machine. Signed-off-by: Bernhard Beschow Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé --- hw/pci-host/i440fx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 262f82c303..9c6882d3fc 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -27,6 +27,7 @@ #include "qemu/range.h" #include "hw/i386/pc.h" #include "hw/pci/pci.h" +#include "hw/pci/pci_bus.h" #include "hw/pci/pci_host.h" #include "hw/pci-host/i440fx.h" #include "hw/qdev-properties.h" @@ -217,10 +218,10 @@ static void i440fx_pcihost_realize(DeviceState *dev, Error **errp) PCIHostState *s = PCI_HOST_BRIDGE(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); - sysbus_add_io(sbd, 0xcf8, &s->conf_mem); + memory_region_add_subregion(s->bus->address_space_io, 0xcf8, &s->conf_mem); sysbus_init_ioports(sbd, 0xcf8, 4); - sysbus_add_io(sbd, 0xcfc, &s->data_mem); + memory_region_add_subregion(s->bus->address_space_io, 0xcfc, &s->data_mem); sysbus_init_ioports(sbd, 0xcfc, 4); /* register i440fx 0xcf8 port as coalesced pio */ From patchwork Sat Feb 4 15:10:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13128743 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 492AEC61DA4 for ; Sat, 4 Feb 2023 15:12:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOKBz-0002PB-4G; Sat, 04 Feb 2023 10:11:03 -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 1pOKBx-0002Nr-3x; Sat, 04 Feb 2023 10:11:01 -0500 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOKBv-0006aD-Ir; Sat, 04 Feb 2023 10:11:00 -0500 Received: by mail-ej1-x62d.google.com with SMTP id me3so22884470ejb.7; Sat, 04 Feb 2023 07:10:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LA6ZuoQya0s6wnCk3SNGbAuFteCxPNtvbIq0Ce0nCis=; b=YI88LN/t4Lm2N6GWYuEPcwEXt2SnegGrLFt2/87lYbqa2Net4cFpzGXIhbigG3ccRW H3HO7//L3eTZM6vd5f07KivEQBKA8+C3EKOP+jUPToZnRn0LCSe1cWUjYfEhP0W2KLOF eTkGrv0HUmjw0mVG7jny1hptyX0vDtexaDMzjfdv7IL8vWdHQzycevFkWygSiYVgvXDh J5OM+hOy4X+WHmu2dnXtM5891I2CXbOcdJxsZpgR5NGnEaXzDEEaGbwjjVkYAxfzFJbp BlZaUDXlJGHbsTB320dCPhlIbdAfRImfA4ST4cIWHK0qJ6dItNhoTthQMuxDJnU7ANs/ V3pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LA6ZuoQya0s6wnCk3SNGbAuFteCxPNtvbIq0Ce0nCis=; b=nlkGOsMIomFB0YUbkyi1SRY/4a8zJRa8Wz17n9T5bjcxX1qyRcPc3heZUafYJkSFwm xJAqBWiMbYBevU5p9U0CrLyy450ql5b+Ipc2898k7QoWyK8fT0uE8SFCXlX8qwmox0Xo k7y0cqzAu9rRvFq2JEkuuJgj4VG5OhLHnTWSYY1rpuVctQSWF7Au+c6jVdiJttGqS6hO Ox6zPzP6EbI9gmvW69C36CYyC3tvFGVqDOpgD9pxBzW8SkqvHaiRAsPmts2qBI4m91Wp q2UTMSc6+nsBVXX9ACwDmEyBu6J6z4+FQFiZcOr3j4Qp09PSMJXFBmC3cJar+MEhLSrl zz3A== X-Gm-Message-State: AO0yUKXFSRp7F2F8xe/Sa1I+jse+fbeW0H5kvZFVJx3Nz79l4PngLmtr akRdMWxE+iExZg0RpxzcEND1VoaRxuA= X-Google-Smtp-Source: AK7set+NjoLkA+OkSXzV8o5XGvFhc85fome84pNCw1nDoCgum8RSmxHIrnCy29s8M+V6ag3dE0bOaA== X-Received: by 2002:a17:906:9f06:b0:82e:a57b:cc9b with SMTP id fy6-20020a1709069f0600b0082ea57bcc9bmr4752073ejc.24.1675523457739; Sat, 04 Feb 2023 07:10:57 -0800 (PST) Received: from localhost.localdomain (dynamic-077-183-077-083.77.183.pool.telefonica.de. [77.183.77.83]) by smtp.gmail.com with ESMTPSA id 17-20020a170906211100b0088a2aebb146sm2937922ejt.52.2023.02.04.07.10.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 07:10:57 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Thomas Huth , Richard Henderson , Eduardo Habkost , qemu-trivial@nongnu.org, BALATON Zoltan , Laurent Vivier , Sunil Muthuswamy , Marcel Apfelbaum , Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Bernhard Beschow Subject: [PATCH v3 2/9] hw/pci-host/q35: Inline sysbus_add_io() Date: Sat, 4 Feb 2023 16:10:20 +0100 Message-Id: <20230204151027.39007-3-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230204151027.39007-1-shentey@gmail.com> References: <20230204151027.39007-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=shentey@gmail.com; helo=mail-ej1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org sysbus_add_io() just wraps memory_region_add_subregion() while also obscuring where the memory is attached. So use memory_region_add_subregion() directly and attach it to the existing memory region s->mch.address_space_io which is set as an alias to get_system_io() by the q35 machine. Signed-off-by: Bernhard Beschow Reviewed-by: Thomas Huth --- hw/pci-host/q35.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 26390863d6..fa05844319 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -50,10 +50,12 @@ static void q35_host_realize(DeviceState *dev, Error **errp) Q35PCIHost *s = Q35_HOST_DEVICE(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); - sysbus_add_io(sbd, MCH_HOST_BRIDGE_CONFIG_ADDR, &pci->conf_mem); + memory_region_add_subregion(s->mch.address_space_io, + MCH_HOST_BRIDGE_CONFIG_ADDR, &pci->conf_mem); sysbus_init_ioports(sbd, MCH_HOST_BRIDGE_CONFIG_ADDR, 4); - sysbus_add_io(sbd, MCH_HOST_BRIDGE_CONFIG_DATA, &pci->data_mem); + memory_region_add_subregion(s->mch.address_space_io, + MCH_HOST_BRIDGE_CONFIG_DATA, &pci->data_mem); sysbus_init_ioports(sbd, MCH_HOST_BRIDGE_CONFIG_DATA, 4); /* register q35 0xcf8 port as coalesced pio */ From patchwork Sat Feb 4 15:10:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13128741 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 01FC0C636D3 for ; Sat, 4 Feb 2023 15:12:02 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOKBz-0002PN-Ud; Sat, 04 Feb 2023 10:11:03 -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 1pOKBy-0002Of-9P; Sat, 04 Feb 2023 10:11:02 -0500 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOKBw-0006aO-Om; Sat, 04 Feb 2023 10:11:01 -0500 Received: by mail-ej1-x62e.google.com with SMTP id hx15so22827396ejc.11; Sat, 04 Feb 2023 07:11:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XW7xO6YJKL9F4WjdLXKBwfmeW/OQ9/AIW0Vshsiq+Yw=; b=oKxEQj43Nb9bm/a9aS/FmKx1bBwsd/F2JsqsDgQBxIenn2ahRL79/tnlzTMffGDInm gs9IReEyQAMrCYnfvupBNGZt7kSY9gSycbaM2JqJGOz5tY+7XjQCV8nehYuhiNHY83oC aT99dS4O+alQIHGxtyZfPDMPHQ5W+TUjXgoYYe1l0TOlQ550+eJ3iLtj5OfF5QWmO7Fg iLFESZzAkPNGZcdmF5+HLJjb1+/99ePXnSwVEhNm5mCVb0FXPsIiw5ahep1HVpAm5CAP GB96WR2pflhdPoLFlaumDXnYywbdbHnfgdSZQv3Hz3xZAFT8QdFeXVfBA8rK2zUBOG5Y kJqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XW7xO6YJKL9F4WjdLXKBwfmeW/OQ9/AIW0Vshsiq+Yw=; b=B7e+nYYCCmMyVRF9v6KRpWqtp3QKYrS+CJCWmUHiWOngxnaPFx3ldMdH+etn0ifd/k YQrBVzYvUBy1dWfJuYTz3c0B4X072JaM2is5r390WaVYDQtPpeiHcGh6Y00PFNLeu5UI egGhwQxuMuHaoFUe+F4OocQvCfjF69G4E5tnJhryOGmbCc3fh3kfo+WTKwAmLKEjWQE5 eI1YWFjMEoOJL09OgvXDtYjhEILb2GgewFsd96CgMXDkcqA1Fq7tf7o4WG2sgwo+KvTU B+vZzjX63FNjbzEQnphURWpjmOejMYWHiUzRMz8H/UNkjhUVhgPrO4qBmjGxdVBDSvBl vTVg== X-Gm-Message-State: AO0yUKVhvclvmThwM7UebSGvi/iKsrtDZ+6+Uw8uSxBEF7mAR0luMlFV 3ognHL5MHz+ZFsIevOtVsTLqQg08gyc= X-Google-Smtp-Source: AK7set8tDojRDYPkEmcoQ2m/eTFJtcprMY04G6gaIjyCjMAEhpkr0SNGKBGci+gr3+oylNcz9uZsuw== X-Received: by 2002:a17:907:762e:b0:878:7650:469c with SMTP id jy14-20020a170907762e00b008787650469cmr14715186ejc.52.1675523459022; Sat, 04 Feb 2023 07:10:59 -0800 (PST) Received: from localhost.localdomain (dynamic-077-183-077-083.77.183.pool.telefonica.de. [77.183.77.83]) by smtp.gmail.com with ESMTPSA id 17-20020a170906211100b0088a2aebb146sm2937922ejt.52.2023.02.04.07.10.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 07:10:58 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Thomas Huth , Richard Henderson , Eduardo Habkost , qemu-trivial@nongnu.org, BALATON Zoltan , Laurent Vivier , Sunil Muthuswamy , Marcel Apfelbaum , Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Bernhard Beschow Subject: [PATCH v3 3/9] hw/i386/pc_q35: Reuse machine parameter Date: Sat, 4 Feb 2023 16:10:21 +0100 Message-Id: <20230204151027.39007-4-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230204151027.39007-1-shentey@gmail.com> References: <20230204151027.39007-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62e; envelope-from=shentey@gmail.com; helo=mail-ej1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Bernhard Beschow Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé --- hw/i386/pc_q35.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 66cd718b70..dee2b38474 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -218,7 +218,7 @@ static void pc_q35_init(MachineState *machine) pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory, pci_hole64_size); - object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host)); + object_property_add_child(OBJECT(machine), "q35", OBJECT(q35_host)); object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_RAM_MEM, OBJECT(ram_memory), NULL); object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_PCI_MEM, From patchwork Sat Feb 4 15:10:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13128749 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 872EBC636CC for ; Sat, 4 Feb 2023 15:13:39 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOKC1-0002Qx-8C; Sat, 04 Feb 2023 10:11:05 -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 1pOKBz-0002PC-8A; Sat, 04 Feb 2023 10:11:03 -0500 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOKBx-0006aD-Os; Sat, 04 Feb 2023 10:11:03 -0500 Received: by mail-ej1-x62d.google.com with SMTP id me3so22884680ejb.7; Sat, 04 Feb 2023 07:11:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bgVF//6qdegoQOeHpGSSVSFmoQkzYIklU+oVnDZbsfw=; b=DbPCJnl7LGlojoy4S3QAjfoXQNFhrZmYsE0pHK7RadL9aQtlbyQ2jGlLs4ozkNgGWC C5v+Ded2SApVICBpewp/LMEZ8VRv43Ash5g7ewekIrrafA+QobAXpI3FNeTBxu5J5Fuq ILXVME/R4asfk/Eeg5jppm4UkqovKUrxxHbHbOHGXQGlIH8gtq35jgKT5SK/4MjPoIdj zinF9S4e4mxhevkF+ge6msyxOZhQW2vsrBMk6B1pS8UKN80U894ORIXvRdszgp8IZwmZ Z4Qg1w2rCAktgVY+yIvm7IKA3s6GnUEUH/w/nbbyhLS/ENvVQ31Y7uqsbe+12RMYFpz7 9eBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bgVF//6qdegoQOeHpGSSVSFmoQkzYIklU+oVnDZbsfw=; b=RlGbRVfrQKn5Dc8+WRs2oFJRUexngVFeL8yO9yqWWtgQJUZAZIj7N7BMnTrCM99srF +m+akidphXjnxtvrcbkb2mPwSndqH1HlmmySPhK18fI4Yty25E18ilUr7MYwvzxY16x7 gnDtNCyBZudexdI5WW+YUpzpf3xIc9JseaH0Jv6vzeAhLM7Xjp8JH9PZlaM7vDnw9KQV GhMztEbmzpZcbX98iSRqRcdiIrn4+HRi4M1I0nelssR8t+5rCom10/I0DwpYK/Vp76Fc PsEHbERUycc8B6Jp5rQRwIzxxY91IPEUmkfGYxtvhagPgeDXGVukEcCyShhOHn0mNL8M /L1A== X-Gm-Message-State: AO0yUKX63pyxS5AYOCJNTQzy9NYTWJ5Y+M2TzGmzmqXmtk9fLL///ZrN gTCqxwTJ9bjt2xBjf4fIa40LSifZbss= X-Google-Smtp-Source: AK7set+dLnKzz7/8zPKTbIF7noe4dDlPrp15r56rYz0SU1PFG1FM11ZihAJJfGr9lkl5b2aIANhZig== X-Received: by 2002:a17:906:2b9b:b0:809:c1f4:ea09 with SMTP id m27-20020a1709062b9b00b00809c1f4ea09mr14772737ejg.69.1675523460446; Sat, 04 Feb 2023 07:11:00 -0800 (PST) Received: from localhost.localdomain (dynamic-077-183-077-083.77.183.pool.telefonica.de. [77.183.77.83]) by smtp.gmail.com with ESMTPSA id 17-20020a170906211100b0088a2aebb146sm2937922ejt.52.2023.02.04.07.10.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 07:10:59 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Thomas Huth , Richard Henderson , Eduardo Habkost , qemu-trivial@nongnu.org, BALATON Zoltan , Laurent Vivier , Sunil Muthuswamy , Marcel Apfelbaum , Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Bernhard Beschow , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 4/9] hw/i386/pc_{q35, piix}: Reuse MachineClass::desc as SMB product name Date: Sat, 4 Feb 2023 16:10:22 +0100 Message-Id: <20230204151027.39007-5-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230204151027.39007-1-shentey@gmail.com> References: <20230204151027.39007-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=shentey@gmail.com; helo=mail-ej1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org No need to repeat the descriptions. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth --- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index df64dd8dcc..ee9d9a4175 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -197,7 +197,7 @@ static void pc_init1(MachineState *machine, if (pcmc->smbios_defaults) { MachineClass *mc = MACHINE_GET_CLASS(machine); /* These values are guest ABI, do not change */ - smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)", + smbios_set_defaults("QEMU", mc->desc, mc->name, pcmc->smbios_legacy_mode, pcmc->smbios_uuid_encoded, pcms->smbios_entry_point_type); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index dee2b38474..71b7a30bb9 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -199,7 +199,7 @@ static void pc_q35_init(MachineState *machine) if (pcmc->smbios_defaults) { /* These values are guest ABI, do not change */ - smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)", + smbios_set_defaults("QEMU", mc->desc, mc->name, pcmc->smbios_legacy_mode, pcmc->smbios_uuid_encoded, pcms->smbios_entry_point_type); From patchwork Sat Feb 4 15:10:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13128747 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 EEBABC636CC for ; Sat, 4 Feb 2023 15:12:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOKC2-0002RX-V0; Sat, 04 Feb 2023 10:11: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 1pOKC1-0002RB-Ns; Sat, 04 Feb 2023 10:11:05 -0500 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOKC0-0006ax-3F; Sat, 04 Feb 2023 10:11:05 -0500 Received: by mail-ej1-x62b.google.com with SMTP id k4so22951445eje.1; Sat, 04 Feb 2023 07:11:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=drXiSmMhmqlJvPhiv+dKQt+fuq5k4HQA4wYOcYoI5f8=; b=L6ASOPBAMRP8vARV3n7PTanMy3IXr3+XNeH9ZqaBsIhtkyb88nZ/+IEFZkLERmlNM6 lX2H8edcR5ogbZILSF+pNA/kBrHqY0i03WmvOeY1IgHX7xxJSw5hOa2WDVxfY6yPNRiu awkjWlk6aLEbw6STFkX+H2nyaxFaeTmwin69J2lpsoCed3fUYKauxPmek04vDWl0YO3r 7YSLl4RRDPqRdbyfI3BZoAlXfgigGurBPdGL44sYoMoi9kHd6uDU3fQxWbaKTv6gFXpB 9zb3up3dFr3RK70o36uJZoQbfJ2HY+kTwMeCaZo22FCibEjzyCvXq73xfQXZKaFFWaUJ xQmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=drXiSmMhmqlJvPhiv+dKQt+fuq5k4HQA4wYOcYoI5f8=; b=Eh5q88LieEbMtYeCRyesNsNoKktU7+yaqR6DLxN+KNUNZKuHm8fiGwigxrWXBb3cbD ofs2CBBZSg/OKIYsVXt16XVVFjWxqeddp8j8ZfurLuiGD8NScTFs+1kwyDFVFrQUnmZy UIpaJQFWj6jRgNdv17o8IxE/LHW+gSOSwvokeyvFF5cPsitM74B+9MnveMikPwZPZHck Uj0LJc7ULzNaZUjZtVGCus2mgWxmvaBRbKuKzeah+be3sHRCXBXqGlghImt6q5K3wgke dbeQmzid7Ln82lmUckuM0ldQ9jJaAvXe8K7z2EOgnOZP9CNAyMVFlGe2zactcWBS6aTE 5w+A== X-Gm-Message-State: AO0yUKUvQFRKX8xZfe45GdxmGzL6jgvqFDtH/dFX6aElgjhoTL0+3KG9 e4D5xQg8RKZqkBoxPj3oW1HwmjuYs+c= X-Google-Smtp-Source: AK7set9NVeGVkEuhNJvF/Ls3orC8GrzDRzXTd+T9evyD9perDe4BM5fefpR+VHB4V+52vsFExgg2tg== X-Received: by 2002:a17:906:9c95:b0:87b:bbdc:468 with SMTP id fj21-20020a1709069c9500b0087bbbdc0468mr15955281ejc.70.1675523461656; Sat, 04 Feb 2023 07:11:01 -0800 (PST) Received: from localhost.localdomain (dynamic-077-183-077-083.77.183.pool.telefonica.de. [77.183.77.83]) by smtp.gmail.com with ESMTPSA id 17-20020a170906211100b0088a2aebb146sm2937922ejt.52.2023.02.04.07.11.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 07:11:01 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Thomas Huth , Richard Henderson , Eduardo Habkost , qemu-trivial@nongnu.org, BALATON Zoltan , Laurent Vivier , Sunil Muthuswamy , Marcel Apfelbaum , Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Bernhard Beschow Subject: [PATCH v3 5/9] hw/i386/pc_{q35, piix}: Minimize usage of get_system_memory() Date: Sat, 4 Feb 2023 16:10:23 +0100 Message-Id: <20230204151027.39007-6-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230204151027.39007-1-shentey@gmail.com> References: <20230204151027.39007-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=shentey@gmail.com; helo=mail-ej1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Bernhard Beschow Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé --- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index ee9d9a4175..5bde4533cc 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -241,7 +241,7 @@ static void pc_init1(MachineState *machine, isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); } else { pci_bus = NULL; - isa_bus = isa_bus_new(NULL, get_system_memory(), system_io, + isa_bus = isa_bus_new(NULL, system_memory, system_io, &error_abort); i8257_dma_init(isa_bus, 0); pcms->hpet_enabled = false; diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 71b7a30bb9..8253b49296 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -125,6 +125,7 @@ static void pc_q35_init(MachineState *machine) DeviceState *lpc_dev; BusState *idebus[MAX_SATA_PORTS]; ISADevice *rtc_state; + MemoryRegion *system_memory = get_system_memory(); MemoryRegion *system_io = get_system_io(); MemoryRegion *pci_memory; MemoryRegion *rom_memory; @@ -192,7 +193,7 @@ static void pc_q35_init(MachineState *machine) rom_memory = pci_memory; } else { pci_memory = NULL; - rom_memory = get_system_memory(); + rom_memory = system_memory; } pc_guest_info_init(pcms); @@ -215,7 +216,7 @@ static void pc_q35_init(MachineState *machine) } /* allocate ram and load rom/bios */ - pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory, + pc_memory_init(pcms, system_memory, rom_memory, &ram_memory, pci_hole64_size); object_property_add_child(OBJECT(machine), "q35", OBJECT(q35_host)); @@ -224,7 +225,7 @@ static void pc_q35_init(MachineState *machine) object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_PCI_MEM, OBJECT(pci_memory), NULL); object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_SYSTEM_MEM, - OBJECT(get_system_memory()), NULL); + OBJECT(system_memory), NULL); object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_IO_MEM, OBJECT(system_io), NULL); object_property_set_int(OBJECT(q35_host), PCI_HOST_BELOW_4G_MEM_SIZE, From patchwork Sat Feb 4 15:10:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13128746 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 6EBF0C61DA4 for ; Sat, 4 Feb 2023 15:12:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOKC6-0002Ua-4k; Sat, 04 Feb 2023 10:11: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 1pOKC2-0002RP-HD; Sat, 04 Feb 2023 10:11:06 -0500 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOKC0-0006b8-SO; Sat, 04 Feb 2023 10:11:06 -0500 Received: by mail-ej1-x62c.google.com with SMTP id k4so22951548eje.1; Sat, 04 Feb 2023 07:11:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=APEL4mR2mjWxIDbTlk214qLngpqhM7APvX4Zo2lwqlc=; b=Bemxb2m3mQ0W3JHWL8l7ubGC8SB0zKxsxG31NDd8j7AG1gLmhU8cUqa81a5qG9uAO+ FsADbHVTxa36gDqXk37hnyvHrtyugZzsPQ+ekQcFIi/5JCyP506BKibaarFWd5t9JgoM QSBTy8bnpZYhCzLCw5NrumW36jkR/84Rsx2KcTc3c6/XFM6fwMn5SN/V2TZfFBy07JM8 BDB9TK0X3v4ZAJwdfwpNueAvKYoWb+Psj8exkb411CLcQ76VdOs2kCJt3brDvb5v0gKD syP63alpcHfbPC9Cl67+qU/Jl29A/pfpt7i703vKxhvhlBbeGigPLkRyIyI2E4TDAkoZ /dTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=APEL4mR2mjWxIDbTlk214qLngpqhM7APvX4Zo2lwqlc=; b=hZYgoNrps82VRyrjzcGMgM/BEa30swmHXuWNFZreiko/PQynMflIj3cdOWgFdcQ3u0 i3ZiXQ75vgPnTd2uHMjiBjgtRgIAeUtL13gIkQxnhBBxFe4TNHEJn/t/+Y+D31mPLyY1 MjQL/5QeAPOYkmyLQzb98+s3/WmkSHVDEoBEF0tNInKgQkf27L3jOeNONgVN3+Uo7RoY E5iakPsVzeON4W2p2zOVW1ajV3QP0c8EvTPFy5xz3wrO03lpq54wgoKxllnFd9FJuxh6 dGw4Tte8iB7Pehz+twijh7ZKBw3GEeCmuCD343Svy6w38OsWDn0Zfp7Lddf2Jp4Fa1U4 vr7A== X-Gm-Message-State: AO0yUKXC/LpqUgrm40Z8uKNcHpb71Ty/lxkbrhApRJ63Y3oLdf6KXTo1 AAw2Svej0dC1RoSRxKUtOz6bPyojHSI= X-Google-Smtp-Source: AK7set/+ASBde+I5UmWbR2s3AdEarmneWXpCUeOP3fvmYasypmgka0IHeGothseWbaUMJa1uz/7H7Q== X-Received: by 2002:a17:906:53d4:b0:878:7ef1:4a20 with SMTP id p20-20020a17090653d400b008787ef14a20mr14151094ejo.4.1675523462933; Sat, 04 Feb 2023 07:11:02 -0800 (PST) Received: from localhost.localdomain (dynamic-077-183-077-083.77.183.pool.telefonica.de. [77.183.77.83]) by smtp.gmail.com with ESMTPSA id 17-20020a170906211100b0088a2aebb146sm2937922ejt.52.2023.02.04.07.11.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 07:11:02 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Thomas Huth , Richard Henderson , Eduardo Habkost , qemu-trivial@nongnu.org, BALATON Zoltan , Laurent Vivier , Sunil Muthuswamy , Marcel Apfelbaum , Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Bernhard Beschow , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 6/9] hw/i386/pc: Initialize ram_memory variable directly Date: Sat, 4 Feb 2023 16:10:24 +0100 Message-Id: <20230204151027.39007-7-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230204151027.39007-1-shentey@gmail.com> References: <20230204151027.39007-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=shentey@gmail.com; helo=mail-ej1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Going through pc_memory_init() seems quite complicated for a simple assignment. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 1 - hw/i386/pc.c | 2 -- hw/i386/pc_piix.c | 4 ++-- hw/i386/pc_q35.c | 5 ++--- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 66e3d059ef..b60b95921b 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -162,7 +162,6 @@ void xen_load_linux(PCMachineState *pcms); void pc_memory_init(PCMachineState *pcms, MemoryRegion *system_memory, MemoryRegion *rom_memory, - MemoryRegion **ram_memory, uint64_t pci_hole64_size); uint64_t pc_pci_hole64_start(void); DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 6e592bd969..8898cc9961 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -936,7 +936,6 @@ static hwaddr pc_max_used_gpa(PCMachineState *pcms, uint64_t pci_hole64_size) void pc_memory_init(PCMachineState *pcms, MemoryRegion *system_memory, MemoryRegion *rom_memory, - MemoryRegion **ram_memory, uint64_t pci_hole64_size) { int linux_boot, i; @@ -994,7 +993,6 @@ void pc_memory_init(PCMachineState *pcms, * Split single memory region and use aliases to address portions of it, * done for backwards compatibility with older qemus. */ - *ram_memory = machine->ram; ram_below_4g = g_malloc(sizeof(*ram_below_4g)); memory_region_init_alias(ram_below_4g, NULL, "ram-below-4g", machine->ram, 0, x86ms->below_4g_mem_size); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 5bde4533cc..00ba725656 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -143,6 +143,7 @@ static void pc_init1(MachineState *machine, if (xen_enabled()) { xen_hvm_init_pc(pcms, &ram_memory); } else { + ram_memory = machine->ram; if (!pcms->max_ram_below_4g) { pcms->max_ram_below_4g = 0xe0000000; /* default: 3.5G */ } @@ -205,8 +206,7 @@ static void pc_init1(MachineState *machine, /* allocate ram and load rom/bios */ if (!xen_enabled()) { - pc_memory_init(pcms, system_memory, - rom_memory, &ram_memory, hole64_size); + pc_memory_init(pcms, system_memory, rom_memory, hole64_size); } else { pc_system_flash_cleanup_unused(pcms); if (machine->kernel_filename != NULL) { diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 8253b49296..88f0981f50 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -129,7 +129,7 @@ static void pc_q35_init(MachineState *machine) MemoryRegion *system_io = get_system_io(); MemoryRegion *pci_memory; MemoryRegion *rom_memory; - MemoryRegion *ram_memory; + MemoryRegion *ram_memory = machine->ram; GSIState *gsi_state; ISABus *isa_bus; int i; @@ -216,8 +216,7 @@ static void pc_q35_init(MachineState *machine) } /* allocate ram and load rom/bios */ - pc_memory_init(pcms, system_memory, rom_memory, &ram_memory, - pci_hole64_size); + pc_memory_init(pcms, system_memory, rom_memory, pci_hole64_size); object_property_add_child(OBJECT(machine), "q35", OBJECT(q35_host)); object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_RAM_MEM, From patchwork Sat Feb 4 15:10:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13128748 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 35B21C61DA4 for ; Sat, 4 Feb 2023 15:13:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOKC6-0002Ut-Qs; Sat, 04 Feb 2023 10:11: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 1pOKC5-0002U3-1d; Sat, 04 Feb 2023 10:11:09 -0500 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOKC3-0006bQ-Ar; Sat, 04 Feb 2023 10:11:08 -0500 Received: by mail-ej1-x62c.google.com with SMTP id p26so22795845ejx.13; Sat, 04 Feb 2023 07:11:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6Z9BSrGLPwa8H52MdZBz+kDsknrSpQNb66zdwdFnT9g=; b=cLP8qQbbKfrL5sf1m8dzcqVjo3JiWDFYGh95ky9Ja/DPV/J7AWcuy+dP4XKTfhX+3Y +HGzUayZq+rCb066EoQrYIBMutlTJamd9YjW8x49Nr4A7q0M0o8OPLyAM/wy29Jivo85 piw+W/8brvFGKbAL4kGJhn4TspmRG2MOOSdnonzpnXRCARIG7/ZKgspe7qFjEADFvzuM bXEJiYbsVgDCy2mhMEDHsoDeHmHloi2e2g3NB+jFBJNH+jZ8Fn/z44r4eR+zollOPCvm 1k5Qg2cj/rsIy/6PkFnGEIQ2THHHjlp4WU0ZUGELAZrEOZYMKOacFT0SgthxQZE2hiYy cfrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6Z9BSrGLPwa8H52MdZBz+kDsknrSpQNb66zdwdFnT9g=; b=Ca32l0eZEW/Qlb1Akt0oPJmyGrN7BonHbWaIi7y7NfTR/AzIkMLEQXVnLyMXxovYI0 v8BP/1b67EVJLgTJP9r1+ZdI2RWDGvqfPfLK2P94KCDvIRWlgCbEiwvxs6rYOCd3Ytr8 j39iRVn0JSV1QN+OQRjiDGUczUChOB8FDcKPVbzzyYF8QGsYDLcw+p6Brd+6Tt27O4CP W8AqIdyTagEri3odB/zYZ+dk69C7KlghQ+H4qjY6ZnJoSYNIDfaNEawwM5wjiwsuYQ7z hhgUwEXcDuYm69hp7U2JgDg/LNhvlVkSJFumfI+Sg/v8Q6GrezEqGNvS8HD3ElGaunR6 ppwA== X-Gm-Message-State: AO0yUKXNwvjPX2B5IDD7+7vVhDBsAR2AljjwKVClK7px++B3z2lt5hF7 5ijYIfkYw5XnhMIBVCtCgT0c6DwzqRo= X-Google-Smtp-Source: AK7set/lmeMdEbTBXfAU2Ve05oH2LD8UW4pImsbw7kco8U+gLjdfVSz03Yr+5lMlQ0LwbS2KEcfZ/w== X-Received: by 2002:a17:906:135a:b0:881:d1ad:1640 with SMTP id x26-20020a170906135a00b00881d1ad1640mr13454640ejb.57.1675523465366; Sat, 04 Feb 2023 07:11:05 -0800 (PST) Received: from localhost.localdomain (dynamic-077-183-077-083.77.183.pool.telefonica.de. [77.183.77.83]) by smtp.gmail.com with ESMTPSA id 17-20020a170906211100b0088a2aebb146sm2937922ejt.52.2023.02.04.07.11.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 07:11:04 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Thomas Huth , Richard Henderson , Eduardo Habkost , qemu-trivial@nongnu.org, BALATON Zoltan , Laurent Vivier , Sunil Muthuswamy , Marcel Apfelbaum , Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Bernhard Beschow Subject: [PATCH v3 7/9] hw/pci-host/pam: Make init_pam() usage more readable Date: Sat, 4 Feb 2023 16:10:25 +0100 Message-Id: <20230204151027.39007-8-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230204151027.39007-1-shentey@gmail.com> References: <20230204151027.39007-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=shentey@gmail.com; helo=mail-ej1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Unlike pam_update() which takes the subject -- PAMMemoryRegion -- as first argument, init_pam() takes it as fifth (!) argument. This makes it quite hard to figure out what an init_pam() invocation actually initializes. By moving the subject to the front this should become clearer. While at it, lower the DeviceState parameter to Object, also communicating more clearly that this parameter is just the owner rather than some (heavy?) dependency. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé --- include/hw/pci-host/pam.h | 5 +++-- hw/pci-host/i440fx.c | 10 +++++----- hw/pci-host/pam.c | 12 ++++++------ hw/pci-host/q35.c | 8 ++++---- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/include/hw/pci-host/pam.h b/include/hw/pci-host/pam.h index c1fd06ba2a..005916f826 100644 --- a/include/hw/pci-host/pam.h +++ b/include/hw/pci-host/pam.h @@ -87,8 +87,9 @@ typedef struct PAMMemoryRegion { unsigned current; } PAMMemoryRegion; -void init_pam(DeviceState *dev, MemoryRegion *ram, MemoryRegion *system, - MemoryRegion *pci, PAMMemoryRegion *mem, uint32_t start, uint32_t size); +void init_pam(PAMMemoryRegion *mem, Object *owner, MemoryRegion *ram, + MemoryRegion *system, MemoryRegion *pci, + uint32_t start, uint32_t size); void pam_update(PAMMemoryRegion *mem, int idx, uint8_t val); #endif /* QEMU_PAM_H */ diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 9c6882d3fc..61e7b97ff4 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -292,12 +292,12 @@ PCIBus *i440fx_init(const char *pci_type, object_property_add_const_link(qdev_get_machine(), "smram", OBJECT(&f->smram)); - init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space, - &f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE); + init_pam(&f->pam_regions[0], OBJECT(d), f->ram_memory, f->system_memory, + f->pci_address_space, PAM_BIOS_BASE, PAM_BIOS_SIZE); for (i = 0; i < ARRAY_SIZE(f->pam_regions) - 1; ++i) { - init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space, - &f->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, - PAM_EXPAN_SIZE); + init_pam(&f->pam_regions[i + 1], OBJECT(d), f->ram_memory, + f->system_memory, f->pci_address_space, + PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE); } ram_size = ram_size / 8 / 1024 / 1024; diff --git a/hw/pci-host/pam.c b/hw/pci-host/pam.c index 454dd120db..68e9884d27 100644 --- a/hw/pci-host/pam.c +++ b/hw/pci-host/pam.c @@ -30,24 +30,24 @@ #include "qemu/osdep.h" #include "hw/pci-host/pam.h" -void init_pam(DeviceState *dev, MemoryRegion *ram_memory, +void init_pam(PAMMemoryRegion *mem, Object *owner, MemoryRegion *ram_memory, MemoryRegion *system_memory, MemoryRegion *pci_address_space, - PAMMemoryRegion *mem, uint32_t start, uint32_t size) + uint32_t start, uint32_t size) { int i; /* RAM */ - memory_region_init_alias(&mem->alias[3], OBJECT(dev), "pam-ram", ram_memory, + memory_region_init_alias(&mem->alias[3], owner, "pam-ram", ram_memory, start, size); /* ROM (XXX: not quite correct) */ - memory_region_init_alias(&mem->alias[1], OBJECT(dev), "pam-rom", ram_memory, + memory_region_init_alias(&mem->alias[1], owner, "pam-rom", ram_memory, start, size); memory_region_set_readonly(&mem->alias[1], true); /* XXX: should distinguish read/write cases */ - memory_region_init_alias(&mem->alias[0], OBJECT(dev), "pam-pci", pci_address_space, + memory_region_init_alias(&mem->alias[0], owner, "pam-pci", pci_address_space, start, size); - memory_region_init_alias(&mem->alias[2], OBJECT(dev), "pam-pci", ram_memory, + memory_region_init_alias(&mem->alias[2], owner, "pam-pci", ram_memory, start, size); memory_region_transaction_begin(); diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index fa05844319..fd18920e7f 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -645,12 +645,12 @@ static void mch_realize(PCIDevice *d, Error **errp) object_property_add_const_link(qdev_get_machine(), "smram", OBJECT(&mch->smram)); - init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory, - mch->pci_address_space, &mch->pam_regions[0], + init_pam(&mch->pam_regions[0], OBJECT(mch), mch->ram_memory, + mch->system_memory, mch->pci_address_space, PAM_BIOS_BASE, PAM_BIOS_SIZE); for (i = 0; i < ARRAY_SIZE(mch->pam_regions) - 1; ++i) { - init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory, - mch->pci_address_space, &mch->pam_regions[i+1], + init_pam(&mch->pam_regions[i + 1], OBJECT(mch), mch->ram_memory, + mch->system_memory, mch->pci_address_space, PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE); } } From patchwork Sat Feb 4 15:10:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13128742 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 A467FC63797 for ; Sat, 4 Feb 2023 15:12:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOKC9-0002WA-9s; Sat, 04 Feb 2023 10:11: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 1pOKC7-0002V7-8M; Sat, 04 Feb 2023 10:11:11 -0500 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOKC4-0006ax-0S; Sat, 04 Feb 2023 10:11:10 -0500 Received: by mail-ej1-x62b.google.com with SMTP id k4so22951851eje.1; Sat, 04 Feb 2023 07:11:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Mjveo29i4v6itcYX0Kaf2tWeC9tv54XMT35HAFBe98g=; b=CJS6Km40TqaFSRREtYspbGJerBiTgN+wdmQvt54+OIjvfOI8gqBV7vrKTuB9Md70Hk 7H2luBoTEQtRHYi0h/7XQfxhpbI82iVOOU4DB0CYC/ngqPj1yDbxDSsVIOJFN+WsR9Vh Dmv655+BoSmMQcYS/XUNgy0EfDwAYdy67831MsEUEpIjKnnpPTOR40CH2jr2jL2QWwYd miIcJfU4lKBGtpCEKVUyLLpSE1/IlQI1+CIAMjjoKFvCZ+vkR5UFamp1OUe+c5WuTUul v99ZL9MNCxl9MXakZNAliqI8UYHczgTEkrLsZKf3g++oR+mvKgZkXxIx0K2iOoL+adWb qMsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Mjveo29i4v6itcYX0Kaf2tWeC9tv54XMT35HAFBe98g=; b=k3CDXfJZ6NcrJQeOPpzny0PnUZuKo4hUH/yEv86zDLLq+usWSp8WZBRlIWbgSKyVa0 8q6jW8hMV9rLAKF5Y3HtA1xqFIO7DIK2qxayxPRbVpK++5CyPf4LCU7pXlhThC+rN0Tr NSofNF064BcG6pkmGH68VPtlz2Vm0zYtbsf9PwNFbbRCAEkuXw3LQq+531KbZC93skjm v2rRADy+JO1N0qV+mHApqc60KbXrziJ9A6hw0cq8LWZCYii4qrSYDO5NfgZiy0ZxuTsJ BUmJjV4SyvvzWFOiOMUuFl2DucQ7NOXCIlswzVgKJv4/8U1h08mOeAPAnkpcEbv49iXi TNfg== X-Gm-Message-State: AO0yUKUHEK5eePBOS/h6IyG4QGQOsaqPktSt2DnBNXezOGEjKwarkQ8p JqvfGA4wZkTRAwN2EKOwFzTGAWefr7k= X-Google-Smtp-Source: AK7set+zGOCKy1jx+s6DVgWNL/zy18GodKky3ND/79atgmFsJJbzvdulsIVS/P3Gegg3NX4LSvLRKA== X-Received: by 2002:a17:906:cf83:b0:887:6c23:193f with SMTP id um3-20020a170906cf8300b008876c23193fmr13362488ejb.44.1675523466648; Sat, 04 Feb 2023 07:11:06 -0800 (PST) Received: from localhost.localdomain (dynamic-077-183-077-083.77.183.pool.telefonica.de. [77.183.77.83]) by smtp.gmail.com with ESMTPSA id 17-20020a170906211100b0088a2aebb146sm2937922ejt.52.2023.02.04.07.11.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 07:11:06 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Thomas Huth , Richard Henderson , Eduardo Habkost , qemu-trivial@nongnu.org, BALATON Zoltan , Laurent Vivier , Sunil Muthuswamy , Marcel Apfelbaum , Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Bernhard Beschow Subject: [PATCH v3 8/9] hw/i386/x86: Make TYPE_X86_MACHINE the owner of smram Date: Sat, 4 Feb 2023 16:10:26 +0100 Message-Id: <20230204151027.39007-9-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230204151027.39007-1-shentey@gmail.com> References: <20230204151027.39007-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=shentey@gmail.com; helo=mail-ej1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Treat the smram MemoryRegion analoguous to other memory regions such as ram, pci, io, ... , making the used memory regions more explicit when instantiating q35 or i440fx. Note that the q35 device uses these memory regions only during the realize phase which suggests that it shouldn't be the owner of smram. i440fx activates/deactivates the whole smram memory region depending on the SMRAM_G_SMRAME bit which seems wrong since it should only handle the 128kb region. If this got changed, i440fx would also only use smram during its realize phase. Signed-off-by: Bernhard Beschow --- include/hw/i386/x86.h | 2 ++ include/hw/pci-host/i440fx.h | 7 ++++--- include/hw/pci-host/q35.h | 4 +++- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 2 ++ hw/i386/x86.c | 4 ++++ hw/pci-host/i440fx.c | 13 +++++-------- hw/pci-host/q35.c | 17 ++++++++--------- 8 files changed, 29 insertions(+), 22 deletions(-) diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index 62fa5774f8..ba6912b721 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -59,6 +59,8 @@ struct X86MachineState { /* Start address of the initial RAM above 4G */ uint64_t above_4g_mem_start; + MemoryRegion smram; + /* CPU and apic information: */ bool apic_xrupt_override; unsigned pci_irq_mask; diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h index bf57216c78..e9efdb3c5f 100644 --- a/include/hw/pci-host/i440fx.h +++ b/include/hw/pci-host/i440fx.h @@ -28,9 +28,10 @@ struct PCII440FXState { MemoryRegion *system_memory; MemoryRegion *pci_address_space; MemoryRegion *ram_memory; + MemoryRegion *smram; PAMMemoryRegion pam_regions[PAM_REGIONS_COUNT]; MemoryRegion smram_region; - MemoryRegion smram, low_smram; + MemoryRegion low_smram; }; #define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX" @@ -43,7 +44,7 @@ PCIBus *i440fx_init(const char *pci_type, ram_addr_t below_4g_mem_size, ram_addr_t above_4g_mem_size, MemoryRegion *pci_memory, - MemoryRegion *ram_memory); - + MemoryRegion *ram_memory, + MemoryRegion *smram); #endif diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h index e89329c51e..fcbe57b42d 100644 --- a/include/hw/pci-host/q35.h +++ b/include/hw/pci-host/q35.h @@ -44,9 +44,10 @@ struct MCHPCIState { MemoryRegion *pci_address_space; MemoryRegion *system_memory; MemoryRegion *address_space_io; + MemoryRegion *smram; PAMMemoryRegion pam_regions[PAM_REGIONS_COUNT]; MemoryRegion smram_region, open_high_smram; - MemoryRegion smram, low_smram, high_smram; + MemoryRegion low_smram, high_smram; MemoryRegion tseg_blackhole, tseg_window; MemoryRegion smbase_blackhole, smbase_window; bool has_smram_at_smbase; @@ -75,6 +76,7 @@ struct Q35PCIHost { */ #define MCH_HOST_PROP_RAM_MEM "ram-mem" +#define MCH_HOST_PROP_SMRAM_MEM "smram-mem" #define MCH_HOST_PROP_PCI_MEM "pci-mem" #define MCH_HOST_PROP_SYSTEM_MEM "system-mem" #define MCH_HOST_PROP_IO_MEM "io-mem" diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 00ba725656..41aaaa5465 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -228,7 +228,7 @@ static void pc_init1(MachineState *machine, system_memory, system_io, machine->ram_size, x86ms->below_4g_mem_size, x86ms->above_4g_mem_size, - pci_memory, ram_memory); + pci_memory, ram_memory, &x86ms->smram); pci_bus_map_irqs(pci_bus, xen_enabled() ? xen_pci_slot_get_pirq : pc_pci_slot_get_pirq); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 88f0981f50..480226de2c 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -221,6 +221,8 @@ static void pc_q35_init(MachineState *machine) object_property_add_child(OBJECT(machine), "q35", OBJECT(q35_host)); object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_RAM_MEM, OBJECT(ram_memory), NULL); + object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_SMRAM_MEM, + OBJECT(&x86ms->smram), NULL); object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_PCI_MEM, OBJECT(pci_memory), NULL); object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_SYSTEM_MEM, diff --git a/hw/i386/x86.c b/hw/i386/x86.c index eaff4227bd..d7e219b1eb 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -1436,6 +1436,10 @@ static void x86_machine_initfn(Object *obj) x86ms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8); x86ms->bus_lock_ratelimit = 0; x86ms->above_4g_mem_start = 4 * GiB; + + memory_region_init(&x86ms->smram, obj, "smram", 4 * GiB); + memory_region_set_enabled(&x86ms->smram, true); + object_property_add_const_link(obj, "smram", OBJECT(&x86ms->smram)); } static void x86_machine_class_init(ObjectClass *oc, void *data) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 61e7b97ff4..8f4a4f59a6 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -23,7 +23,6 @@ */ #include "qemu/osdep.h" -#include "qemu/units.h" #include "qemu/range.h" #include "hw/i386/pc.h" #include "hw/pci/pci.h" @@ -77,7 +76,7 @@ static void i440fx_update_memory_mappings(PCII440FXState *d) } memory_region_set_enabled(&d->smram_region, !(pd->config[I440FX_SMRAM] & SMRAM_D_OPEN)); - memory_region_set_enabled(&d->smram, + memory_region_set_enabled(d->smram, pd->config[I440FX_SMRAM] & SMRAM_G_SMRAME); memory_region_transaction_commit(); } @@ -246,7 +245,8 @@ PCIBus *i440fx_init(const char *pci_type, ram_addr_t below_4g_mem_size, ram_addr_t above_4g_mem_size, MemoryRegion *pci_address_space, - MemoryRegion *ram_memory) + MemoryRegion *ram_memory, + MemoryRegion *smram) { PCIBus *b; PCIDevice *d; @@ -267,6 +267,7 @@ PCIBus *i440fx_init(const char *pci_type, f->system_memory = address_space_mem; f->pci_address_space = pci_address_space; f->ram_memory = ram_memory; + f->smram = smram; i440fx = I440FX_PCI_HOST_BRIDGE(dev); range_set_bounds(&i440fx->pci_hole, below_4g_mem_size, @@ -283,14 +284,10 @@ PCIBus *i440fx_init(const char *pci_type, memory_region_set_enabled(&f->smram_region, true); /* smram, as seen by SMM CPUs */ - memory_region_init(&f->smram, OBJECT(d), "smram", 4 * GiB); - memory_region_set_enabled(&f->smram, true); memory_region_init_alias(&f->low_smram, OBJECT(d), "smram-low", f->ram_memory, 0xa0000, 0x20000); memory_region_set_enabled(&f->low_smram, true); - memory_region_add_subregion(&f->smram, 0xa0000, &f->low_smram); - object_property_add_const_link(qdev_get_machine(), "smram", - OBJECT(&f->smram)); + memory_region_add_subregion(f->smram, 0xa0000, &f->low_smram); init_pam(&f->pam_regions[0], OBJECT(d), f->ram_memory, f->system_memory, f->pci_address_space, PAM_BIOS_BASE, PAM_BIOS_SIZE); diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index fd18920e7f..83f2a98c71 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -246,6 +246,10 @@ static void q35_host_initfn(Object *obj) (Object **) &s->mch.ram_memory, qdev_prop_allow_set_link_before_realize, 0); + object_property_add_link(obj, MCH_HOST_PROP_SMRAM_MEM, TYPE_MEMORY_REGION, + (Object **) &s->mch.smram, + qdev_prop_allow_set_link_before_realize, 0); + object_property_add_link(obj, MCH_HOST_PROP_PCI_MEM, TYPE_MEMORY_REGION, (Object **) &s->mch.pci_address_space, qdev_prop_allow_set_link_before_realize, 0); @@ -594,19 +598,17 @@ static void mch_realize(PCIDevice *d, Error **errp) memory_region_set_enabled(&mch->open_high_smram, false); /* smram, as seen by SMM CPUs */ - memory_region_init(&mch->smram, OBJECT(mch), "smram", 4 * GiB); - memory_region_set_enabled(&mch->smram, true); memory_region_init_alias(&mch->low_smram, OBJECT(mch), "smram-low", mch->ram_memory, MCH_HOST_BRIDGE_SMRAM_C_BASE, MCH_HOST_BRIDGE_SMRAM_C_SIZE); memory_region_set_enabled(&mch->low_smram, true); - memory_region_add_subregion(&mch->smram, MCH_HOST_BRIDGE_SMRAM_C_BASE, + memory_region_add_subregion(mch->smram, MCH_HOST_BRIDGE_SMRAM_C_BASE, &mch->low_smram); memory_region_init_alias(&mch->high_smram, OBJECT(mch), "smram-high", mch->ram_memory, MCH_HOST_BRIDGE_SMRAM_C_BASE, MCH_HOST_BRIDGE_SMRAM_C_SIZE); memory_region_set_enabled(&mch->high_smram, true); - memory_region_add_subregion(&mch->smram, 0xfeda0000, &mch->high_smram); + memory_region_add_subregion(mch->smram, 0xfeda0000, &mch->high_smram); memory_region_init_io(&mch->tseg_blackhole, OBJECT(mch), &blackhole_ops, NULL, @@ -619,7 +621,7 @@ static void mch_realize(PCIDevice *d, Error **errp) memory_region_init_alias(&mch->tseg_window, OBJECT(mch), "tseg-window", mch->ram_memory, mch->below_4g_mem_size, 0); memory_region_set_enabled(&mch->tseg_window, false); - memory_region_add_subregion(&mch->smram, mch->below_4g_mem_size, + memory_region_add_subregion(mch->smram, mch->below_4g_mem_size, &mch->tseg_window); /* @@ -639,12 +641,9 @@ static void mch_realize(PCIDevice *d, Error **errp) MCH_HOST_BRIDGE_SMBASE_ADDR, MCH_HOST_BRIDGE_SMBASE_SIZE); memory_region_set_enabled(&mch->smbase_window, false); - memory_region_add_subregion(&mch->smram, MCH_HOST_BRIDGE_SMBASE_ADDR, + memory_region_add_subregion(mch->smram, MCH_HOST_BRIDGE_SMBASE_ADDR, &mch->smbase_window); - object_property_add_const_link(qdev_get_machine(), "smram", - OBJECT(&mch->smram)); - init_pam(&mch->pam_regions[0], OBJECT(mch), mch->ram_memory, mch->system_memory, mch->pci_address_space, PAM_BIOS_BASE, PAM_BIOS_SIZE); From patchwork Sat Feb 4 15:10:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13128744 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 22298C636D3 for ; Sat, 4 Feb 2023 15:12:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOKC9-0002WE-QR; Sat, 04 Feb 2023 10:11: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 1pOKC8-0002Vc-4p; Sat, 04 Feb 2023 10:11:12 -0500 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOKC6-0006bk-3v; Sat, 04 Feb 2023 10:11:11 -0500 Received: by mail-ej1-x62d.google.com with SMTP id ud5so22931017ejc.4; Sat, 04 Feb 2023 07:11:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dPYELRlFV8w4s2mD+NwhDzTDZ9N/FFBC8a9zFFIEtf8=; b=CYWk3AJBu3SFq9tGsGcY97tj6hgZtcGnwfiAyl2g6Q9xvAOLCv55Ddh/dQ8558DKet x8TjUcod1Sa3ZrnIoABp3duTYpLIbRMoljH416SCXaev3Cbjz/iK0HZu+cpa6WLeFIl9 msCwNih12aq1Pz/OpTdf5+W9QD/ZM9qQ0DXTJVEpXdqr8XBwqej0iIlq3PyvP14G5iVc y7hd1FTqrHCZK4Me1jE6IJd9/xp87mox0y0iTkA5b36xeyPhXhVMPr2EwMWFEMUHedxD zW/XFZc99YmTkf3LuenFl1mrZ6luMqXJbzPhdDhKft5nQvbApbNxJtFD5VWgJorTtSYf ySgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dPYELRlFV8w4s2mD+NwhDzTDZ9N/FFBC8a9zFFIEtf8=; b=VUhBE5Xz5okuUn8A/QKOhf1sF/QKQTP6iNTvhrsa6NdNvWKZn2i65njDyMmTHlsHOG adKiyvLd2vC5Z4mss/CtpU38VTC2LXg7D3s4R9A9jt7+3pmAlbv3UPTLOIFxReO9McwP sJEOrMD3oi51ZEXN2WxckEW+BbC/StRXaMNPIpXO46E3lCOLUAYvX8OwLhoYaAvk1UTm hoUiS2XpB74wUoZW/D8Og3tn6foLd3ECMlkHkSk/III15s/3RCq+m62iN1PCU6g18RFg /oGPzcS3x4pPJC0Z213POF7B/2hNcQfKHjUPWkZZrtDcUX3YACZlw46e6NNK8myryMFQ YcxQ== X-Gm-Message-State: AO0yUKXmIJcSgMv2noU13ywOrKZrEYNAqzUpVkqfQiB9TyUC/7T9gLRV 3Kwb72zy5aprfnk0lGslgRUCvk878c8= X-Google-Smtp-Source: AK7set/CD0tzk+xuenxj3W/QPe6SMokzE1EbORVEQ8n4bamR3JM+7aIPXlGLaSJtVkVEULeR/E6CcA== X-Received: by 2002:a17:906:8a70:b0:84c:a863:ebe6 with SMTP id hy16-20020a1709068a7000b0084ca863ebe6mr12324233ejc.43.1675523468317; Sat, 04 Feb 2023 07:11:08 -0800 (PST) Received: from localhost.localdomain (dynamic-077-183-077-083.77.183.pool.telefonica.de. [77.183.77.83]) by smtp.gmail.com with ESMTPSA id 17-20020a170906211100b0088a2aebb146sm2937922ejt.52.2023.02.04.07.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 07:11:07 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Thomas Huth , Richard Henderson , Eduardo Habkost , qemu-trivial@nongnu.org, BALATON Zoltan , Laurent Vivier , Sunil Muthuswamy , Marcel Apfelbaum , Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Bernhard Beschow Subject: [PATCH v3 9/9] target/i386/tcg/sysemu/tcg-cpu: Avoid own opinion about smram size Date: Sat, 4 Feb 2023 16:10:27 +0100 Message-Id: <20230204151027.39007-10-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230204151027.39007-1-shentey@gmail.com> References: <20230204151027.39007-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=shentey@gmail.com; helo=mail-ej1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org When setting up the CPU's smram memory region alias, the code currently assumes that the smram size is 4 GiB. While this is true, it repeats a decision made elsewhere which seems redundant and prone to inconsistencies. Avoid this by reusing whatever size the smram region was set to. Signed-off-by: Bernhard Beschow --- target/i386/tcg/sysemu/tcg-cpu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/i386/tcg/sysemu/tcg-cpu.c b/target/i386/tcg/sysemu/tcg-cpu.c index c223c0fe9b..8f5ce6093c 100644 --- a/target/i386/tcg/sysemu/tcg-cpu.c +++ b/target/i386/tcg/sysemu/tcg-cpu.c @@ -22,7 +22,6 @@ #include "tcg/helper-tcg.h" #include "sysemu/sysemu.h" -#include "qemu/units.h" #include "exec/address-spaces.h" #include "tcg/tcg-cpu.h" @@ -36,7 +35,7 @@ static void tcg_cpu_machine_done(Notifier *n, void *unused) if (smram) { cpu->smram = g_new(MemoryRegion, 1); memory_region_init_alias(cpu->smram, OBJECT(cpu), "smram", - smram, 0, 4 * GiB); + smram, 0, memory_region_size(smram)); memory_region_set_enabled(cpu->smram, true); memory_region_add_subregion_overlap(cpu->cpu_as_root, 0, cpu->smram, 1);