From patchwork Tue Apr 2 13:16:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1918825 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PpO7df6p; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V87jj2vJ0z1yY4 for ; Wed, 3 Apr 2024 00:18:17 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rre17-00073P-IW; Tue, 02 Apr 2024 09:17:34 -0400 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 1rre0s-00061Y-A8 for qemu-devel@nongnu.org; Tue, 02 Apr 2024 09:17:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rre0i-0006Vc-HR for qemu-devel@nongnu.org; Tue, 02 Apr 2024 09:17:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712063825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sXc6p7CLAD9wC+be/di+J8sDpAR+vHjnFWOEwaQyh7w=; b=PpO7df6p+cg33wwPfQpiuELIc+R1pKoMhG4hA/WHqTfOpDGsaSBZJApLFCibPjPU6+nkZ/ 0bXcVOHZRI2PXcolYtOaPXz8eU4tRUNN3l7PnwDcd2f1ZIjDf/S9Zp3lA3X7NiBATmKmLC cePlqb+Wa58I5AXoc6fb7ez2FBUKZWQ= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-56-H9jqlAbaNkq-OH6lbvQlhQ-1; Tue, 02 Apr 2024 09:17:04 -0400 X-MC-Unique: H9jqlAbaNkq-OH6lbvQlhQ-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-33ec308655eso1440219f8f.0 for ; Tue, 02 Apr 2024 06:17:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712063822; x=1712668622; 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=sXc6p7CLAD9wC+be/di+J8sDpAR+vHjnFWOEwaQyh7w=; b=xSyq7PwGtT6VsLFqCSf60jYedrj3+8+GVnSji3Huqn29jmMLQMOwoGL8T1rDsHRbf7 nguDYq7jBmk5rgbsADWeE/TDzb5q07NoyCBuY/2EkmulwIaETUYaOTmVc3NU3sZ4EnsS 9wCiOm0i87reudrOFiJq68N/4cdXTiHGrtrWmkqhDO4a7tcYBQzfLmixhNmA5UIbwEXo whZg2CZYtC0wdUj1yE3OuS9C29TE9QTWhOzVTUA2mM+WxewFNH/bS+VrjGRWcPAETHhD U8jjyehANT7Lby4RFys4D1PhSLdj39yCF2t7h86fBiHMYAePxaOhIuXL9eEdWSgId3ts QVJg== X-Gm-Message-State: AOJu0Yz9aYmfFmmR5W+m2ycgFnd+tsQh2Z9cwoSgc4yz6AHEaTYY+Pld j8Opof+iKC3vadb4lIwKJItiVAhQWrC/7KxyJlm6wLexkX+3kJp+T584LlooVWySFdxrXok1NKl qB0Ndicr3z7WK8hKeOEYKuGNnqAnevyGlkoyf61ousMB8ao9ijVCt1AR6oMazEnY33BNGw9JCqM Rgoj64oSTQkNP5tnerF+qDfVfgjp0tLBNFFbr1 X-Received: by 2002:adf:ee85:0:b0:343:6a91:5080 with SMTP id b5-20020adfee85000000b003436a915080mr1200186wro.29.1712063822147; Tue, 02 Apr 2024 06:17:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdSYup3aOvDZ/oAcWikjhBFeRtMHdRh4jZ3+KlRysp7x4TCHP3BMHL9CGarEXyf5b1NnpeXA== X-Received: by 2002:adf:ee85:0:b0:343:6a91:5080 with SMTP id b5-20020adfee85000000b003436a915080mr1200175wro.29.1712063821779; Tue, 02 Apr 2024 06:17:01 -0700 (PDT) Received: from avogadro.local ([151.95.49.219]) by smtp.gmail.com with ESMTPSA id dq2-20020a0560000cc200b00341e24a586fsm14081270wrb.93.2024.04.02.06.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 06:17:00 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Helge Konetzka , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 3/7] vga: adjust dirty memory region if pel panning is active Date: Tue, 2 Apr 2024 15:16:45 +0200 Message-ID: <20240402131649.23225-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240402131649.23225-1-pbonzini@redhat.com> References: <20240402131649.23225-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When pel panning is active, one more byte is read from each of the VGA memory planes. This has to be accounted in the computation of region_end, otherwise vga_draw_graphic() fails an assertion: qemu-system-i386: ../system/physmem.c:946: cpu_physical_memory_snapshot_get_dirty: Assertion `start + length <= snap->end' failed. Reported-by: Helge Konetzka Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2244 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- hw/display/vga.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/display/vga.c b/hw/display/vga.c index b4ceff70eb8..40acd19e72a 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -1571,11 +1571,15 @@ static void vga_draw_graphic(VGACommonState *s, int full_update) break; } } + hpel = bits <= 8 ? s->params.hpel : 0; region_start = (s->params.start_addr * 4); region_end = region_start + (ram_addr_t)s->params.line_offset * height; region_end += width * depth / 8; /* scanline length */ region_end -= s->params.line_offset; + if (hpel) { + region_end += 4; + } if (region_end > s->vbe_size || depth == 0 || depth == 15) { /* * We land here on: @@ -1660,7 +1664,6 @@ static void vga_draw_graphic(VGACommonState *s, int full_update) width, height, v, line_offset, s->cr[9], s->cr[VGA_CRTC_MODE], s->params.line_compare, sr(s, VGA_SEQ_CLOCK_MODE)); #endif - hpel = bits <= 8 ? s->params.hpel : 0; addr1 = (s->params.start_addr * 4); bwidth = DIV_ROUND_UP(width * bits, 8); if (hpel) {