Fixes and updates for hppa target
cover Fixes and updates for hppa target
This patchset fixes some important bugs in the hppa artist graphics driver:
- Fix framebuffer access for Linux
- Mouse cursor fixes for HP-UX
New qemu features for hppa:
- Allow up to 16 emulated CPUs (instead of 8)
- Add support for an emulated TOC/NMI button
A new Seabios-hppa firmware:
- Update SeaBIOS-hppa to VERSION 3
- New opt/hostid fw_cfg option to change hostid
- Add opt/console fw_cfg option to select default console
- Added 16x32 font to STI firmware
Helge Deller (5):
seabios-hppa: Update SeaBIOS-hppa to VERSION 3 hw/hppa: Allow up to 16 emulated CPUs
hppa: Add support for an emulated TOC/NMI button. hw/display/artist: Mouse cursor fixes for HP-UX hw/display/artist: Fix framebuffer access for Linux
hw/display/artist.c | 58 +++++++++++++++++++++++++++----------- hw/hppa/hppa_hardware.h | 5 ++-- hw/hppa/machine.c | 35 ++++++++++++++++++++++- pc-bios/hppa-firmware.img | Bin 757144 -> 701964 bytes roms/seabios-hppa | 2 +- target/hppa/cpu.c | 2 +- target/hppa/cpu.h | 5 ++++ target/hppa/helper.h | 1 + target/hppa/insns.decode | 1 + target/hppa/int_helper.c | 19 ++++++++++++- target/hppa/op_helper.c | 7 ++++- target/hppa/translate.c | 10 +++++++ 12 files changed, 122 insertions(+), 23 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/5 seabios-hppa: Update SeaBIOS-hppa to VERSION 3
New firmware features and fixes:
* Allow up to 16 CPUs
* Add TOC button support:
To trigger a TOC, execute "nmi" in the qemu monitor (Ctrl-A C)
* New opt/hostid fw_cfg option to change hostid:
-fw_cfg opt/hostid,string=334455
* Add opt/console fw_cfg option to select default console:
-fw_cfg opt/console,string=serial
-fw_cfg opt/console,string=graphics
* Add Linux TER16x32 font to STI firmware:
-fw_cfg opt/font,string=2
* Leave IRQs disabled after rendevouz
--- pc-bios/hppa-firmware.img | Bin 757144 -> 701964 bytes roms/seabios-hppa | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-)
pc-bios/hppa-firmware.img binary +0 -0
roms/seabios-hppa +1 -1
@@ -1 +1 @@ -Subproject commit b12acac4be27b6d5d9fbe48c4be1286dcc245fbb +Subproject commit ca4add256818419bc85a14d5d2c57ffed40a81fe
--
2.31.1
PATCH 2/5 hw/hppa: Allow up to 16 emulated CPUs
In reply to Helge DellerThis brings the hppa_hardware.h file in sync with the copy in the SeaBIOS-hppa sources.
In order to support up to 16 CPUs, it's required to move the HPA for MEMORY_HPA out of the address space of the 16th CPU.
--- hw/hppa/hppa_hardware.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/hppa/hppa_hardware.h +3 -2
@@ -25,7 +25,7 @@#define LASI_GFX_HPA 0xf8000000#define ARTIST_FB_ADDR 0xf9000000#define CPU_HPA 0xfffb0000 -#define MEMORY_HPA 0xfffbf000 +#define MEMORY_HPA 0xfffff000#define PCI_HPA DINO_HPA/* PCI bus */ #define IDE_HPA 0xf9000000/* Boot disc controller */
@@ -43,9 +43,10 @@#define PORT_SERIAL1 (DINO_UART_HPA + 0x800)#define PORT_SERIAL2 (LASI_UART_HPA + 0x800) -#define HPPA_MAX_CPUS 8/* max. number of SMP CPUs */ +#define HPPA_MAX_CPUS 16/* max. number of SMP CPUs */ #define CPU_CLOCK_MHZ 250/* emulate a 250 MHz CPU */ #define CPU_HPA_CR_REG 7/* store CPU HPA in cr7 (SeaBIOS internal) */ +#define PIM_STORAGE_SIZE 600/* storage size of pdc_pim_toc_struct (64bit) */ #endif
--
2.31.1
PATCH 3/5 hppa: Add support for an emulated TOC/NMI button.
In reply to Helge DellerAlmost all PA-RISC machines have either a button that is labeled with 'TOC' or a BMC/GSP function to trigger a TOC. TOC is a non-maskable interrupt that is sent to the processor. This can be used for diagnostic purposes like obtaining a stack trace/register dump or to enter KDB/KGDB in Linux.
This patch adds support for such an emulated TOC button.
It wires up the qemu monitor "nmi" command to trigger a TOC. For that it provides the hppa_nmi function which is assigned to the nmi_monitor_handler function pointer. When called it raises the EXCP_TOC hardware interrupt in the hppa_cpu_do_interrupt() function. The interrupt function then calls the architecturally defined TOC function in SeaBIOS-hppa firmware (at fixed address 0xf0000000).
According to the PA-RISC PDC specification, the SeaBIOS firmware then writes the CPU registers into PIM (processor internal memmory) for later analysis. In order to write all registers it needs to know the contents of the CPU "shadow registers" and the IASQ- and IAOQ-back values. The IAOQ/IASQ values are provided by qemu in shadow registers when entering the SeaBIOS TOC function. This patch adds a new aritificial opcode "getshadowregs" (0xfffdead2) which restores the original values of the shadow registers. With this opcode SeaBIOS can store those registers as well into PIM before calling an OS-provided TOC handler.
To trigger a TOC, switch to the qemu monitor with Ctrl-A C, and type in the command "nmi". After the TOC started the OS-debugger, exit the qemu monitor with Ctrl-A C.
--- hw/hppa/machine.c | 35 ++++++++++++++++++++++++++++++++++- target/hppa/cpu.c | 2 +- target/hppa/cpu.h | 5 +++++ target/hppa/helper.h | 1 + target/hppa/insns.decode | 1 + target/hppa/int_helper.c | 19 ++++++++++++++++++- target/hppa/op_helper.c | 7 ++++++- target/hppa/translate.c | 10 ++++++++++ 8 files changed, 76 insertions(+), 4 deletions(-)
hw/hppa/machine.c +34 -1
@@ -17,6 +17,7 @@#include "hw/timer/i8254.h" #include "hw/char/serial.h" #include "hw/net/lasi_82596.h" +#include "hw/nmi.h" #include "hppa_sys.h" #include "qemu/units.h" #include "qapi/error.h"
@@ -355,6 +356,14 @@ static void hppa_machine_reset(MachineState *ms) cpu[0 ]->env.gr[19 ] =FW_CFG_IO_BASE ; } +static void hppa_nmi (NMIState *n,int cpu_index,Error **errp) +{ +CPUState *cs; + +CPU_FOREACH (cs) { +cpu_interrupt (cs,CPU_INTERRUPT_NMI ); + } +}static void machine_hppa_machine_init (MachineClass *mc) {
@@ -371,4 +380,28 @@ static void machine_hppa_machine_init(MachineClass *mc) mc->default_ram_id ="ram" ; } -DEFINE_MACHINE ("hppa" , machine_hppa_machine_init) +static void machine_hppa_machine_init_class_init (ObjectClass *oc,void *data) +{ +MachineClass *mc =MACHINE_CLASS (oc); +machine_hppa_machine_init (mc); + +NMIClass *nc =NMI_CLASS (oc); + nc->nmi_monitor_handler = hppa_nmi; +} + +static const TypeInfo machine_hppa_machine_init_typeinfo = { + .name = ("hppa" "-machine" ), + .parent ="machine" , + .class_init = machine_hppa_machine_init_class_init, + .interfaces = (InterfaceInfo []) { + {TYPE_NMI }, + { } + }, +}; + +static void machine_hppa_machine_init_register_types (void ) +{ +type_register_static (&machine_hppa_machine_init_typeinfo); +} + +type_init (machine_hppa_machine_init_register_types)
target/hppa/cpu.c +1 -1
@@ -62,7 +62,7 @@ static void hppa_cpu_synchronize_from_tb(CPUState *cs,static bool hppa_cpu_has_work (CPUState *cs) { -return cs->interrupt_request &CPU_INTERRUPT_HARD ; +return cs->interrupt_request & (CPU_INTERRUPT_HARD |CPU_INTERRUPT_NMI ); }static void hppa_cpu_disas_set_info (CPUState *cs,disassemble_info *info)
target/hppa/cpu.h +5 -0
@@ -69,6 +69,11 @@#define EXCP_SYSCALL 30#define EXCP_SYSCALL_LWS 31 +/* Emulated hardware TOC button */ +#define EXCP_TOC 32/* TOC = Transfer of control (NMI) */ + +#define CPU_INTERRUPT_NMI CPU_INTERRUPT_TGT_EXT_3/* TOC */ +/* Taken from Linux kernel: arch/parisc/include/asm/psw.h */ #define PSW_I 0x00000001#define PSW_D 0x00000002
target/hppa/helper.h +1 -0
@@ -80,6 +80,7 @@ DEF_HELPER_FLAGS_0(read_interval_timer, TCG_CALL_NO_RWG, tr)#ifndef CONFIG_USER_ONLY DEF_HELPER_1(halt, noreturn, env) DEF_HELPER_1(reset, noreturn, env) +DEF_HELPER_1(getshadowregs, void, env) DEF_HELPER_1(rfi, void, env) DEF_HELPER_1(rfi_r, void, env)DEF_HELPER_FLAGS_2 (write_interval_timer,TCG_CALL_NO_RWG , void, env, tr)
target/hppa/insns.decode +1 -0
@@ -111,6 +111,7 @@ rfi_r 000000 ----- ----- --- 01100101 00000 # They are allocated from the unassigned instruction space. halt 1111 1111 1111 1101 1110 1010 1101 0000 reset 1111 1111 1111 1101 1110 1010 1101 0001 +getshadowregs 1111 1111 1111 1101 1110 1010 1101 0010 #### # Memory Management
target/hppa/int_helper.c +18 -1
@@ -23,6 +23,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "hw/core/cpu.h" +#include "hw/hppa/hppa_hardware.h" #ifndef CONFIG_USER_ONLY static void eval_interrupt (HPPACPU *cpu)
@@ -181,7 +182,14 @@ void hppa_cpu_do_interrupt(CPUState *cs) }/* step 7 */ - env->iaoq_f = env->cr[CR_IVA ] +32 * i; +if (i ==EXCP_TOC ) { + env->iaoq_f =FIRMWARE_START ; +/* help SeaBIOS and provide iaoq_b and iasq_back in shadow regs */ + env->gr[24 ] = env->cr_back[0 ]; + env->gr[25 ] = env->cr_back[1 ]; + }else { + env->iaoq_f = env->cr[CR_IVA ] +32 * i; + } env->iaoq_b = env->iaoq_f +4 ; env->iasq_f =0 ; env->iasq_b =0 ;
@@ -219,6 +227,7 @@ void hppa_cpu_do_interrupt(CPUState *cs) [EXCP_PER_INTERRUPT] = "performance monitor interrupt", [EXCP_SYSCALL] = "syscall", [EXCP_SYSCALL_LWS] = "syscall-lws", + [EXCP_TOC] = "TOC (transfer of control)", };static int count;const char *name =NULL ;
@@ -248,6 +257,14 @@ bool hppa_cpu_exec_interrupt(CPUState *cs, int interrupt_request)HPPACPU *cpu =HPPA_CPU (cs);CPUHPPAState *env = &cpu->env; +if (interrupt_request &CPU_INTERRUPT_NMI ) { +/* Raise TOC (NMI) interrupt */ +cpu_reset_interrupt (cs,CPU_INTERRUPT_NMI ); + cs->exception_index =EXCP_TOC ; +hppa_cpu_do_interrupt (cs); +return true; + } +/* If interrupts are requested and enabled, raise them. */ if ((env->psw &PSW_I ) && (interrupt_request &CPU_INTERRUPT_HARD )) { cs->exception_index =EXCP_EXT_INTERRUPT ;
target/hppa/op_helper.c +6 -1
@@ -694,7 +694,7 @@ void HELPER(rfi)(CPUHPPAState *env)cpu_hppa_put_psw (env, env->cr[CR_IPSW ]); } -void HELPER (rfi_r )(CPUHPPAState *env) +void HELPER (getshadowregs )(CPUHPPAState *env) { env->gr[1 ] = env->shadow[0 ]; env->gr[8 ] = env->shadow[1 ];
@@ -703,6 +703,11 @@ void HELPER(rfi_r)(CPUHPPAState *env) env->gr[17 ] = env->shadow[4 ]; env->gr[24 ] = env->shadow[5 ]; env->gr[25] = env->shadow[6]; +} + +void HELPER (rfi_r )(CPUHPPAState *env) +{ +helper_getshadowregs (env);helper_rfi (env); }#endif
target/hppa/translate.c +10 -0
@@ -2393,6 +2393,16 @@ static bool trans_reset(DisasContext *ctx, arg_reset *a)#endif } +static bool trans_getshadowregs (DisasContext *ctx,arg_getshadowregs *a) +{ +CHECK_MOST_PRIVILEGED (EXCP_PRIV_OPR ); +#ifndef CONFIG_USER_ONLY +nullify_over (ctx); +gen_helper_getshadowregs (cpu_env); +return nullify_end (ctx); +#endif +} +static bool trans_nop_addrx (DisasContext *ctx,arg_ldst *a) {if (a->m) {
--
2.31.1
PATCH 4/5 hw/display/artist: Mouse cursor fixes for HP-UX
In reply to Helge DellerThis patch fix the behaviour and positioning of the X11 mouse cursor in HP-UX.
The current code missed to subtract the offset of the CURSOR_CTRL register from the current mouse cursor position. The HP-UX graphics driver stores in this register the offset of the mouse graphics compared to the current cursor position. Without this adjustment the mouse behaves strange at the screen borders.
Additionally, depending on the HP-UX version, the mouse cursor position in the cursor_pos register reports different values. To accommodate this track the current min and max reported values and auto-adjust at runtime.
With this fix the mouse now behaves as expected on HP-UX 10 and 11.
--- hw/display/artist.c | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-)
hw/display/artist.c +34 -8
@@ -80,6 +80,7 @@ struct ARTISTState {uint32_t line_pattern_skip;uint32_t cursor_pos; +uint32_t cursor_cntrl;uint32_t cursor_height;uint32_t cursor_width;
@@ -328,19 +329,42 @@ static void artist_get_cursor_pos(ARTISTState *s, int *x, int *y) {/* * Don't know whether these magic offset values are configurable via -* some register. They are the same for all resolutions, so don't -* bother about it. +* some register. They seem to be the same for all resolutions. +* The cursor values provided in the registers are: +* X-value: -295 (for HP-UX 11) and 338 (for HP-UX 10.20) up to 2265 +* Y-value: 1146 down to 0 +* The emulated Artist graphic is like a CRX graphic, and as such +* it's usually fixed at 1280x1024 pixels. +* Because of the maximum Y-value of 1146 you can not choose a higher +* vertical resolution on HP-UX (unless you disable the mouse). */ - *y =0x47a -artist_get_y (s->cursor_pos); - *x = ((artist_get_x (s->cursor_pos) -338 ) /2 ); +static int offset =338 ; +int lx; + +/* ignore if uninitialized */ +if (s->cursor_pos ==0 ) { + *x = *y =0 ; +return ; + } + + lx =artist_get_x (s->cursor_pos); +if (lx < offset) + offset = lx; + *x = (lx - offset) /2 ; + + *y =1146 -artist_get_y (s->cursor_pos); + +/* subtract cursor offset from cursor control register */ + *x -= (s->cursor_cntrl &0xf0 ) >>4 ; + *y -= (s->cursor_cntrl &0x0f );if (*x > s->width) { - *x =0 ; + *x = s->width; }if (*y > s->height) { - *y =0 ; + *y = s->height; } }
@@ -1034,6 +1058,7 @@ static void artist_reg_write(void *opaque, hwaddr addr, uint64_t val,break ;case CURSOR_CTRL : +combine_write_reg (addr, val, size, &s->cursor_cntrl);break ;case IMAGE_BITMAP_OP :
@@ -1422,8 +1447,8 @@ static int vmstate_artist_post_load(void *opaque, int version_id)static const VMStateDescription vmstate_artist = { .name ="artist" , - .version_id =1 , - .minimum_version_id =1 , + .version_id =2 , + .minimum_version_id =2 , .post_load = vmstate_artist_post_load, .fields = (VMStateField []) {VMSTATE_UINT16 (height, ARTISTState),
@@ -1443,6 +1468,7 @@ static const VMStateDescription vmstate_artist = {VMSTATE_UINT32 (line_end, ARTISTState),VMSTATE_UINT32 (line_xy, ARTISTState),VMSTATE_UINT32 (cursor_pos, ARTISTState), +VMSTATE_UINT32 (cursor_cntrl, ARTISTState),VMSTATE_UINT32 (cursor_height, ARTISTState),VMSTATE_UINT32 (cursor_width, ARTISTState), VMSTATE_UINT32(plane_mask, ARTISTState),
--
2.31.1
PATCH 5/5 hw/display/artist: Fix framebuffer access for Linux
In reply to Helge DellerThis patch fixes two problems which prevented Linux to access the artist graphics framebuffer:
The check if the framebuffer or the color map should be accessed was incomplete. By using the vram_read/write_bufidx() functions we now check correctly if ARTIST_BUFFER_CMAP should be accessed.
The second fix is to correctly calculate the X- and Y-coordinates and check against the graphics resolution.
With this fix in place, the Linux stifb driver now works correctly, shows the penguins at bootup and uses the stifb as graphics console. I haven't seen any negative side effects when running HP-UX.
--- hw/display/artist.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
hw/display/artist.c +8 -8
@@ -1186,7 +1186,7 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val,unsigned int offset;trace_artist_vram_write (size, addr, val); -if (s->cmap_bm_access) { +if (vram_write_bufidx (s) ==ARTIST_BUFFER_CMAP ) { buf = &s->vram_buffer[ARTIST_BUFFER_CMAP ];if (addr +3 < buf->size) { *(uint32_t *)(buf->data + addr) = val;
@@ -1195,14 +1195,14 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val, } buf =vram_write_buffer (s); - posy =ADDR_TO_Y (addr >>2 ); - posx =ADDR_TO_X (addr >>2 ); + posy =ADDR_TO_Y (addr); + posx =ADDR_TO_X (addr);if (!buf->size) {return ; } -if (posy > buf->height || posx > buf->width) { +if (posy >= buf->height || posx >= buf->width) {return ; }
@@ -1242,7 +1242,7 @@ static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size)uint64_t val;unsigned int posy, posx; -if (s->cmap_bm_access) { +if (vram_read_bufidx (s) ==ARTIST_BUFFER_CMAP ) { buf = &s->vram_buffer[ARTIST_BUFFER_CMAP ]; val =0 ;if (addr < buf->size && addr +3 < buf->size) {
@@ -1257,10 +1257,10 @@ static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size)return 0 ; } - posy =ADDR_TO_Y (addr >>2 ); - posx =ADDR_TO_X (addr >>2 ); + posy =ADDR_TO_Y (addr); + posx =ADDR_TO_X (addr); -if (posy > buf->height || posx > buf->width) { +if (posy >= buf->height || posx >= buf->width) {return 0 ; }
--
2.31.1
Re: [PATCH 5/5] hw/display/artist: Fix framebuffer access for Linux
+Sven
Quoted 7 lines · Helge Deller
This patch fixes two problems which prevented Linux to access the artist graphics framebuffer:
The check if the framebuffer or the color map should be accessed was incomplete. By using the vram_read/write_bufidx() functions we now check correctly if
ARTIST_BUFFER_CMAPshould be accessed.
Quoted 5 lines
The second fix is to correctly calculate the X- and Y-coordinates and check against the graphics resolution.
With this fix in place, the Linux stifb driver now works correctly, shows the penguins at bootup and uses the stifb as graphics console.
Cool, could you add a test similar to these?
$ git grep Tux tests/avocado/ tests/avocado/machine_arm_integratorcp.py:69: Boot Linux and verify the Tux logo is displayed on the framebuffer. tests/avocado/machine_mips_malta.py:44: Boot Linux kernel and check Tux logo is displayed on the framebuffer.
Quoted 66 lines
I haven't seen any negative side effects when running HP-UX.
Signed-off-by Helge Deller <[email protected]>--- hw/display/artist.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)hw/display/artist.c +8
-9@@ -1186,7 +1186,7 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val,unsigned int offset;trace_artist_vram_write (size, addr, val); -if (s->cmap_bm_access) { +if (vram_write_bufidx (s) ==ARTIST_BUFFER_CMAP ) { buf = &s->vram_buffer[ARTIST_BUFFER_CMAP ];if (addr +3 < buf->size) { *(uint32_t *)(buf->data + addr) = val;@@ -1195,14 +1195,14 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val, } buf =vram_write_buffer (s); - posy =ADDR_TO_Y (addr >>2 ); - posx =ADDR_TO_X (addr >>2 ); + posy =ADDR_TO_Y (addr); + posx =ADDR_TO_X (addr);if (!buf->size) {return ; } -if (posy > buf->height || posx > buf->width) { +if (posy >= buf->height || posx >= buf->width) {return ; }@@ -1242,7 +1242,7 @@ static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size)uint64_t val;unsigned int posy, posx; -if (s->cmap_bm_access) { +if (vram_read_bufidx (s) ==ARTIST_BUFFER_CMAP ) { buf = &s->vram_buffer[ARTIST_BUFFER_CMAP ]; val =0 ;if (addr < buf->size && addr +3 < buf->size) {@@ -1257,10 +1257,10 @@ static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size)return 0 ; } - posy =ADDR_TO_Y (addr >>2 ); - posx =ADDR_TO_X (addr >>2 ); + posy =ADDR_TO_Y (addr); + posx =ADDR_TO_X (addr); -if (posy > buf->height || posx > buf->width) { +if (posy >= buf->height || posx >= buf->width) {return 0 ; } --2.31.1
Re: [PATCH 5/5] hw/display/artist: Fix framebuffer access for Linux
Quoted 14 lines · Philippe Mathieu-Daudé
+Sven
Quoted 10 lines · Helge Deller
This patch fixes two problems which prevented Linux to access the artist graphics framebuffer:
The check if the framebuffer or the color map should be accessed was incomplete. By using the vram_read/write_bufidx() functions we now check correctly ifARTIST_BUFFER_CMAPshould be accessed.
The second fix is to correctly calculate the X- and Y-coordinates and
check against the graphics resolution.
With this fix in place, the Linux stifb driver now works correctly, shows the penguins at bootup and uses the stifb as graphics console.
Quoted 9 lines
Cool, could you add a test similar to these?
$ git grep Tux tests/avocado/ tests/avocado/machine_arm_integratorcp.py:69: Boot Linux and verify the Tux logo is displayed on the framebuffer. tests/avocado/machine_mips_malta.py:44: Boot Linux kernel and check Tux logo is displayed on the framebuffer.Quoted 1 line
I haven't seen any negative side effects when running HP-UX.
Hmm, the patch below breaks hp-ux 10.20 for me, please see the attached screenshot.
Quoted 55 lines
Quoted 55 lines
Signed-off-by Helge Deller <[email protected]>--- hw/display/artist.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)hw/display/artist.c +8
-9@@ -1186,7 +1186,7 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val,unsigned int offset;trace_artist_vram_write (size, addr, val); -if (s->cmap_bm_access) { +if (vram_write_bufidx (s) ==ARTIST_BUFFER_CMAP ) { buf = &s->vram_buffer[ARTIST_BUFFER_CMAP ];if (addr +3 < buf->size) { *(uint32_t *)(buf->data + addr) = val;@@ -1195,14 +1195,14 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val, } buf =vram_write_buffer (s); - posy =ADDR_TO_Y (addr >>2 ); - posx =ADDR_TO_X (addr >>2 ); + posy =ADDR_TO_Y (addr); + posx =ADDR_TO_X (addr);if (!buf->size) {return ; } -if (posy > buf->height || posx > buf->width) { +if (posy >= buf->height || posx >= buf->width) {return ; }@@ -1242,7 +1242,7 @@ static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size) uint64_t val;unsigned int posy, posx; -if (s->cmap_bm_access) { +if (vram_read_bufidx (s) ==ARTIST_BUFFER_CMAP ) { buf = &s->vram_buffer[ARTIST_BUFFER_CMAP ]; val =0 ;if (addr < buf->size && addr +3 < buf->size) {@@ -1257,10 +1257,10 @@ static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size)return 0 ; } - posy =ADDR_TO_Y (addr >>2 ); - posx =ADDR_TO_X (addr >>2 ); + posy =ADDR_TO_Y (addr); + posx =ADDR_TO_X (addr); -if (posy > buf->height || posx > buf->width) { +if (posy >= buf->height || posx >= buf->width) {return 0 ; } --2.31.1
Re: [PATCH 5/5] hw/display/artist: Fix framebuffer access for Linux
Quoted 24 lines · Sven Schnelle
Quoted 22 lines · Philippe Mathieu-Daudé
+Sven
Quoted 10 lines · Helge Deller
This patch fixes two problems which prevented Linux to access the artist graphics framebuffer:
The check if the framebuffer or the color map should be accessed was incomplete. By using the vram_read/write_bufidx() functions we now check correctly ifARTIST_BUFFER_CMAPshould be accessed.
The second fix is to correctly calculate the X- and Y-coordinates and
check against the graphics resolution.
With this fix in place, the Linux stifb driver now works correctly, shows the penguins at bootup and uses the stifb as graphics console.Cool, could you add a test similar to these?
$ git grep Tux tests/avocado/ tests/avocado/machine_arm_integratorcp.py:69: Boot Linux and verify the Tux logo is displayed on the framebuffer. tests/avocado/machine_mips_malta.py:44: Boot Linux kernel and check Tux logo is displayed on the framebuffer.
Quoted 5 lines
Quoted 1 line
Quoted 1 line
I haven't seen any negative side effects when running HP-UX.
Hmm, the patch below breaks hp-ux 10.20 for me, please see the attached screenshot.
I think my initial thought that the register 118000 is the buffer access mode for the color map is just wrong. I think it's setting the SRC & DST buffer access mode at the same time because on the Visualize FX cards we have similar registers:
#define B2_FBC_BABoth 0x00920804 /* DBA & SBA (reads return DBA) (RW) */ #define B2_FBC_DBA 0x00920808 /* Destination Bitmap Access Register (RW) */ #define B2_FBC_SBA 0x0092080C /* Source Bitmap Access Register (RW) */
Looking at Artist, we have:
CMAP_BM_ACCESS = 0x118000DST_BM_ACCESS = 0x118004SRC_BM_ACCESS = 0x118008
Given that artist and visualize fx are very similar when it comes to 2D acceleration, i think CMAP_BM_ACCESS is just changing both registers, completely unrelated to the color map. I tried changing the code, but of course that breaks a lot of things. Let me see whether i can make that work.
/Sven