From nobody Fri Nov 1 07:33:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1708097795; cv=none; d=zohomail.com; s=zohoarc; b=UJqRiqTg9tEwWepL7QXYD0ZB3VdYDQM1XHX0wnCa5YWN4aBvxoU9Ti79O7hVVwomHGbORTeE+7mX+FzZMITSMwjtDDj71PmUJVFRSEY7Jz7X2rBLyj9zCZHjghWpnTZRV0gQdf8GpmzbH3HiyUb++ce5s8gdcAjVbe6hBsX7JVA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708097795; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wZ1SK8UcIGNjoS5oUCJZaLlSaFI2o9jBSpbbsKbpCUU=; b=IiI2Q2oFUYKuZA+sqVjnFIjcYlERsLNd6q3MFv7T8bcR23lUPrFXXF5REOXWYq480nR40B4dW6Dq05hSutgNqD/C54Hpqb8lGMw9wXEw+nWLRy2aJi+A2NHQMO05qhlkFr1BjWeQJhFxkGcBYpba4TpwGWeY5PQ/sfji0vksE5M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708097795581165.84184153298622; Fri, 16 Feb 2024 07:36:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rb0Fd-00048v-GR; Fri, 16 Feb 2024 10:35:45 -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 1rb0Fb-00047P-I3 for qemu-devel@nongnu.org; Fri, 16 Feb 2024 10:35:43 -0500 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rb0FT-0008BS-NL for qemu-devel@nongnu.org; Fri, 16 Feb 2024 10:35:43 -0500 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a3566c0309fso266609866b.1 for ; Fri, 16 Feb 2024 07:35:34 -0800 (PST) Received: from m1x-phil.lan ([176.187.210.246]) by smtp.gmail.com with ESMTPSA id qw17-20020a170906fcb100b00a3d25d35ca5sm52716ejb.16.2024.02.16.07.35.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 16 Feb 2024 07:35:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708097733; x=1708702533; 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=wZ1SK8UcIGNjoS5oUCJZaLlSaFI2o9jBSpbbsKbpCUU=; b=CNuSANL2Eops5l//6bnMB1f2GchJ+D5MDNthI3t2EeyRdclohcB98lzc2IWbt9q6Bj c7nO6O9sViqemSNMKvb11m/VMLi/8J1ZwQcQjbJfhkh+F2goYi+zJNSzTxMkwRkk89x9 UaFfYjlH4MHJ10BUPT9FFyG3+jxTPxW6nNbtoLAZI/sv6OuM9Ml44qjiyKnOrn1THhHH MPTnbUqGZPbO8cRlUKpNNtuCxC7OdkndXgCWBJp1lCXRI23Y4v9ezZE6nNtG0UCQ3QkL r8eaUBlgkeEQYPLv/sYCmXNIzBb7o7gJrjgJduFuFSeriZMlXF2AQhYZvYhmUsun8GoI KCXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708097733; x=1708702533; 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=wZ1SK8UcIGNjoS5oUCJZaLlSaFI2o9jBSpbbsKbpCUU=; b=BrjHjBgSbBKCrqVusad1nI6LdiZbat2AT0HhS/3XHSmowgaEW0MvPjLKvvFbLuZjuK pgdkyQ+bBabrdyNEyWLwiIMpmGkILdPIe6T+a42bYKlUNm229u0RzK4DuHoCKojU90yB xBLPC4aI3wdeRpMaHAxfVJHcBz7gub4T2nZGO2fM9P8RtgZRj25aEfVCStZg9H42d4kD JvLYjIsaIGAy8rhUyV51hJmHkAHqoiLo1W6tSmurPWrgJIs5Ul7/cmi/mFI0nE8Ckof/ 7X9m6oG+Ncha7vuWPtd21s5IgYa6WBbrUssdE513fITvE5Bnmrjih4r4CRR0ba77lpfq iaTA== X-Gm-Message-State: AOJu0Yyb2q+/qZD9CKZS2SHAKEnhTweWJloyvk84dagYXpWN3nAzWR8o 2Wy24llEP0WIdwj6nqMcOMGpFuaE1u0stS4ZzKVhpO3mNm5lUZ4Kd+aHeBPGutfuHVuEKA/+mqj u X-Google-Smtp-Source: AGHT+IH9BTAcIohzCR8eVt3EE/x7HR0y4dxLNcTYXzXwSeNEodcpT2ESRISuFuitM7rP6Rj400gYrw== X-Received: by 2002:a17:907:119c:b0:a3d:4037:73e7 with SMTP id uz28-20020a170907119c00b00a3d403773e7mr3369329ejb.48.1708097733048; Fri, 16 Feb 2024 07:35:33 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , qemu-arm@nongnu.org, kvm@vger.kernel.org, Peter Maydell , Igor Mitsyanko , "Michael S. Tsirkin" , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 2/6] hw/display/pl110: Pass frame buffer memory region as link property Date: Fri, 16 Feb 2024 16:35:13 +0100 Message-ID: <20240216153517.49422-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240216153517.49422-1-philmd@linaro.org> References: <20240216153517.49422-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=philmd@linaro.org; helo=mail-ej1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1708097797113100002 Add the PL110::'framebuffer-memory' property. Have the different ARM boards set it. We don't need to call sysbus_address_space() anymore. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/arm/realview.c | 2 ++ hw/arm/versatilepb.c | 2 ++ hw/arm/vexpress.c | 5 +++++ hw/display/pl110.c | 20 ++++++++++++++++---- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 77300e92e5..b186f965c6 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -239,6 +239,8 @@ static void realview_init(MachineState *machine, gpio2 =3D sysbus_create_simple("pl061", 0x10015000, pic[8]); =20 dev =3D qdev_new("pl111"); + object_property_set_link(OBJECT(dev), "framebuffer-memory", + OBJECT(sysmem), &error_fatal); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x10020000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[23]); diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index 7e04b23af8..d48235453e 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -300,6 +300,8 @@ static void versatile_init(MachineState *machine, int b= oard_id) /* The versatile/PB actually has a modified Color LCD controller that includes hardware cursor support from the PL111. */ dev =3D qdev_new("pl110_versatile"); + object_property_set_link(OBJECT(dev), "framebuffer-memory", + OBJECT(sysmem), &error_fatal); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x10120000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[16]); diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 671986c21e..de815d84cc 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -299,6 +299,9 @@ static void a9_daughterboard_init(VexpressMachineState = *vms, =20 /* 0x10020000 PL111 CLCD (daughterboard) */ dev =3D qdev_new("pl111"); + object_property_set_link(OBJECT(dev), "framebuffer-memory", + OBJECT(sysmem), &error_fatal); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x10020000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[44]); =20 @@ -654,6 +657,8 @@ static void vexpress_common_init(MachineState *machine) /* VE_COMPACTFLASH: not modelled */ =20 dev =3D qdev_new("pl111"); + object_property_set_link(OBJECT(dev), "framebuffer-memory", + OBJECT(sysmem), &error_fatal); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, map[VE_CLCD]); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[14]); diff --git a/hw/display/pl110.c b/hw/display/pl110.c index 4b83db9322..7f145bbdba 100644 --- a/hw/display/pl110.c +++ b/hw/display/pl110.c @@ -10,6 +10,7 @@ #include "qemu/osdep.h" #include "hw/irq.h" #include "hw/sysbus.h" +#include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "ui/console.h" #include "framebuffer.h" @@ -17,6 +18,7 @@ #include "qemu/timer.h" #include "qemu/log.h" #include "qemu/module.h" +#include "qapi/error.h" #include "qom/object.h" =20 #define PL110_CR_EN 0x001 @@ -74,6 +76,7 @@ struct PL110State { uint32_t palette[256]; uint32_t raw_palette[128]; qemu_irq irq; + MemoryRegion *fbmem; }; =20 static int vmstate_pl110_post_load(void *opaque, int version_id); @@ -210,7 +213,6 @@ static int pl110_enabled(PL110State *s) static void pl110_update_display(void *opaque) { PL110State *s =3D (PL110State *)opaque; - SysBusDevice *sbd; DisplaySurface *surface =3D qemu_console_surface(s->con); drawfn fn; int src_width; @@ -222,8 +224,6 @@ static void pl110_update_display(void *opaque) return; } =20 - sbd =3D SYS_BUS_DEVICE(s); - if (s->cr & PL110_CR_BGR) bpp_offset =3D 0; else @@ -290,7 +290,7 @@ static void pl110_update_display(void *opaque) first =3D 0; if (s->invalidate) { framebuffer_update_memory_section(&s->fbsection, - sysbus_address_space(sbd), + s->fbmem, s->upbase, s->rows, src_width); } @@ -535,11 +535,22 @@ static const GraphicHwOps pl110_gfx_ops =3D { .gfx_update =3D pl110_update_display, }; =20 +static Property pl110_properties[] =3D { + DEFINE_PROP_LINK("framebuffer-memory", PL110State, fbmem, + TYPE_MEMORY_REGION, MemoryRegion *), + DEFINE_PROP_END_OF_LIST(), +}; + static void pl110_realize(DeviceState *dev, Error **errp) { PL110State *s =3D PL110(dev); SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); =20 + if (!s->fbmem) { + error_setg(errp, "'framebuffer-memory' property was not set"); + return; + } + memory_region_init_io(&s->iomem, OBJECT(s), &pl110_ops, s, "pl110", 0x= 1000); sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); @@ -577,6 +588,7 @@ static void pl110_class_init(ObjectClass *klass, void *= data) set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); dc->vmsd =3D &vmstate_pl110; dc->realize =3D pl110_realize; + device_class_set_props(dc, pl110_properties); } =20 static const TypeInfo pl110_info =3D { --=20 2.41.0