Browse Source

Misc HW & Net patches

- Fix trace event name in m68k system controller
 - Constify and rename virtio_is_big_endian()
 - Fix heap buffer overflow in virtio-serial-bus
 - Set graphic display dimensions generically (removing system/globals-target.c)
 - Mark eth_header, udp_header, tcp_header as packed structures
 - Minor doc / header cleanups
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmmbj2wACgkQ4+MsLN6t
 wN7LqBAAq30ShByylpAJ7DvekgGOHCXeHSdVPZKB8eDC5aVULQfPKp8Ij0v7WpwD
 RzZZWL35nSAqLiMLxxpP/VSY1T+PopoaHtKuZfVc5J/J/mr6lvpbsMlo6jRe/lvT
 r2m5MYGyUnAPsm/t44nG7E53xIqvT5eFMMjMQSYQXgi1RztNGepE5acrOHk2RrWc
 X0NqORf6SeAvo6FX8lIQTQq9/4ePH9f3+DXiM48OaKNVDshARd8C7l3Q2aAC0UWi
 sP0oL7Re0mmCJ4820/tTqsKs9D+4U3Hu5lW0FPdXU6uLoNr70T2g29pRLE4o5mP5
 UV91+x6FdUm7o0oDJ6fxqa0Acdc14QObNeNKkFPIJetvWCOyLdk6tJA6sb6XfPnd
 t2JNvBDJonoUrSSaSp6ZiPP3pOzHyoa/NJUJ7HbRrTPzGHPf3ffwKtG53NkSqP4i
 Py1kFVJW3Ykyq1SUlQ/7UD/N5SPg1RLv8lTqdYXuY6cig7D1XDOPapUtvhKjb+H0
 GIouskPOF/nfB8vBiPDnM+LAC3RwFUi03U3IEEUfRPPvjSflwsNho7j6g+tU7IXk
 DfCwgfyMxvbTJAcalH0EufIDEsCrQ3HvH0oMnidP5Jz4VXCEocb/0zOrBTxbScKH
 Gk4UDN2eqqsbecnAeF7kOE9VOfSSZDrA7ZdvWGD6ofPL0b9wytk=
 =VJig
 -----END PGP SIGNATURE-----

Merge tag 'hw-misc-20260223' of https://github.com/philmd/qemu into staging

Misc HW & Net patches

