From patchwork Thu Nov 28 17:52:23 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: 845955 Delivered-To: patch@linaro.org Received: by 2002:adf:f2c4:0:b0:382:43a8:7b94 with SMTP id d4csp383152wrp; Thu, 28 Nov 2024 09:52:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWLUEqds5DrDI7EoQ0pYvcLy8+kJtpIOi0am+SJ4yaLG4/gHYIBsuIyunJ401Vo4P15CRhW9Q==@linaro.org X-Google-Smtp-Source: AGHT+IF9zl8F4aKXVSk7Q3dhV6sdlReuH88epGFp0IQ5STkzB/ZQtO1JCukZjWKAsYSRycNqsPJq X-Received: by 2002:a05:622a:296:b0:466:979f:a71f with SMTP id d75a77b69052e-466b35576f1mr118320491cf.27.1732816372324; Thu, 28 Nov 2024 09:52:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732816372; cv=none; d=google.com; s=arc-20240605; b=ejzEpHfmoOM6mUOhn9FbpORWrgmuTjDrQIdiGg1kg5LG45hLYEObyArUNblWYMHeKD gGj+ZUMJlcM3T1Y8beTZaBlXS2s6rzSSjOq+kbhCKWdKFY/m4kA/tEqWb+xU5oD7oAnv +BhDG2KmWnhVEpq64vVcYKFINZ9NGGKSuFLYOvFcvWsuKA8b0NwEXsD5RUo9/cWSWJUN HKN92GRWx0IZO8f5V5d50Ngw7wwMeE9O9ZRgr8kN+MKC35PqAv7XXug6wqZXyawkhITe qSQPA7GcNWmXCYaWUNPiiF1ozdQMDNz8M90mnuwRzbJDoKOFeVBlwD3NGfqtohyONQON UsPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=u+IsHVrjSzPn9IoEqVOtBC65NeNmlEiYEpz17kxhMns=; fh=FZmmMKRp3rc00qJXxX8wdN6J9g7CaKYtEdtDtIMJ8Tc=; b=cOv3TO5Y+d/dkP/5XbC+f+YUAy4IH0zWZ7elSXRvnA/Rn/XS/TuOgDWNm4tfkrMcAc Ae/IR9aUviJgrP+0BRTz0LYQcWXT57Za/OoGKIgb5YxngSr2FLkIwA+A7h1909DfGLuK I/vC8Zn1FaIzWZQ26GrPXuMXcLiztW4wcoNeS9JjAkS6n6rxvmMoXEysiN+l3hnlbM3i unGu3lAuFY9FaVBJU6p4uL6a3oC4/+bYfVNRukdI0jjtxgVBV/wnHXl77kz6uA3BJtpW i1/Y48s5Ub+1lSG3qB7kVXZHi0jQPpqFKPKiJoa16qysHUbR702NkNOSSwNtHjpMlmJc QErg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xlNqQHPd; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-466c4460a29si21021841cf.692.2024.11.28.09.52.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Nov 2024 09:52:52 -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=xlNqQHPd; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGigp-0007ie-Hc; Thu, 28 Nov 2024 12:52:31 -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 1tGign-0007i8-L9 for qemu-devel@nongnu.org; Thu, 28 Nov 2024 12:52:29 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tGigl-0004O2-RX for qemu-devel@nongnu.org; Thu, 28 Nov 2024 12:52:29 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-434a852bb6eso9674075e9.3 for ; Thu, 28 Nov 2024 09:52:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732816346; x=1733421146; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=u+IsHVrjSzPn9IoEqVOtBC65NeNmlEiYEpz17kxhMns=; b=xlNqQHPd8LXd0mFn2p8m5t0ox/XcVlkMQU44VflY3pgbMfPxZ3AO5pGUmKOQRQUqav xTisH7002nXF7xefk9QrY+WHQclLseFDFcBByabJlTa4zUo4CicmFGYgstwIAQsOSJ/h yZ3WDyOJLozlIHHloPc9nSygkPF4LW4BtSxHMhfmDF2qFmDOWFV9+jPCc6AiLVr0ypyG PF72CEijZXMaDXbafh1cLIY+dk624JqeZUofKoFatU2PT+Ewx8Hs9qleON7+Qri47wcH JDr6GEcUEpWR1sArZyMTg94yVd2Z41fw0pJPlE6vKjeYJAvEDT3l3YQkknlBvr78BfFY o/bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732816346; x=1733421146; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=u+IsHVrjSzPn9IoEqVOtBC65NeNmlEiYEpz17kxhMns=; b=ag3guiQeZXuGuSckiG1MqCWlJqaiDHuV6rIkSdhhEyipYunX3dKXyNeC35bFguMQLn hg+cNtW06hX/r8WNIMdP42CIuChW5ALKqlQPLsQNPDso8bslZIzCkQOVd3wF9qSbjhpY HbaTXvrnXH91+YSlLpZ8yLniK2axW9x7BrI+BUIr4HbkJNtgKOq/pnfRgjxdOXfCq43V vcM8c7zdMEGKGt1Ol2eRXPaco7DYfQRxnXq2THpTx2+dZoFz0/rb8hlswZFDs85zNFm1 ZHFCAhVLXyru414Rrtq3A81AbfKBl7tkxR5NPM45D7TekkX6IIos9fyshK2oCgzrrD4I lO4Q== X-Gm-Message-State: AOJu0YzKhVdjJJshkCP0xxt6PhS6kq3hlCn2QjZJ2Xx1sDVTmq3R4Yha vlYK0AvY1GsXeVXPOnOf/ZrtyF0FLksmCF1vGUi6hpRKqcyUmelVU0h08F6QcTzEGdKiM1dF45T P X-Gm-Gg: ASbGncuhNeU7LjcHN/IYrjjIy0j6fRPY1168hF8kfcAkaxef3iJDxTbwVdaiAf/GLnU EFasb3W/VaKF/Bzxh+O1g+kGpc/HQMN48ry6ciTHk4961Rsv1Pjz62F7jjYfsv8p9weH+r4cA6n W9z06R4iNyZjqeKMWyg9K2DF9DbSWUkO2OHgJo2OHJIiHIt2Nc0HW/5V5m0AAXYpOUCvEWS5vdr gcEEgkfmA2jtwqRTsHf2pkvDIhPTeMGS5mkVhNaIUtvaHMYHLOidU83ZElBnXA/IbELrfQGnti8 DYYOnv/KrYKwswq4WJgBosDZGXG9wg== X-Received: by 2002:a05:600c:3489:b0:434:a39b:5e44 with SMTP id 5b1f17b1804b1-434a9dcff98mr82345175e9.17.1732816345873; Thu, 28 Nov 2024 09:52:25 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434aa76b52bsm59924195e9.18.2024.11.28.09.52.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Nov 2024 09:52:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Benjamin Herrenschmidt , =?utf-8?q?Philippe_Mathi?= =?utf-8?q?eu-Daud=C3=A9?= Subject: [PATCH] hw/display/vga: Do not reset 'big_endian_fb' in vga_common_reset() Date: Thu, 28 Nov 2024 18:52:23 +0100 Message-ID: <20241128175223.15604-1-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The 'pci-vga' device allow setting a 'big-endian-framebuffer' property since commit 3c2784fc864 ("vga: Expose framebuffer byteorder as a QOM property"). Similarly, the 'virtio-vga' device since commit 8be61ce2ce3 ("virtio-vga: implement big-endian-framebuffer property"). Both call vga_common_reset() in their reset handler, respectively pci_secondary_vga_reset() and virtio_vga_base_reset_hold(), which reset 'big_endian_fb', overwritting the property. This is not correct: the hardware is expected to keep its configured endianness during resets. Move 'big_endian_fb' assignment from vga_common_reset() to vga_common_init() which is called once when the common VGA state is initialized. 'default_endian_fb' value is always target_words_bigendian(), remove it as it isn't very useful. Signed-off-by: Philippe Mathieu-Daudé --- hw/display/vga_int.h | 1 - hw/display/vga.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h index f77c1c11457..5dcdecfd422 100644 --- a/hw/display/vga_int.h +++ b/hw/display/vga_int.h @@ -135,7 +135,6 @@ typedef struct VGACommonState { bool full_update_text; bool full_update_gfx; bool big_endian_fb; - bool default_endian_fb; bool global_vmstate; /* hardware mouse cursor support */ uint32_t invalidated_y_table[VGA_MAX_HEIGHT / 32]; diff --git a/hw/display/vga.c b/hw/display/vga.c index 892fedc8dce..6dbbbf49073 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -1873,7 +1873,6 @@ void vga_common_reset(VGACommonState *s) s->cursor_start = 0; s->cursor_end = 0; s->cursor_offset = 0; - s->big_endian_fb = s->default_endian_fb; memset(s->invalidated_y_table, '\0', sizeof(s->invalidated_y_table)); memset(s->last_palette, '\0', sizeof(s->last_palette)); memset(s->last_ch_attr, '\0', sizeof(s->last_ch_attr)); @@ -2117,7 +2116,7 @@ static bool vga_endian_state_needed(void *opaque) * default one, thus ensuring backward compatibility for * migration of the common case */ - return s->default_endian_fb != s->big_endian_fb; + return s->big_endian_fb != target_words_bigendian(); } static const VMStateDescription vmstate_vga_endian = { @@ -2265,7 +2264,7 @@ bool vga_common_init(VGACommonState *s, Object *obj, Error **errp) * into a device attribute set by the machine/platform to remove * all target endian dependencies from this file. */ - s->default_endian_fb = target_words_bigendian(); + s->big_endian_fb = target_words_bigendian(); vga_dirty_log_start(s);