Skip to contentSkip to conversation

Misc HW patches for 2024-03-12

GIT PULL Applied Philippe Mathieu-Daudé 2 participants 15 messages Mar 12, 2024 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

The following changes since commit 7489f7f3f81dcb776df8c1b9a9db281fc21bf05f:

Merge tag 'hw-misc-20240309' of https://github.com/philmd/qemu into staging (2024-03-09 20:12:21 +0000)

are available in the Git repository at:

https://github.com/philmd/qemu.git tags/hw-misc-20240312

for you to fetch changes up to afc8b05cea14b2eea6f1eaa640f74b21486fca48:

docs/about/deprecated.rst: Move SMP configurations item to system emulator section (2024-03-12 09:19:04 +0100)

----------------------------------------------------------------
Misc HW patch queue

- Rename hw/ide/ahci-internal.h for consistency (Zoltan)
- More convenient PCI hotplug trace events (Vladimir)
- Short CLI option to add drives for sam460ex machine (Zoltan)
- More missing ERRP_GUARD() macros (Zhao)
- Avoid faulting when unmapped I/O BAR is accessed on SPARC EBUS (Mark)
- Remove unused includes in hw/core/ (Zhao)
- New PCF8574 GPIO over I2C model (Dmitriy)
- Require ObjC on Darwin macOS by default (Peter)
- Corrected "-smp parameter=1" placement in docs/ (Zhao)

----------------------------------------------------------------

BALATON Zoltan (2):
hw/ide/ahci: Rename ahci_internal.h to ahci-internal.h hw/ppc/sam460ex: Support short options for adding drives

Dmitriy Sharikhin (1):
hw/gpio: introduce pcf8574 driver

Mark Cave-Ayland (1):
sun4u: remap ebus BAR0 to use unassigned_io_ops instead of alias to
PCI IO space

Peter Maydell (1):
meson.build: Always require an objc compiler on macos hosts

Vladimir Sementsov-Ogievskiy (1):
hw/pci: add some convenient trace-events for pcie and shpc hotplug

Zhao Liu (7):
hw/core/loader-fit: Fix missing ERRP_GUARD() for error_prepend() hw/core/qdev-properties-system: Fix missing ERRP_GUARD() for
error_prepend()
hw/misc/ivshmem: Fix missing ERRP_GUARD() for error_prepend() hw/core: Cleanup unused included headers in cpu-common.c hw/core: Cleanup unused included header in machine-qmp-cmds.c hw/core: Cleanup unused included headers in numa.c docs/about/deprecated.rst: Move SMP configurations item to system
emulator section

 MAINTAINERS                                 |   6 +
 docs/about/deprecated.rst                   |  20 +--
 meson.build                                 |   2 +-
 hw/ide/{ahci_internal.h => ahci-internal.h} |   0
 include/hw/gpio/pcf8574.h                   |  15 ++
 hw/core/cpu-common.c                        |   4 -
 hw/core/loader-fit.c                        |   2 +
 hw/core/machine-qmp-cmds.c                  |   1 -
 hw/core/numa.c                              |   2 -
 hw/core/qdev-properties-system.c            |   1 +
 hw/gpio/pcf8574.c                           | 162 ++++++++++++++++++++
 hw/ide/ahci.c                               |   2 +-
 hw/ide/ich.c                                |   2 +-
 hw/misc/ivshmem.c                           |   1 +
 hw/pci/pcie.c                               |  56 +++++++
 hw/pci/shpc.c                               |  46 ++++++
 hw/ppc/sam460ex.c                           |  24 ++-
 hw/sparc64/sun4u.c                          |   9 +-
 hw/gpio/Kconfig                             |   4 +
 hw/gpio/meson.build                         |   1 +
 hw/pci/trace-events                         |   6 +
 21 files changed, 339 insertions(+), 27 deletions(-)
 rename hw/ide/{ahci_internal.h => ahci-internal.h} (100%)
 create mode 100644 include/hw/gpio/pcf8574.h
 create mode 100644 hw/gpio/pcf8574.c
Signature · 1 line
2.41.0
#1 lore raw