- Fix trace event name in m68k system controller
- Constify and rename virtio_is_big_endian()
- Fix heap buffer overflow in virtio-serial-bus
- Set graphic display dimensions generically (removing system/globals-target.c)
- Mark eth_header, udp_header, tcp_header as packed structures
- Minor doc / header cleanups

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmmbj2wACgkQ4+MsLN6t
# wN7LqBAAq30ShByylpAJ7DvekgGOHCXeHSdVPZKB8eDC5aVULQfPKp8Ij0v7WpwD
# RzZZWL35nSAqLiMLxxpP/VSY1T+PopoaHtKuZfVc5J/J/mr6lvpbsMlo6jRe/lvT
# r2m5MYGyUnAPsm/t44nG7E53xIqvT5eFMMjMQSYQXgi1RztNGepE5acrOHk2RrWc
# X0NqORf6SeAvo6FX8lIQTQq9/4ePH9f3+DXiM48OaKNVDshARd8C7l3Q2aAC0UWi
# sP0oL7Re0mmCJ4820/tTqsKs9D+4U3Hu5lW0FPdXU6uLoNr70T2g29pRLE4o5mP5
# UV91+x6FdUm7o0oDJ6fxqa0Acdc14QObNeNKkFPIJetvWCOyLdk6tJA6sb6XfPnd
# t2JNvBDJonoUrSSaSp6ZiPP3pOzHyoa/NJUJ7HbRrTPzGHPf3ffwKtG53NkSqP4i
# Py1kFVJW3Ykyq1SUlQ/7UD/N5SPg1RLv8lTqdYXuY6cig7D1XDOPapUtvhKjb+H0
# GIouskPOF/nfB8vBiPDnM+LAC3RwFUi03U3IEEUfRPPvjSflwsNho7j6g+tU7IXk
# DfCwgfyMxvbTJAcalH0EufIDEsCrQ3HvH0oMnidP5Jz4VXCEocb/0zOrBTxbScKH
# Gk4UDN2eqqsbecnAeF7kOE9VOfSSZDrA7ZdvWGD6ofPL0b9wytk=
# =VJig
# -----END PGP SIGNATURE-----
# gpg: Signature made Sun Feb 22 23:21:16 2026 GMT
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* tag 'hw-misc-20260223' of https://github.com/philmd/qemu: (21 commits)
  net: mark struct tcp_header as QEMU_PACKED
  net: mark struct udp_header as QEMU_PACKED
  net: mark struct eth_header as QEMU_PACKED
  hw/net/rocker: Don't assume h_proto is aligned in eth_strip_vlan_ex()
  hw/net/rocker: Don't keep pointer to h_proto as uint16_t* in OfDpaFlowPktFields
  hw/net/rtl8139: Remove ineffective parameter
  hw/core/cpu: expand cpu_reset function docs
  hw/alpha: remove unused includes
  hw/ppc/spapr: extract SPAPR_MAX_RAM_SLOTS in a new header
  system/globals: Build as common code
  hw/ppc: Set graphic display dimensions generically
  hw/sparc: Set graphic display dimensions generically
  hw/m68k: Set graphic display dimensions generically
  hw/m68k/q800: Set MACFB_DISPLAY_APPLE_21_COLOR within MacFrameBuffer
  hw/m68k/q800: Use MacFbMode fields in q800_machine_init()
  hw/display/macfb: Constify macfb_mode_table[] array
  hw/display/macfb: Constify macfb_sense_table[] array
  hw/char/virtio-serial-bus: Fix Heap-buffer-overflow in set_config()
  hw/virtio: rename virtio_is_big_endian to virtio_vdev_is_big_endian
  hw/virtio: Constify virtio_is_big_endian() argument
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
master
Peter Maydell 6 months ago
parent
commit
a6ec632dca
  1. 2
      hw/alpha/dp264.c
  2. 4
      hw/char/virtio-serial-bus.c
  3. 18
      hw/display/macfb.c
  4. 17
      hw/m68k/q800.c
  5. 2
      hw/misc/virt_ctrl.c
  6. 19
      hw/net/rocker/rocker_of_dpa.c
  7. 24
      hw/net/rtl8139.c
  8. 4
      hw/net/virtio-net.c
  9. 9
      hw/ppc/mac_newworld.c
  10. 9
      hw/ppc/mac_oldworld.c
  11. 9
      hw/ppc/prep.c
  12. 9
      hw/ppc/spapr.c
  13. 9
      hw/sparc/sun4m.c
  14. 10
      hw/sparc64/sun4u.c
  15. 4
      hw/virtio/vhost.c
  16. 8
      hw/virtio/virtio-pci.c
  17. 3
      include/hw/core/cpu.h
  18. 2
      include/hw/display/macfb.h
  19. 8
      include/hw/ppc/spapr.h
  20. 17
      include/hw/ppc/spapr_common.h
  21. 2
      include/hw/virtio/virtio-access.h
  22. 2
      include/hw/virtio/virtio.h
  23. 6
      include/net/eth.h
  24. 6
      net/eth.c
  25. 24
      system/globals-target.c
  26. 3
      system/globals.c
  27. 1
      system/meson.build

2
hw/alpha/dp264.c

@ -16,8 +16,6 @@
#include "hw/rtc/mc146818rtc.h"
#include "hw/ide/pci.h"
#include "hw/isa/superio.h"
#include "net/net.h"
#include "qemu/cutils.h"
#include "qemu/datadir.h"
static uint64_t cpu_alpha_superpage_to_phys(void *opaque, uint64_t addr)

4
hw/char/virtio-serial-bus.c

@ -1039,10 +1039,6 @@ static void virtio_serial_device_realize(DeviceState *dev, Error **errp)
return;
}
if (!virtio_has_feature(vdev->host_features,
VIRTIO_CONSOLE_F_EMERG_WRITE)) {
config_size = offsetof(struct virtio_console_config, emerg_wr);
}
virtio_init(vdev, VIRTIO_ID_CONSOLE, config_size);
/* Spawn a new virtio-serial bus on which the ports will ride as devices */

