qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 7437b1: macfb: handle errors that occur durin


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] 7437b1: macfb: handle errors that occur during realize
Date: Fri, 08 Oct 2021 05:03:34 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 7437b13eacfd05ed6817c2f05c4712ed618544e1
      
https://github.com/qemu/qemu/commit/7437b13eacfd05ed6817c2f05c4712ed618544e1
  Author: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M hw/display/macfb.c

  Log Message:
  -----------
  macfb: handle errors that occur during realize

Make sure any errors that occur within the macfb realize chain are detected
and handled correctly to prevent crashes and to ensure that error messages are
reported back to the user.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211007221253.29024-2-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: c047862acd502c305fbdc66a4a3fd717c04fa6d2
      
https://github.com/qemu/qemu/commit/c047862acd502c305fbdc66a4a3fd717c04fa6d2
  Author: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M hw/display/macfb.c

  Log Message:
  -----------
  macfb: update macfb.c to use the Error API best practices

As per the current Error API best practices, change macfb_commom_realize() to 
return
a boolean indicating success to reduce errp boiler-plate handling code. Note 
that
memory_region_init_ram_nomigrate() is also updated to use &error_abort to 
indicate
a non-recoverable error, matching the behaviour recommended after similar
discussions on memory API failures for the recent nubus changes.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211007221253.29024-3-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 906c2323f1edf41b1851e7e36231023ee930aa3c
      
https://github.com/qemu/qemu/commit/906c2323f1edf41b1851e7e36231023ee930aa3c
  Author: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M hw/display/macfb.c

  Log Message:
  -----------
  macfb: fix invalid object reference in macfb_common_realize()

During realize memory_region_init_ram_nomigrate() is used to initialise the RAM
memory region used for the framebuffer but the owner object reference is
incorrect since MacFbState is a typedef and not a QOM type.

Change the memory region owner to be the corresponding DeviceState to fix the
issue and prevent random crashes during macfb_common_realize().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fixes: 8ac919a0654 ("hw/m68k: add Nubus macfb video card")
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211007221253.29024-4-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 14d0ddfce781374b7ce40062c0afc2ed00419267
      
https://github.com/qemu/qemu/commit/14d0ddfce781374b7ce40062c0afc2ed00419267
  Author: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M hw/display/macfb.c

  Log Message:
  -----------
  macfb: fix overflow of color_palette array

The palette_current index counter has a maximum size of 256 * 3 to cover a full
color palette of 256 RGB entries. Linux assumes that the palette_current index
wraps back around to zero after writing 256 RGB entries so ensure that
palette_current is reset at this point to prevent data corruption within
MacfbState.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211007221253.29024-5-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 3b10b5673c902981129d1817fcc235e467648200
      
https://github.com/qemu/qemu/commit/3b10b5673c902981129d1817fcc235e467648200
  Author: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M hw/display/macfb.c

  Log Message:
  -----------
  macfb: use memory_region_init_ram() in macfb_common_realize() for the 
framebuffer

Currently macfb_common_realize() defines the framebuffer RAM memory region as
being non-migrateable but then immediately registers it for migration. Replace
memory_region_init_ram_nomigrate() with memory_region_init_ram() which is 
clearer
and does exactly the same thing.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211007221253.29024-6-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 4ec27073fd0e5a82a87b1122dfdca7a820cb1561
      
https://github.com/qemu/qemu/commit/4ec27073fd0e5a82a87b1122dfdca7a820cb1561
  Author: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M hw/display/macfb.c
    M hw/display/trace-events

  Log Message:
  -----------
  macfb: add trace events for reading and writing the control registers

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211007221253.29024-7-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: e6108b96363bda0704ca69e5dfdb4b07dc589336
      
https://github.com/qemu/qemu/commit/e6108b96363bda0704ca69e5dfdb4b07dc589336
  Author: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M hw/display/macfb.c
    M hw/display/trace-events
    M include/hw/display/macfb.h

  Log Message:
  -----------
  macfb: implement mode sense to allow display type to be detected

The MacOS toolbox ROM uses the monitor sense to detect the display type and then
offer a fixed set of resolutions and colour depths accordingly. Implement the
monitor sense using information found in Apple Technical Note HW26: "Macintosh
Quadra Built-In Video" along with some local experiments.

Since the default configuration is 640 x 480 with 8-bit colour then hardcode
the sense register to return MACFB_DISPLAY_VGA for now.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211007221253.29024-8-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 4317c518618adcd5d41637c849be17e94cecf003
      
https://github.com/qemu/qemu/commit/4317c518618adcd5d41637c849be17e94cecf003
  Author: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M hw/display/macfb.c
    M hw/m68k/q800.c
    M include/hw/display/macfb.h

  Log Message:
  -----------
  macfb: add qdev property to specify display type

Since the available resolutions and colour depths are determined by the attached
display type, add a qdev property to allow the display type to be specified.

The main resolutions of interest are high resolution 1152x870 with 8-bit colour
and SVGA resolution up to 800x600 with 24-bit colour so update the q800 machine
to allow high resolution mode if specified and otherwise fall back to SVGA.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211007221253.29024-9-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: df8abbbadf743bef6be5543b26f51231285b8923
      
