From patchwork Fri Feb 16 15:35:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 773338 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp1412743wre; Fri, 16 Feb 2024 07:36:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVEabTXsjnDXIV67eMHlSrFygk37FlmZRnDZaQL8vDqKyM2WKgO4RExbXy/lhSgl+jqx0P5iHvyw4nqfJeLtm6w X-Google-Smtp-Source: AGHT+IFO2HKwhDfu4eQNe0nxEHm/ikNoPN+HXmyTECz75Pkd83TTIXTmvcnadvdYBQ6bsXECB65M X-Received: by 2002:a0c:f349:0:b0:68c:92b5:f67c with SMTP id e9-20020a0cf349000000b0068c92b5f67cmr4974774qvm.32.1708097795197; Fri, 16 Feb 2024 07:36:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708097795; cv=none; d=google.com; s=arc-20160816; b=cnkgbi5pZ5YRi6DDAShB09oGqLgE+DzvYTO7jyzaJJoveMqCpOqeSnVpFdR449N0X/ 07NMWGAkr+ssGqXCHq6ApddnYCt9cknKW/Y3Vg6i+w18UDsRTfb+W1Di6uwkYJ6cMAz7 HSbX3Pi56sseFk+JxsS47G9FB0O7Q9diu34Qtozh3U8WOU3Kp5Kxo6RZM1T8IwCaRpm8 8J5r0jE1PZ6hgmi2M98OVkuyUinImkX4r2cZCgHQSZs2Jg/C0grQeXp1aXPZTvHNvIcz 5xta4RQ9s9yCXkp7GHGJEb1BLAXCfSx+8xzVherRww6/+9q1kpAhtOTQEsD+DKAzrLp+ S4cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wZ1SK8UcIGNjoS5oUCJZaLlSaFI2o9jBSpbbsKbpCUU=; fh=Xd4+DjwsSB15CDSuGqGdsywYntTmak9IX+7zMshVrOw=; b=nNQN5zBfuJoIcHJWW1nzfVqW2RFWP5KkZ8a8a0bPG+gcKv3stpTmNi2rzR0wH/m8od QGBvh49zkNiaaAu8VX6YPVF2ACXVlvSwfwniub6BekxtQILlQ2SxVFld/4bL3QZ+ZrXD retWDEYlUKqXjmxXndcuenKgEZlDSoGP5BN+B/eCcbLNF7NkEKXKoSvOP9M4mMLBGWPC 0GYDB22PQe9GkegMsDDcy/TR1V8z6obxXrcJGI1lkoip/vJzZAKoCwZYo1cuUMSv7GxN UkO8PXZIjJxcTk5KdumivQ6KdJn29wCxmCGcCV7uol64I29ab+8bdIT3wQy+J1V7eQ7k nBNg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CNuSANL2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id iw15-20020a0562140f2f00b0068cb7b24a38si4163105qvb.339.2024.02.16.07.36.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Feb 2024 07:36:35 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CNuSANL2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=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_Mathie?= =?utf-8?q?u-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é 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 = sysbus_create_simple("pl061", 0x10015000, pic[8]); dev = 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 board_id) /* The versatile/PB actually has a modified Color LCD controller that includes hardware cursor support from the PL111. */ dev = 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, /* 0x10020000 PL111 CLCD (daughterboard) */ dev = 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]); @@ -654,6 +657,8 @@ static void vexpress_common_init(MachineState *machine) /* VE_COMPACTFLASH: not modelled */ dev = 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" #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; }; 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 = (PL110State *)opaque; - SysBusDevice *sbd; DisplaySurface *surface = qemu_console_surface(s->con); drawfn fn; int src_width; @@ -222,8 +224,6 @@ static void pl110_update_display(void *opaque) return; } - sbd = SYS_BUS_DEVICE(s); - if (s->cr & PL110_CR_BGR) bpp_offset = 0; else @@ -290,7 +290,7 @@ static void pl110_update_display(void *opaque) first = 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 = { .gfx_update = pl110_update_display, }; +static Property pl110_properties[] = { + 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 = PL110(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); + 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", 0x1000); 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 = &vmstate_pl110; dc->realize = pl110_realize; + device_class_set_props(dc, pl110_properties); } static const TypeInfo pl110_info = {