ati-vga: Add work around for fuloong2e
With the linear aperture size fixed to match real card fuloong2e no longer works due to running out of PCI memory because only one PCI bus is emulated on that machine. Add a property to allow fuloong2e to set a smaller linear aperture size to work around that problem until the machine model is improved. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Chad Jablonski <chad@jablonski.xyz> Message-ID: <47cbdc7ad2291f22467f9fc86e7287eb8983c927.1774110169.git.balaton@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
BALATON Zoltan committed
Mar 21, 2026 at 17:30 UTC
c1315534f3b1e696c83422d305a44554b3935dd6
3 files changed
+15
-4
hw/display/ati.c
+13
-4
@@ -1059,7 +1059,6 @@ static void ati_vga_realize(PCIDevice *dev, Error **errp)
1059
ATIVGAState *s = ATI_VGA(dev);
1060
VGACommonState *vga = &s->vga;
1061
I2CBus *i2cbus;
1062
- uint64_t aper_size;
1062
1063
#ifndef CONFIG_PIXMAN
1064
if (s->use_pixman != 0) {
@@ -1123,10 +1122,19 @@ static void ati_vga_realize(PCIDevice *dev, Error **errp)
1122
* Rage128 the upper half of the aperture is reserved for an AGP
1123
* window (which we do not emulate.)
1124
*/
1126
- aper_size = s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF ?
1127
- ATI_RAGE128_LINEAR_APER_SIZE : ATI_R100_LINEAR_APER_SIZE;
1125
+ if (!s->linear_aper_sz) {
1126
+ if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) {
1127
+ s->linear_aper_sz = ATI_RAGE128_LINEAR_APER_SIZE;
1128
+ } else {
1129
+ s->linear_aper_sz = ATI_R100_LINEAR_APER_SIZE;
1130
+ }
1131
+ }
1132
+ if (s->linear_aper_sz < 16 * MiB) {
1133
+ error_setg(errp, "x-linear-aper-size is too small (minimum 16 MiB)");
1134
+ return;
1135
+ }
1136
memory_region_init(&s->linear_aper, OBJECT(dev), "ati-linear-aperture0",
1129
- aper_size);
1137
+ s->linear_aper_sz);
1138
memory_region_add_subregion(&s->linear_aper, 0, &vga->vram);
1139
1140
pci_register_bar(dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->linear_aper);
@@ -1171,6 +1179,7 @@ static const Property ati_vga_properties[] = {
1179
DEFINE_PROP_BOOL("guest_hwcursor", ATIVGAState, cursor_guest_mode, false),
1180
/* this is a debug option, prefer PROP_UINT over PROP_BIT for simplicity */
1181
DEFINE_PROP_UINT8("x-pixman", ATIVGAState, use_pixman, DEFAULT_X_PIXMAN),
1182
+ DEFINE_PROP_UINT64("x-linear-aper-size", ATIVGAState, linear_aper_sz, 0),
1183
DEFINE_EDID_PROPERTIES(ATIVGAState, i2cddc.edid_info),
1184
};
1185
hw/display/ati_int.h
+1
@@ -119,6 +119,7 @@ struct ATIVGAState {
119
QEMUTimer vblank_timer;
120
bitbang_i2c_interface bbi2c;
121
I2CDDCState i2cddc;
122
+ uint64_t linear_aper_sz;
123
MemoryRegion linear_aper;
124
MemoryRegion io;
125
MemoryRegion mm;
hw/mips/fuloong2e.c
+1
@@ -316,6 +316,7 @@ static void mips_fuloong2e_init(MachineState *machine)
316
dev = DEVICE(pci_dev);
317
qdev_prop_set_uint32(dev, "vgamem_mb", 16);
318
qdev_prop_set_uint16(dev, "x-device-id", 0x5159);
319
+ qdev_prop_set_uint64(dev, "x-linear-aper-size", 16 * MiB);
320
pci_realize_and_unref(pci_dev, pci_bus, &error_fatal);
321
}
322