[PULL 03/13] hw/ppc/sam460ex: Support short options for adding drives

From: BALATON Zoltan <[email protected]>

Having to use -drive if=none,... and -device ide-[cd,hd] is inconvenient. Add support for shorter convenience options such as -cdrom and -drive media=disk. Also adjust two nearby comments for code style.

Message-ID: <[email protected]>

---
 hw/ppc/sam460ex.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
hw/ppc/sam460ex.c +19 -5
index 7e34b6c5e0..d42b677898 100644
@@ -33,6 +33,7 @@
 #include "hw/char/serial.h"
 #include "hw/i2c/ppc4xx_i2c.h"
 #include "hw/i2c/smbus_eeprom.h"
+#include "hw/ide/pci.h"
 #include "hw/usb/hcd-ehci.h"
 #include "hw/ppc/fdt.h"
 #include "hw/qdev-properties.h"
@@ -449,15 +450,27 @@ static void sam460ex_init(MachineState *machine)
 
     /* PCI devices */
     pci_create_simple(pci_bus, PCI_DEVFN(6, 0), "sm501");
-    /* SoC has a single SATA port but we don't emulate that yet
+    /*
+     * SoC has a single SATA port but we don't emulate that
      * However, firmware and usual clients have driver for SiI311x
-     * so add one for convenience by default */
+     * PCI SATA card so add one for convenience by default
+     */
     if (defaults_enabled()) {
-        pci_create_simple(pci_bus, -1, "sii3112");
+        PCIIDEState *s = PCI_IDE(pci_create_simple(pci_bus, -1, "sii3112"));
+        DriveInfo *di;
+
+        di = drive_get_by_index(IF_IDE, 0);
+        if (di) {
+            ide_bus_create_drive(&s->bus[0], 0, di);
+        }
+        /* Use index 2 only if 1 does not exist, this allows -cdrom */
+        di = drive_get_by_index(IF_IDE, 1) ?: drive_get_by_index(IF_IDE, 2);
+        if (di) {
+            ide_bus_create_drive(&s->bus[1], 0, di);
+        }
     }
 