https://github.com/qemu/qemu/commit/df8abbbadf743bef6be5543b26f51231285b8923
  Author: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M hw/display/macfb.c
    M hw/display/trace-events
    M hw/m68k/q800.c
    M include/hw/display/macfb.h

  Log Message:
  -----------
  macfb: add common monitor modes supported by the MacOS toolbox ROM

The monitor modes table is found by experimenting with the Monitors Control
Panel in MacOS and analysing the reads/writes. From this it can be found that
the mode is controlled by writes to the DAFB_MODE_CTRL1 and DAFB_MODE_CTRL2
registers.

Implement the first block of DAFB registers as a register array including the
existing sense register, the newly discovered control registers above, and also
the DAFB_MODE_VADDR1 and DAFB_MODE_VADDR2 registers which are used by NetBSD to
determine the current video mode.

These experiments also show that the offset of the start of video RAM and the
stride can change depending upon the monitor mode, so update 
macfb_draw_graphic()
and both the BI_MAC_VADDR and BI_MAC_VROW bootinfo for the q800 machine
accordingly.

Finally update macfb_common_realize() so that only the resolution and depth
supported by the display type can be specified on the command line, and add an
error hint showing the list of supported resolutions and depths if the user 
tries
to specify an invalid display mode.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211007221253.29024-10-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 57eeaf44ce6964e6e86275318f5fc35610c1dc68
      
https://github.com/qemu/qemu/commit/57eeaf44ce6964e6e86275318f5fc35610c1dc68
  Author: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M hw/display/macfb.c

  Log Message:
  -----------
  macfb: fix up 1-bit pixel encoding

The MacOS driver expects the RGB values for the pixel to be in entries 0 and 1
of the colour palette.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211007221253.29024-11-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 432d59c56ef8a8eaefd847a40a01439e32317bff
      
https://github.com/qemu/qemu/commit/432d59c56ef8a8eaefd847a40a01439e32317bff
  Author: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M hw/display/macfb.c

  Log Message:
  -----------
  macfb: fix 24-bit RGB pixel encoding

According to Apple Technical Note HW26: "Macintosh Quadra Built-In Video" the
in-built framebuffer encodes each 24-bit pixel into 4 bytes. Adjust the 24-bit
RGB pixel encoding accordingly which agrees with the encoding expected by MacOS
when changing into 24-bit colour mode.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211007221253.29024-12-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: c7a2f7ba0c736a119d7b530693de0e1b691cdd5a
      
https://github.com/qemu/qemu/commit/c7a2f7ba0c736a119d7b530693de0e1b691cdd5a
  Author: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M hw/display/macfb.c
    M include/hw/display/macfb.h

  Log Message:
  -----------
  macfb: add vertical blank interrupt

The MacOS driver expects a 60.15Hz vertical blank interrupt to be generated by
the framebuffer which in turn schedules the mouse driver via the Vertical 
Retrace
Manager.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211007221253.29024-13-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: efd0c37edc8efe7dccc2356f4a07f33581bc9e67
      
https://github.com/qemu/qemu/commit/efd0c37edc8efe7dccc2356f4a07f33581bc9e67
  Author: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M hw/m68k/q800.c

  Log Message:
  -----------
  q800: wire macfb IRQ to separate video interrupt on VIA2

Whilst the in-built Quadra 800 framebuffer exists within the Nubus address
space for slot 9, it has its own dedicated interrupt on VIA2. Force the
macfb device to occupy slot 9 in the q800 machine and wire its IRQ to the
separate video interrupt since this is what is expected by the MacOS
interrupt handler.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211007221253.29024-14-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 15a0578903dc0d612e63f542d159fe1f3fb8a17a
      
https://github.com/qemu/qemu/commit/15a0578903dc0d612e63f542d159fe1f3fb8a17a
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M hw/display/macfb.c
    M hw/display/trace-events
    M hw/m68k/q800.c
    M include/hw/display/macfb.h

  Log Message:
  -----------
  Merge remote-tracking branch 
'remotes/vivier-m68k/tags/m68k-next-pull-request' into staging

Pull request q800 20211008

macfb: fixes for booting MacOS

# gpg: Signature made Fri 08 Oct 2021 04:44:44 AM PDT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" 
[full]

* remotes/vivier-m68k/tags/m68k-next-pull-request:
  q800: wire macfb IRQ to separate video interrupt on VIA2
  macfb: add vertical blank interrupt
  macfb: fix 24-bit RGB pixel encoding
  macfb: fix up 1-bit pixel encoding
  macfb: add common monitor modes supported by the MacOS toolbox ROM
  macfb: add qdev property to specify display type
  macfb: implement mode sense to allow display type to be detected
  macfb: add trace events for reading and writing the control registers
  macfb: use memory_region_init_ram() in macfb_common_realize() for the 
framebuffer
  macfb: fix overflow of color_palette array
  macfb: fix invalid object reference in macfb_common_realize()
  macfb: update macfb.c to use the Error API best practices
  macfb: handle errors that occur during realize

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Compare: https://github.com/qemu/qemu/compare/14f12119aa67...15a0578903dc



reply via email to

[Prev in Thread] Current Thread [Next in Thread]