18
hw/display/macfb.c

@ -82,7 +82,7 @@ typedef struct MacFbSense {
uint8_t ext_sense;
} MacFbSense;
static MacFbSense macfb_sense_table[] = {
static const MacFbSense macfb_sense_table[] = {
{ MACFB_DISPLAY_APPLE_21_COLOR, 0x0, 0 },
{ MACFB_DISPLAY_APPLE_PORTRAIT, 0x1, 0 },
{ MACFB_DISPLAY_APPLE_12_RGB, 0x2, 0 },
@ -100,7 +100,7 @@ static MacFbSense macfb_sense_table[] = {
{ MACFB_DISPLAY_SVGA, 0x7, 0x5 },
};
static MacFbMode macfb_mode_table[] = {
static const MacFbMode macfb_mode_table[] = {
{ MACFB_DISPLAY_VGA, 1, 0x100, 0x71e, 640, 480, 0x400, 0x1000 },
{ MACFB_DISPLAY_VGA, 2, 0x100, 0x70e, 640, 480, 0x400, 0x1000 },
{ MACFB_DISPLAY_VGA, 4, 0x100, 0x706, 640, 480, 0x400, 0x1000 },
@ -342,7 +342,7 @@ static void macfb_invalidate_display(void *opaque)
static uint32_t macfb_sense_read(MacfbState *s)
{
MacFbSense *macfb_sense;
const MacFbSense *macfb_sense;
uint8_t sense;
assert(s->type < ARRAY_SIZE(macfb_sense_table));
@ -397,7 +397,7 @@ static void macfb_update_mode(MacfbState *s)
static void macfb_mode_write(MacfbState *s)
{
MacFbMode *macfb_mode;
const MacFbMode *macfb_mode;
int i;
for (i = 0; i < ARRAY_SIZE(macfb_mode_table); i++) {
@ -418,11 +418,11 @@ static void macfb_mode_write(MacfbState *s)
}
}
static MacFbMode *macfb_find_mode(MacfbDisplayType display_type,
static const MacFbMode *macfb_find_mode(MacfbDisplayType display_type,
uint16_t width, uint16_t height,
uint8_t depth)
{
MacFbMode *macfb_mode;
const MacFbMode *macfb_mode;
int i;
for (i = 0; i < ARRAY_SIZE(macfb_mode_table); i++) {
@ -440,7 +440,7 @@ static MacFbMode *macfb_find_mode(MacfbDisplayType display_type,
static gchar *macfb_mode_list(void)
{
GString *list = g_string_new("");
MacFbMode *macfb_mode;
const MacFbMode *macfb_mode;
int i;
for (i = 0; i < ARRAY_SIZE(macfb_mode_table); i++) {
@ -645,6 +645,10 @@ static bool macfb_common_realize(DeviceState *dev, MacfbState *s, Error **errp)
{
DisplaySurface *surface;
if (s->width == 1152 && s->height == 870) {
s->type = MACFB_DISPLAY_APPLE_21_COLOR;
}
s->mode = macfb_find_mode(s->type, s->width, s->height, s->depth);
if (!s->mode) {
gchar *list;

17
hw/m68k/q800.c

@ -255,7 +255,7 @@ static void q800_machine_init(MachineState *machine)
int32_t initrd_size;
uint8_t *prom;
int i, checksum;
MacFbMode *macfb_mode;
const MacFbMode *macfb_mode;
ram_addr_t ram_size = machine->ram_size;
const char *kernel_filename = machine->kernel_filename;
const char *initrd_filename = machine->initrd_filename;
@ -560,14 +560,9 @@ static void q800_machine_init(MachineState *machine)
TYPE_NUBUS_MACFB);
dev = DEVICE(&m->macfb);
qdev_prop_set_uint32(dev, "slot", 9);
qdev_prop_set_uint32(dev, "width", graphic_width);
qdev_prop_set_uint32(dev, "height", graphic_height);
qdev_prop_set_uint8(dev, "depth", graphic_depth);
if (graphic_width == 1152 && graphic_height == 870) {
qdev_prop_set_uint8(dev, "display", MACFB_DISPLAY_APPLE_21_COLOR);
} else {
qdev_prop_set_uint8(dev, "display", MACFB_DISPLAY_VGA);
}
qdev_prop_set_uint32(dev, "width", graphic_width ?: 800);
qdev_prop_set_uint32(dev, "height", graphic_height ?: 600);
qdev_prop_set_uint8(dev, "depth", graphic_depth ?: 8);
qdev_realize(dev, BUS(nubus), &error_fatal);
macfb_mode = (NUBUS_MACFB(dev)->macfb).mode;
@ -605,9 +600,9 @@ static void q800_machine_init(MachineState *machine)
BOOTINFO2(param_ptr, BI_MEMCHUNK, 0, ram_size);
BOOTINFO1(param_ptr, BI_MAC_VADDR,
VIDEO_BASE + macfb_mode->offset);
BOOTINFO1(param_ptr, BI_MAC_VDEPTH, graphic_depth);
BOOTINFO1(param_ptr, BI_MAC_VDEPTH, macfb_mode->depth);
BOOTINFO1(param_ptr, BI_MAC_VDIM,
(graphic_height << 16) | graphic_width);
(graphic_height << 16) | macfb_mode->width);
BOOTINFO1(param_ptr, BI_MAC_VROW, macfb_mode->stride);
BOOTINFO1(param_ptr, BI_MAC_SCCBASE, SCC_BASE);

2
hw/misc/virt_ctrl.c

@ -43,7 +43,7 @@ static uint64_t virt_ctrl_read(void *opaque, hwaddr addr, unsigned size)
break;
}
trace_virt_ctrl_write(s, addr, size, value);
trace_virt_ctrl_read(s, addr, size, value);
return value;
}

19
hw/net/rocker/rocker_of_dpa.c

@ -143,7 +143,7 @@ typedef struct of_dpa_flow {
typedef struct of_dpa_flow_pkt_fields {
uint32_t tunnel_id;
struct eth_header *ethhdr;
uint16_t *h_proto;
void *h_proto; /* pointer to unaligned uint16_t data */
struct vlan_header *vlanhdr;
struct ip_header *ipv4hdr;
struct ip6_header *ipv6hdr;
@ -196,6 +196,11 @@ typedef struct of_dpa_group {
};
} OfDpaGroup;
static uint16_t of_dpa_flow_pkt_h_proto(const OfDpaFlowPktFields *fields)
{
return lduw_he_p(fields->h_proto);
}
static int of_dpa_mask2prefix(uint32_t mask)
{
return 32 - ctz32(ntohl(mask));
@ -395,7 +400,7 @@ static void of_dpa_flow_pkt_parse(OfDpaFlowContext *fc,
fields->ethhdr = iov->iov_base;
fields->h_proto = &fields->ethhdr->h_proto;
if (ntohs(*fields->h_proto) == ETH_P_VLAN) {
if (ntohs(of_dpa_flow_pkt_h_proto(fields) == ETH_P_VLAN)) {
sofar += sizeof(struct vlan_header);
if (iov->iov_len < sofar) {
DPRINTF("flow_pkt_parse underrun on vlan_header\n");
@ -405,7 +410,7 @@ static void of_dpa_flow_pkt_parse(OfDpaFlowContext *fc,
fields->h_proto = &fields->vlanhdr->h_proto;
}
switch (ntohs(*fields->h_proto)) {
switch (ntohs(of_dpa_flow_pkt_h_proto(fields))) {
case ETH_P_IP:
sofar += sizeof(struct ip_header);
if (iov->iov_len < sofar) {
@ -547,7 +552,7 @@ static void of_dpa_term_mac_build_match(OfDpaFlowContext *fc,
{
match->value.tbl_id = ROCKER_OF_DPA_TABLE_ID_TERMINATION_MAC;
match->value.in_pport = fc->in_pport;
match->value.eth.type = *fc->fields.h_proto;
match->value.eth.type = of_dpa_flow_pkt_h_proto(&fc->fields);
match->value.eth.vlan_id = fc->fields.vlanhdr->h_tci;
memcpy(match->value.eth.dst.a, fc->fields.ethhdr->h_dest,
sizeof(match->value.eth.dst.a));
@ -643,7 +648,7 @@ static void of_dpa_unicast_routing_build_match(OfDpaFlowContext *fc,
OfDpaFlowMatch *match)
{
match->value.tbl_id = ROCKER_OF_DPA_TABLE_ID_UNICAST_ROUTING;
match->value.eth.type = *fc->fields.h_proto;
match->value.eth.type = of_dpa_flow_pkt_h_proto(&fc->fields);
if (fc->fields.ipv4hdr) {
match->value.ipv4.addr.dst = fc->fields.ipv4hdr->ip_dst;
}
@ -672,7 +677,7 @@ of_dpa_multicast_routing_build_match(OfDpaFlowContext *fc,
OfDpaFlowMatch *match)
{
match->value.tbl_id = ROCKER_OF_DPA_TABLE_ID_MULTICAST_ROUTING;
match->value.eth.type = *fc->fields.h_proto;
match->value.eth.type = of_dpa_flow_pkt_h_proto(&fc->fields);
match->value.eth.vlan_id = fc->fields.vlanhdr->h_tci;
if (fc->fields.ipv4hdr) {
match->value.ipv4.addr.src = fc->fields.ipv4hdr->ip_src;
@ -713,7 +718,7 @@ static void of_dpa_acl_build_match(OfDpaFlowContext *fc,
sizeof(match->value.eth.src.a));
memcpy(match->value.eth.dst.a, fc->fields.ethhdr->h_dest,
sizeof(match->value.eth.dst.a));
match->value.eth.type = *fc->fields.h_proto;
match->value.eth.type = of_dpa_flow_pkt_h_proto(&fc->fields);
match->value.eth.vlan_id = fc->fields.vlanhdr->h_tci;
match->value.width = FLOW_KEY_WIDTH(eth.type);
if (fc->fields.ipv4hdr) {

24
hw/net/rtl8139.c

@ -815,7 +815,8 @@ static bool rtl8139_can_receive(NetClientState *nc)
return avail == 0 || avail >= 1514 || (s->IntrMask & RxOverflow);
}
static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t size_, int do_interrupt)
static ssize_t rtl8139_receive(NetClientState *nc,
const uint8_t *buf, size_t size_)
{
RTL8139State *s = qemu_get_nic_opaque(nc);
PCIDevice *d = PCI_DEVICE(s);
@ -1173,20 +1174,11 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t
}
s->IntrStatus |= RxOK;
if (do_interrupt)
{
rtl8139_update_irq(s);
}
rtl8139_update_irq(s);
return size_;
}
static ssize_t rtl8139_receive(NetClientState *nc, const uint8_t *buf, size_t size)
{
return rtl8139_do_receive(nc, buf, size, 1);
}
static void rtl8139_reset_rxring(RTL8139State *s, uint32_t bufferSize)
{
s->RxBufferSize = bufferSize;
@ -1745,7 +1737,7 @@ static uint32_t rtl8139_RxConfig_read(RTL8139State *s)
}
static void rtl8139_transfer_frame(RTL8139State *s, uint8_t *buf, int size,
int do_interrupt, const uint8_t *dot1q_buf)
const uint8_t *dot1q_buf)
{
struct iovec *iov = NULL;
struct iovec vlan_iov[3];
@ -1828,7 +1820,7 @@ static int rtl8139_transmit_one(RTL8139State *s, int descriptor)
s->TxStatus[descriptor] |= TxHostOwns;
s->TxStatus[descriptor] |= TxStatOK;
rtl8139_transfer_frame(s, txbuffer, txsize, 0, NULL);
rtl8139_transfer_frame(s, txbuffer, txsize, NULL);
DPRINTF("+++ transmitted %d bytes from descriptor %d\n", txsize,
descriptor);
@ -2246,7 +2238,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
DPRINTF("+++ C+ mode TSO transferring packet size "
"%d\n", tso_send_size);
rtl8139_transfer_frame(s, saved_buffer, tso_send_size,
0, (uint8_t *) dot1q_buffer);
(uint8_t *)dot1q_buffer);
/* add transferred count to TCP sequence number */
stl_be_p(&p_tcp_hdr->th_seq,
@ -2323,8 +2315,8 @@ skip_offload:
DPRINTF("+++ C+ mode transmitting %d bytes packet\n", saved_size);
rtl8139_transfer_frame(s, saved_buffer, saved_size, 1,
(uint8_t *) dot1q_buffer);
rtl8139_transfer_frame(s, saved_buffer, saved_size,
(uint8_t *)dot1q_buffer);
/* restore card space if there was no recursion and reset offset */
if (!s->cplus_txbuffer)

4
hw/net/virtio-net.c

@ -301,7 +301,7 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
if (n->needs_vnet_hdr_swap) {
error_report("backend does not support %s vnet headers; "
"falling back on userspace virtio",
virtio_is_big_endian(vdev) ? "BE" : "LE");
virtio_vdev_is_big_endian(vdev) ? "BE" : "LE");
return;
}
@ -343,7 +343,7 @@ static int virtio_net_set_vnet_endian_one(VirtIODevice *vdev,
NetClientState *peer,
bool enable)
{
if (virtio_is_big_endian(vdev)) {
if (virtio_vdev_is_big_endian(vdev)) {
return qemu_set_vnet_be(peer, enable);
} else {
return qemu_set_vnet_le(peer, enable);

9
hw/ppc/mac_newworld.c

@ -432,6 +432,15 @@ static void ppc_core99_init(MachineState *machine)
pci_vga_init(pci_bus);
if (!graphic_width) {
graphic_width = 800;
}
if (!graphic_height) {
graphic_height = 600;
}
if (!graphic_depth) {
graphic_depth = 32;
}
if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
graphic_depth = 15;
}

9
hw/ppc/mac_oldworld.c

@ -288,6 +288,15 @@ static void ppc_heathrow_init(MachineState *machine)
pci_create_simple(pci_bus, -1, "pci-ohci");
}
if (!graphic_width) {
graphic_width = 800;
}
if (!graphic_height) {
graphic_height = 600;
}
if (!graphic_depth) {
graphic_depth = 32;
}
if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
graphic_depth = 15;
}

9
hw/ppc/prep.c

@ -412,6 +412,15 @@ static void ibm_40p_init(MachineState *machine)
fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size);
fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_PREP);
if (!graphic_width) {
graphic_width = 800;
}
if (!graphic_height) {
graphic_height = 600;
}
if (!graphic_depth) {
graphic_depth = 32;
}
fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);

9
hw/ppc/spapr.c

@ -1177,6 +1177,15 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset)
if (machine->boot_config.has_menu && machine->boot_config.menu) {
_FDT((fdt_setprop_cell(fdt, chosen, "qemu,boot-menu", true)));
}
if (!graphic_width) {
graphic_width = 800;
}
if (!graphic_height) {
graphic_height = 600;
}
if (!graphic_depth) {
graphic_depth = 32;
}
_FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-width", graphic_width));
_FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-height", graphic_height));
_FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-depth", graphic_depth));

9
hw/sparc/sun4m.c

@ -892,6 +892,15 @@ static void sun4m_hw_init(MachineState *machine)
hwdef->esp_base, slavio_irq[18],
hwdef->le_base, slavio_irq[16], &hostid);
if (!graphic_width) {
graphic_width = 1024;
}
if (!graphic_height) {
graphic_height = 768;
}
if (!graphic_depth) {
graphic_depth = 8;
}
if (graphic_depth != 8 && graphic_depth != 24) {
error_report("Unsupported depth: %d", graphic_depth);
exit (1);

10
hw/sparc64/sun4u.c

@ -666,6 +666,16 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
sysbus_mmio_get_region(s, 0));
nvram = NVRAM(dev);
if (!graphic_width) {
graphic_width = 1024;
}
if (!graphic_height) {
graphic_height = 768;
}
if (!graphic_depth) {
graphic_depth = 8;
}
initrd_size = 0;
initrd_addr = 0;
kernel_size = sun4u_load_kernel(machine->kernel_filename,

4
hw/virtio/vhost.c

@ -1306,7 +1306,7 @@ int vhost_virtqueue_start(struct vhost_dev *dev,
if (vhost_needs_vring_endian(vdev)) {
r = vhost_virtqueue_set_vring_endian_legacy(dev,
virtio_is_big_endian(vdev),
virtio_vdev_is_big_endian(vdev),
vhost_vq_index);
if (r) {
return r;
@ -1423,7 +1423,7 @@ static int do_vhost_virtqueue_stop(struct vhost_dev *dev,
*/
if (vhost_needs_vring_endian(vdev)) {
vhost_virtqueue_set_vring_endian_legacy(dev,
!virtio_is_big_endian(vdev),
!virtio_vdev_is_big_endian(vdev),
vhost_vq_index);
}

8
hw/virtio/virtio-pci.c

@ -586,13 +586,13 @@ static uint64_t virtio_pci_config_read(void *opaque, hwaddr addr,
break;
case 2:
val = virtio_config_readw(vdev, addr);
if (virtio_is_big_endian(vdev)) {
if (virtio_vdev_is_big_endian(vdev)) {
val = bswap16(val);
}
break;
case 4:
val = virtio_config_readl(vdev, addr);
if (virtio_is_big_endian(vdev)) {
if (virtio_vdev_is_big_endian(vdev)) {
val = bswap32(val);
}
break;
@ -625,13 +625,13 @@ static void virtio_pci_config_write(void *opaque, hwaddr addr,
virtio_config_writeb(vdev, addr, val);
break;
case 2:
if (virtio_is_big_endian(vdev)) {
if (virtio_vdev_is_big_endian(vdev)) {
val = bswap16(val);
}
virtio_config_writew(vdev, addr, val);
break;
case 4:
if (virtio_is_big_endian(vdev)) {
if (virtio_vdev_is_big_endian(vdev)) {
val = bswap32(val);
}
virtio_config_writel(vdev, addr, val);

3
include/hw/core/cpu.h

@ -815,6 +815,9 @@ void cpu_list_remove(CPUState *cpu);
/**
* cpu_reset:
* @cpu: The CPU whose state is to be reset.
*
* You should refrain from calling this during CPU realization and
* make sure this is called from the reset logic instead.
*/
void cpu_reset(CPUState *cpu);

2
include/hw/display/macfb.h

@ -66,7 +66,7 @@ typedef struct MacfbState {
uint8_t type;
uint32_t regs[MACFB_NUM_REGS];
MacFbMode *mode;
const MacFbMode *mode;
QEMUTimer *vbl_timer;
qemu_irq irq;

8
include/hw/ppc/spapr.h

@ -4,6 +4,7 @@
#include "qemu/units.h"
#include "system/dma.h"
#include "hw/core/boards.h"
#include "hw/ppc/spapr_common.h"
#include "hw/ppc/spapr_drc.h"
#include "hw/mem/pc-dimm.h"
#include "hw/ppc/spapr_ovec.h"
@ -946,13 +947,6 @@ int spapr_rtc_import_offset(SpaprRtcState *rtc, int64_t legacy_offset);
#define SPAPR_MEMORY_BLOCK_SIZE ((hwaddr)1 << 28) /* 256MB */
/*
* This defines the maximum number of DIMM slots we can have for sPAPR
* guest. This is not defined by sPAPR but we are defining it to 32 slots
* based on default number of slots provided by PowerPC kernel.
*/
#define SPAPR_MAX_RAM_SLOTS 32
/* 1GB alignment for hotplug memory region */
#define SPAPR_DEVICE_MEM_ALIGN (1 * GiB)

17
include/hw/ppc/spapr_common.h

@ -0,0 +1,17 @@
/*
* Common definitions for PPC sPAPR
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef HW_SPAPR_COMMON_H
#define HW_SPAPR_COMMON_H
/*
* The maximum number of DIMM slots we can have for sPAPR guest.
* This is not defined by sPAPR but we are defining it to 32 slots
* based on default number of slots provided by PowerPC kernel.
*/
#define SPAPR_MAX_RAM_SLOTS 32
#endif /* HW_SPAPR_COMMON_H */

2
include/hw/virtio/virtio-access.h

@ -28,7 +28,7 @@
static inline bool virtio_access_is_big_endian(VirtIODevice *vdev)
{
#if defined(LEGACY_VIRTIO_IS_BIENDIAN)
return virtio_is_big_endian(vdev);
return virtio_vdev_is_big_endian(vdev);
#elif TARGET_BIG_ENDIAN
if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
/* Devices conforming to VIRTIO 1.0 or later are always LE. */

2
include/hw/virtio/virtio.h

@ -468,7 +468,7 @@ static inline bool virtio_host_has_feature(VirtIODevice *vdev,
return virtio_has_feature(vdev->host_features, fbit);
}
static inline bool virtio_is_big_endian(VirtIODevice *vdev)
static inline bool virtio_vdev_is_big_endian(const VirtIODevice *vdev)
{
if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN);

6
include/net/eth.h

@ -39,7 +39,7 @@ struct eth_header {
uint8_t h_dest[ETH_ALEN]; /* destination eth addr */
uint8_t h_source[ETH_ALEN]; /* source ether addr */
uint16_t h_proto; /* packet type ID field */
};
} QEMU_PACKED;
struct vlan_header {
uint16_t h_tci; /* priority and VLAN ID */
@ -68,7 +68,7 @@ typedef struct tcp_header {
uint16_t th_win; /* window */
uint16_t th_sum; /* checksum */
uint16_t th_urp; /* urgent pointer */
} tcp_header;
} QEMU_PACKED tcp_header;
#define TCP_FLAGS_ONLY(flags) ((flags) & 0x3f)
@ -85,7 +85,7 @@ typedef struct udp_header {
uint16_t uh_dport; /* destination port */
uint16_t uh_ulen; /* udp length */
uint16_t uh_sum; /* udp checksum */
} udp_header;
} QEMU_PACKED udp_header;
typedef struct ip_pseudo_header {
uint32_t ip_src;

6
net/eth.c

@ -274,7 +274,7 @@ eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff, int index,
uint16_t *payload_offset, uint16_t *tci)
{
struct vlan_header vlan_hdr;
uint16_t *new_ehdr_proto;
void *new_ehdr_proto;
size_t new_ehdr_size;
size_t copied;
@ -298,7 +298,7 @@ eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff, int index,
return 0;
}
if (copied < new_ehdr_size || be16_to_cpu(*new_ehdr_proto) != vet) {
if (copied < new_ehdr_size || lduw_be_p(new_ehdr_proto) != vet) {
return 0;
}
@ -308,7 +308,7 @@ eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff, int index,
return 0;
}
*new_ehdr_proto = vlan_hdr.h_proto;
stw_he_p(new_ehdr_proto, vlan_hdr.h_proto);
*payload_offset = iovoff + new_ehdr_size + sizeof(vlan_hdr);
*tci = be16_to_cpu(vlan_hdr.h_tci);

24
system/globals-target.c

@ -1,24 +0,0 @@
/*
* Global variables that should not exist (target specific)
*
* Copyright (c) 2003-2008 Fabrice Bellard
*
* SPDX-License-Identifier: MIT
*/
#include "qemu/osdep.h"
#include "system/system.h"
#ifdef TARGET_SPARC
int graphic_width = 1024;
int graphic_height = 768;
int graphic_depth = 8;
#elif defined(TARGET_M68K)
int graphic_width = 800;
int graphic_height = 600;
int graphic_depth = 8;
#else
int graphic_width = 800;
int graphic_height = 600;
int graphic_depth = 32;
#endif

3
system/globals.c

@ -49,6 +49,9 @@ bool enable_cpu_pm;
int autostart = 1;
int vga_interface_type = VGA_NONE;
bool vga_interface_created;
int graphic_width;
int graphic_height;
int graphic_depth;
Chardev *parallel_hds[MAX_PARALLEL_PORTS];
QEMUOptionRom option_rom[MAX_OPTION_ROMS];
int nb_option_roms;

1
system/meson.build

@ -1,6 +1,5 @@
specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files(
'arch_init.c',
'globals-target.c',
)])
system_ss.add(files(

Loading…
Cancel
Save