-    /* SoC has 4 UARTs
-     * but board has only one wired and two are present in fdt */
+    /* SoC has 4 UARTs but board has only one wired and two described in fdt */
     if (serial_hd(0) != NULL) {
         serial_mm_init(get_system_memory(), 0x4ef600300, 0,
                        qdev_get_gpio_in(uic[1], 1),
@@ -531,6 +544,7 @@ static void sam460ex_machine_init(MachineClass *mc)
 {
     mc->desc = "aCube Sam460ex";
     mc->init = sam460ex_init;
+    mc->block_default_type = IF_IDE;
     mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("460exb");
     mc->default_ram_size = 512 * MiB;
     mc->default_ram_id = "ppc4xx.sdram";
Signature · 1 line
2.41.0
#2 lore raw

[PULL 04/13] hw/core/loader-fit: Fix missing ERRP_GUARD() for error_prepend()

In reply to Philippe Mathieu-Daudé

From: Zhao Liu <[email protected]>

As the comment in qapi/error, passing @errp to error_prepend() requires ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
* error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user can't see this additional information, because exit() happens in error_setg earlier than information is added [1].

In hw/core/loader-fit.c, there are 2 functions passing @errp to error_prepend() without ERRP_GUARD():
- fit_load_kernel()
- fit_load_fdt()

Their @errp parameters are both the pointers of the local @err virable in load_fit().

Though they don't cause the issue like [1] said, to follow the requirement of @errp, add missing ERRP_GUARD() at their beginning.

[1]: Issue description in the commit message of commit ae7c80a7bd73

     ("error: New macro ERRP_GUARD()").
Cc Paul Burton <[email protected]>
Cc Aleksandar Rikalo <[email protected]>

Message-ID: <[email protected]>

---
 hw/core/loader-fit.c | 2 ++
 1 file changed, 2 insertions(+)
hw/core/loader-fit.c +2 -0
index b7c7b3ba94..9f20007dbb 100644
@@ -120,6 +120,7 @@ static int fit_load_kernel(const struct fit_loader *ldr, const void *itb,
                            int cfg, void *opaque, hwaddr *pend,
                            Error **errp)
 {
+    ERRP_GUARD();
     const char *name;
     const void *data;
     const void *load_data;
@@ -178,6 +179,7 @@ static int fit_load_fdt(const struct fit_loader *ldr, const void *itb,
                         int cfg, void *opaque, const void *match_data,
                         hwaddr kernel_end, Error **errp)
 {
+    ERRP_GUARD();
     Error *err = NULL;
     const char *name;
     const void *data;
Signature · 1 line
2.41.0
#3 lore raw

[PULL 02/13] hw/pci: add some convenient trace-events for pcie and shpc hotplug

In reply to Philippe Mathieu-Daudé

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Add trace-events that may help to debug problems with hotplugging.

Message-ID: <[email protected]>

---
 hw/pci/pcie.c       | 56 +++++++++++++++++++++++++++++++++++++++++++++
 hw/pci/shpc.c       | 46 +++++++++++++++++++++++++++++++++++++
 hw/pci/trace-events |  6 +++++
 3 files changed, 108 insertions(+)
hw/pci/pcie.c +56 -0
index 6db0cf69cd..f56079acf5 100644
@@ -28,6 +28,7 @@
 #include "hw/pci/pcie_regs.h"
 #include "hw/pci/pcie_port.h"
 #include "qemu/range.h"
+#include "trace.h"
 
 //#define DEBUG_PCIE
 #ifdef DEBUG_PCIE
@@ -45,6 +46,23 @@ static bool pcie_sltctl_powered_off(uint16_t sltctl)
         && (sltctl & PCI_EXP_SLTCTL_PIC) == PCI_EXP_SLTCTL_PWR_IND_OFF;
 }
 
+static const char *pcie_led_state_to_str(uint16_t value)
+{
+    switch (value) {
+    case PCI_EXP_SLTCTL_PWR_IND_ON:
+    case PCI_EXP_SLTCTL_ATTN_IND_ON:
+        return "on";
+    case PCI_EXP_SLTCTL_PWR_IND_BLINK:
+    case PCI_EXP_SLTCTL_ATTN_IND_BLINK:
+        return "blink";
+    case PCI_EXP_SLTCTL_PWR_IND_OFF:
+    case PCI_EXP_SLTCTL_ATTN_IND_OFF:
+        return "off";
+    default:
+        return "invalid";
+    }
+}
+
 /***************************************************************************
  * pci express capability helper functions
  */
@@ -735,6 +753,28 @@ void pcie_cap_slot_get(PCIDevice *dev, uint16_t *slt_ctl, uint16_t *slt_sta)
     *slt_sta = pci_get_word(exp_cap + PCI_EXP_SLTSTA);
 }
 
+static void find_child_fn(PCIBus *bus, PCIDevice *dev, void *opaque)
+{
+    PCIDevice **child = opaque;
+
+    if (!*child) {
+        *child = dev;
+    }
+}
+
+/*
+ * Returns the plugged device or first function of multifunction plugged device
+ */
+static PCIDevice *pcie_cap_slot_find_child(PCIDevice *dev)
+{
+    PCIBus *sec_bus = pci_bridge_get_sec_bus(PCI_BRIDGE(dev));
+    PCIDevice *child = NULL;
+
+    pci_for_each_device(sec_bus, pci_bus_num(sec_bus), find_child_fn, &child);
+
+    return child;
+}
+
 void pcie_cap_slot_write_config(PCIDevice *dev,
                                 uint16_t old_slt_ctl, uint16_t old_slt_sta,
                                 uint32_t addr, uint32_t val, int len)
@@ -779,6 +819,22 @@ void pcie_cap_slot_write_config(PCIDevice *dev,
                         sltsta);
     }
 
+    if (trace_event_get_state_backends(TRACE_PCIE_CAP_SLOT_WRITE_CONFIG)) {
+        DeviceState *parent = DEVICE(dev);
+        DeviceState *child = DEVICE(pcie_cap_slot_find_child(dev));
+
+        trace_pcie_cap_slot_write_config(
+            parent->canonical_path,
+            child ? child->canonical_path : "no-child",
+            (sltsta & PCI_EXP_SLTSTA_PDS) ? "present" : "not present",
+            pcie_led_state_to_str(old_slt_ctl & PCI_EXP_SLTCTL_PIC),
+            pcie_led_state_to_str(val & PCI_EXP_SLTCTL_PIC),
+            pcie_led_state_to_str(old_slt_ctl & PCI_EXP_SLTCTL_AIC),
+            pcie_led_state_to_str(val & PCI_EXP_SLTCTL_AIC),
+            (old_slt_ctl & PCI_EXP_SLTCTL_PWR_OFF) ? "off" : "on",
+            (val & PCI_EXP_SLTCTL_PWR_OFF) ? "off" : "on");
+    }
+
     /*
      * If the slot is populated, power indicator is off and power
      * controller is off, it is safe to detach the devices.
hw/pci/shpc.c +46 -0

64 lines not on this page · raw message

hw/pci/trace-events +6 -0
index 42430869ce..19643aa8c6 100644
@@ -16,3 +16,9 @@ msix_write_config(char *name, bool enabled, bool masked) "dev %s enabled %d mask
 sriov_register_vfs(const char *name, int slot, int function, int num_vfs) "%s %02x:%x: creating %d vf devs"
 sriov_unregister_vfs(const char *name, int slot, int function, int num_vfs) "%s %02x:%x: Unregistering %d vf devs"
 sriov_config_write(const char *name, int slot, int fun, uint32_t offset, uint32_t val, uint32_t len) "%s %02x:%x: sriov offset 0x%x val 0x%x len %d"
+
+# pcie.c
+pcie_cap_slot_write_config(const char *parent, const char *child, const char *pds, const char *old_pic, const char *new_pic, const char *old_aic, const char *new_aic, const char *old_power, const char *new_power) "%s > %s: pds: %s, pic: %s->%s, aic: %s->%s, power: %s->%s"
+
+# shpc.c
+shpc_slot_command(const char *parent, int pci_slot, const char *child, const char *old_pic, const char *new_pic, const char *old_aic, const char *new_aic, const char *old_state, const char *new_state) "%s[%d] > %s: pic: %s->%s, aic: %s->%s, state: %s->%s"
Signature · 1 line
2.41.0
#4 lore raw

[PULL 01/13] hw/ide/ahci: Rename ahci_internal.h to ahci-internal.h

In reply to Philippe Mathieu-Daudé

From: BALATON Zoltan <[email protected]>

Other headers now use dash instead of underscore. Rename ahci_internal.h accordingly for consistency.

Message-ID: <[email protected]>

---
 hw/ide/{ahci_internal.h => ahci-internal.h} | 0
 hw/ide/ahci.c                               | 2 +-
 hw/ide/ich.c                                | 2 +-
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename hw/ide/{ahci_internal.h => ahci-internal.h} (100%)
hw/ide/ahci-internal.h renamed from hw/ide/ahci_internal.h +0 -0
similarity index 100%
rename from hw/ide/ahci_internal.h
rename to hw/ide/ahci-internal.h
hw/ide/ahci.c +1 -1
index b8123bc73d..bfefad2965 100644
@@ -37,7 +37,7 @@
 #include "hw/ide/pci.h"
 #include "hw/ide/ahci-pci.h"
 #include "hw/ide/ahci-sysbus.h"
-#include "ahci_internal.h"
+#include "ahci-internal.h"
 #include "ide-internal.h"
 
 #include "trace.h"
hw/ide/ich.c +1 -1
index 3ea793d790..9b909c87f3 100644
@@ -70,7 +70,7 @@
 #include "sysemu/dma.h"
 #include "hw/ide/pci.h"
 #include "hw/ide/ahci-pci.h"
-#include "ahci_internal.h"
+#include "ahci-internal.h"
 
 #define ICH9_MSI_CAP_OFFSET     0x80
 #define ICH9_SATA_CAP_OFFSET    0xA8
Signature · 1 line
2.41.0
#5 lore raw

[PULL 06/13] hw/misc/ivshmem: Fix missing ERRP_GUARD() for error_prepend()

In reply to Philippe Mathieu-Daudé

From: Zhao Liu <[email protected]>

As the comment in qapi/error, passing @errp to error_prepend() requires ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
* error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user can't see this additional information, because exit() happens in error_setg earlier than information is added [1].

The ivshmem_common_realize() passes @errp to error_prepend(), and as a DeviceClass.realize method, there are too many possible callers to check the impact of this defect; it may or may not be harmless. Thus it is necessary to protect @errp with ERRP_GUARD().

To avoid the issue like [1] said, add missing ERRP_GUARD() at the beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73

     ("error: New macro ERRP_GUARD()").
Cc Juan Quintela <[email protected]>
Cc Manos Pitsidianakis <[email protected]>
Cc Michael Galaxy <[email protected]>
Cc Steve Sistare <[email protected]>

Message-ID: <[email protected]>

---
 hw/misc/ivshmem.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/ivshmem.c +1 -0
index a2fd0bc365..de49d1b8a8 100644
@@ -832,6 +832,7 @@ static void ivshmem_write_config(PCIDevice *pdev, uint32_t address,
 
 static void ivshmem_common_realize(PCIDevice *dev, Error **errp)
 {
+    ERRP_GUARD();
     IVShmemState *s = IVSHMEM_COMMON(dev);
     Error *err = NULL;
     uint8_t *pci_conf;
Signature · 1 line
2.41.0
#6 lore raw

[PULL 09/13] hw/core: Cleanup unused included header in machine-qmp-cmds.c

In reply to Philippe Mathieu-Daudé

From: Zhao Liu <[email protected]>

Remove unused header (qemu/main-loop.h) in machine-qmp-cmds.c.

Tested by "./configure" and then "make".

Message-ID: <[email protected]>

---
 hw/core/machine-qmp-cmds.c | 1 -
 1 file changed, 1 deletion(-)
hw/core/machine-qmp-cmds.c +0 -1
index 3860a50c3b..4b72009cd3 100644
@@ -19,7 +19,6 @@
 #include "qapi/qmp/qobject.h"
 #include "qapi/qobject-input-visitor.h"
 #include "qapi/type-helpers.h"
-#include "qemu/main-loop.h"
 #include "qemu/uuid.h"
 #include "qom/qom-qobject.h"
 #include "sysemu/hostmem.h"
Signature · 1 line
2.41.0
#7 lore raw

[PULL 05/13] hw/core/qdev-properties-system: Fix missing ERRP_GUARD() for error_prepend()

In reply to Philippe Mathieu-Daudé

From: Zhao Liu <[email protected]>

As the comment in qapi/error, passing @errp to error_prepend() requires ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
* error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user can't see this additional information, because exit() happens in error_setg earlier than information is added [1].

The set_chr() passes @errp to error_prepend() without ERRP_GUARD().

As a PropertyInfo.set method, there are too many possible callers to check the impact of this defect; it may or may not be harmless. Thus it is necessary to protect @errp with ERRP_GUARD().

To avoid the issue like [1] said, add missing ERRP_GUARD() at the beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73

     ("error: New macro ERRP_GUARD()").
Cc Paolo Bonzini <[email protected]>
Cc "Daniel P. Berrangé" <[email protected]
Cc Eduardo Habkost <[email protected]>

Message-ID: <[email protected]>

---
 hw/core/qdev-properties-system.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/qdev-properties-system.c +1 -0
index b45e90edb2..00c968f4f5 100644
@@ -242,6 +242,7 @@ static void get_chr(Object *obj, Visitor *v, const char *name, void *opaque,
 static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
                     Error **errp)
 {
+    ERRP_GUARD();
     Property *prop = opaque;
     CharBackend *be = object_field_prop_ptr(obj, prop);
     Chardev *s;
Signature · 1 line
2.41.0
#8 lore raw

[PULL 10/13] hw/core: Cleanup unused included headers in numa.c

In reply to Philippe Mathieu-Daudé

From: Zhao Liu <[email protected]>

Remove unused header in numa.c:
* qemu/bitmap.h
* migration/vmstate.h

Note: Though parse_numa_hmat_lb() has the variable named "bitmap_copy", it doesn't use the normal bitmap ops so that it's safe to exclude qemu/bitmap.h header.

Tested by "./configure" and then "make".

Message-ID: <[email protected]>

---
 hw/core/numa.c | 2 --
 1 file changed, 2 deletions(-)
hw/core/numa.c +0 -2
index f08956ddb0..81d2124349 100644
@@ -28,7 +28,6 @@
 #include "sysemu/numa.h"
 #include "exec/cpu-common.h"
 #include "exec/ramlist.h"
-#include "qemu/bitmap.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "qapi/opts-visitor.h"
@@ -36,7 +35,6 @@
 #include "sysemu/qtest.h"
 #include "hw/core/cpu.h"
 #include "hw/mem/pc-dimm.h"
-#include "migration/vmstate.h"
 #include "hw/boards.h"
 #include "hw/mem/memory-device.h"
 #include "qemu/option.h"
Signature · 1 line
2.41.0
#9 lore raw

[PULL 13/13] docs/about/deprecated.rst: Move SMP configurations item to system emulator section

In reply to Philippe Mathieu-Daudé

From: Zhao Liu <[email protected]>

In the commit 54c4ea8f3ae6 ("hw/core/machine-smp: Deprecate unsupported 'parameter=1' SMP configurations"), the SMP related item is put under the section "User-mode emulator command line arguments" instead of "System emulator command line arguments".

-smp is a system emulator command, so move SMP configurations item to system emulator section.

Message-ID: <[email protected]>

---
 docs/about/deprecated.rst | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
docs/about/deprecated.rst +10 -10
index dfd681cd02..2f9277c915 100644
@@ -47,16 +47,6 @@ as short-form boolean values, and passed to plugins as ``arg_name=on``.
 However, short-form booleans are deprecated and full explicit ``arg_name=on``
 form is preferred.
 
-User-mode emulator command line arguments
------------------------------------------
-
-``-p`` (since 9.0)
-''''''''''''''''''
-
-The ``-p`` option pretends to control the host page size.  However,
-it is not possible to change the host page size, and using the
-option only causes failures.
-
 ``-smp`` (Unsupported "parameter=1" SMP configurations) (since 9.0)
 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
@@ -71,6 +61,16 @@ configurations (e.g. -smp drawers=1,books=1,clusters=1 for x86 PC machine) is
 marked deprecated since 9.0, users have to ensure that all the topology members
 described with -smp are supported by the target machine.
 
+User-mode emulator command line arguments
+-----------------------------------------
+
+``-p`` (since 9.0)
+''''''''''''''''''
+
+The ``-p`` option pretends to control the host page size.  However,
+it is not possible to change the host page size, and using the
+option only causes failures.
+
 QEMU Machine Protocol (QMP) commands
 ------------------------------------
 
Signature · 1 line
2.41.0
#10 lore raw

[PULL 11/13] hw/gpio: introduce pcf8574 driver

In reply to Philippe Mathieu-Daudé

From: Dmitriy Sharikhin <[email protected]>

NXP PCF8574 and compatible ICs are simple I2C GPIO expanders. PCF8574 incorporates quasi-bidirectional IO, and simple communication protocol, when IO read is I2C byte read, and IO write is I2C byte write. User can think of it as open-drain port, when line high state is input and line low state is output.

Message-ID: <[email protected]>

---
 MAINTAINERS               |   6 ++
 include/hw/gpio/pcf8574.h |  15 ++++
 hw/gpio/pcf8574.c         | 162 ++++++++++++++++++++++++++++++++++++++
 hw/gpio/Kconfig           |   4 +
 hw/gpio/meson.build       |   1 +
 5 files changed, 188 insertions(+)
 create mode 100644 include/hw/gpio/pcf8574.h
 create mode 100644 hw/gpio/pcf8574.c
MAINTAINERS +6 -0
index 4d96f855de..72c23e3682 100644
@@ -2503,6 +2503,12 @@ S: Maintained
 F: hw/i2c/i2c_mux_pca954x.c
 F: include/hw/i2c/i2c_mux_pca954x.h
 
+pcf8574
+M: Dmitrii Sharikhin <[email protected]>
+S: Maintained
+F: hw/gpio/pcf8574.c
+F: include/gpio/pcf8574.h
+
 Generic Loader
 M: Alistair Francis <[email protected]>
 S: Maintained
include/hw/gpio/pcf8574.h new file +15 -0
new file mode 100644
index 0000000000..3291d7dbbc
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+/*
+ * NXP PCF8574 8-port I2C GPIO expansion chip.
+ *
+ * Copyright (c) 2024 KNS Group (YADRO).
+ * Written by Dmitrii Sharikhin <[email protected]>
+ */
+
+#ifndef _HW_GPIO_PCF8574
+#define _HW_GPIO_PCF8574
+
+#define TYPE_PCF8574 "pcf8574"
+
+#endif /* _HW_GPIO_PCF8574 */
hw/gpio/pcf8574.c new file +162 -0

162 lines not on this page · raw message

hw/gpio/Kconfig +4 -0
index 712940b8e0..19c97cc823 100644
@@ -19,3 +19,7 @@ config SIFIVE_GPIO
 
 config STM32L4X5_GPIO
     bool
+
+config PCF8574
+    bool
+    depends on I2C
hw/gpio/meson.build +1 -0
index 3454b503ae..791e93a97b 100644
@@ -16,3 +16,4 @@ system_ss.add(when: 'CONFIG_RASPI', if_true: files(
 system_ss.add(when: 'CONFIG_STM32L4X5_SOC', if_true: files('stm32l4x5_gpio.c'))
 system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_gpio.c'))
 system_ss.add(when: 'CONFIG_SIFIVE_GPIO', if_true: files('sifive_gpio.c'))
+system_ss.add(when: 'CONFIG_PCF8574', if_true: files('pcf8574.c'))
Signature · 1 line
2.41.0
#11 lore raw

[PULL 07/13] sun4u: remap ebus BAR0 to use unassigned_io_ops instead of alias to PCI IO space

In reply to Philippe Mathieu-Daudé

From: Mark Cave-Ayland <[email protected]>

During kernel startup OpenBSD accesses addresses mapped by BAR0 of the ebus device but at offsets where no IO devices exist. Before commit 4aa07e8649 ("hw/sparc64/ebus:
Access memory regions via pci_address_space_io()") BAR0 was mapped to legacy IO space which allows accesses to unmapped devices to succeed, but afterwards these accesses to unmapped PCI IO space cause a memory fault which prevents OpenBSD from booting.

Since no devices are mapped at the addresses accessed by OpenBSD, change ebus BAR0 from a PCI IO space alias to an IO memory region using unassigned_io_ops which allows these accesses to succeed and so allows OpenBSD to boot once again.

Fixes 4aa07e8649 ("hw/sparc64/ebus: Access memory regions via pci_address_space_io()")

Message-ID: <[email protected]>

---
 hw/sparc64/sun4u.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
hw/sparc64/sun4u.c +7 -2
index eda9b58a21..cff6d5abaf 100644
@@ -360,8 +360,13 @@ static void ebus_realize(PCIDevice *pci_dev, Error **errp)
     pci_dev->config[0x09] = 0x00; // programming i/f
     pci_dev->config[0x0D] = 0x0a; // latency_timer
 
-    memory_region_init_alias(&s->bar0, OBJECT(s), "bar0",
-                             pci_address_space_io(pci_dev), 0, 0x1000000);
+    /*
+     * BAR0 is accessed by OpenBSD but not for ebus device access: allow any
+     * memory access to this region to succeed which allows the OpenBSD kernel
+     * to boot.
+     */
+    memory_region_init_io(&s->bar0, OBJECT(s), &unassigned_io_ops, s,
+                          "bar0", 0x1000000);
     pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar0);
     memory_region_init_alias(&s->bar1, OBJECT(s), "bar1",
                              pci_address_space_io(pci_dev), 0, 0x8000);
Signature · 1 line
2.41.0
#12 lore raw

[PULL 08/13] hw/core: Cleanup unused included headers in cpu-common.c

In reply to Philippe Mathieu-Daudé

From: Zhao Liu <[email protected]>

Remove unused headers in cpu-common.c:
* qemu/notify.h
* exec/cpu-common.h
* qemu/error-report.h
* qemu/qemu-print.h

Tested by "./configure" and then "make".

Message-ID: <[email protected]>

---
 hw/core/cpu-common.c | 4 ----
 1 file changed, 4 deletions(-)
hw/core/cpu-common.c +0 -4
index 0108fb11db..4bd9c70a83 100644
@@ -22,14 +22,10 @@
 #include "qapi/error.h"
 #include "hw/core/cpu.h"
 #include "sysemu/hw_accel.h"
-#include "qemu/notify.h"
 #include "qemu/log.h"
 #include "qemu/main-loop.h"
 #include "exec/log.h"
-#include "exec/cpu-common.h"
 #include "exec/gdbstub.h"
-#include "qemu/error-report.h"
-#include "qemu/qemu-print.h"
 #include "sysemu/tcg.h"
 #include "hw/boards.h"
 #include "hw/qdev-properties.h"
Signature · 1 line
2.41.0
#13 lore raw

[PULL 12/13] meson.build: Always require an objc compiler on macos hosts

In reply to Philippe Mathieu-Daudé

From: Peter Maydell <[email protected]>

We currently only insist that an ObjectiveC compiler is present on macos hosts if we're building the Cocoa UI. However, since then we've added some other parts of QEMU which are also written in ObjC:
the coreaudio audio backend, and the vmnet net backend. This means that if you try to configure QEMU on macos with --disable-cocoa the build will fail:

../meson.build:3741:13: ERROR: No host machine compiler for 'audio/coreaudio.m'

Since in practice any macos host will have an ObjC compiler available, rather than trying to gate the compiler detection on an increasingly complicated list of every bit of QEMU that uses ObjC, just require it unconditionally on macos hosts.

Resolves https://gitlab.com/qemu-project/qemu/-/issues/2138

Message-ID: <[email protected]>

---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
index f9dbe7634e..e3fab8ce9f 100644
@@ -66,7 +66,7 @@ if host_os == 'windows' and add_languages('cpp', required: false, native: false)
   cxx = meson.get_compiler('cpp')
 endif
 if host_os == 'darwin' and \
-   add_languages('objc', required: get_option('cocoa'), native: false)
+   add_languages('objc', required: true, native: false)
   all_languages += ['objc']
   objc = meson.get_compiler('objc')
 endif
Signature · 1 line
2.41.0
#14 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 26 lines · Philippe Mathieu-Daudé

The following changes since commit 7489f7f3f81dcb776df8c1b9a9db281fc21bf05f:

Merge tag 'hw-misc-20240309' of https://github.com/philmd/qemu into staging (2024-03-09 20:12:21 +0000)

are available in the Git repository at:

https://github.com/philmd/qemu.git tags/hw-misc-20240312

for you to fetch changes up to afc8b05cea14b2eea6f1eaa640f74b21486fca48:

docs/about/deprecated.rst: Move SMP configurations item to system emulator section (2024-03-12 09:19:04 +0100)

----------------------------------------------------------------
Misc HW patch queue

- Rename hw/ide/ahci-internal.h for consistency (Zoltan)
- More convenient PCI hotplug trace events (Vladimir)
- Short CLI option to add drives for sam460ex machine (Zoltan)
- More missing ERRP_GUARD() macros (Zhao)
- Avoid faulting when unmapped I/O BAR is accessed on SPARC EBUS (Mark)
- Remove unused includes in hw/core/ (Zhao)
- New PCF8574 GPIO over I2C model (Dmitriy)
- Require ObjC on Darwin macOS by default (Peter)
- Corrected "-smp parameter=1" placement in docs/ (Zhao)

Quoted 2 lines

----------------------------------------------------------------

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/9.0
for any user-visible changes.

-- PMM