Skip to contentSkip to conversation

Trivial patches for 2024-01-05

GIT PULL Applied Michael Tokarev 2 participants 8 messages Jan 5, 2024 – Jan 8, 2024 RISC-V

lore
Share & tools
lore
#0 lore raw

The following changes since commit 0c1eccd368af8805ec0fb11e6cf25d0684d37328:

Merge tag 'hw-cpus-20240105' of https://github.com/philmd/qemu into staging (2024-01-05 16:08:58 +0000)

are available in the Git repository at:

https://gitlab.com/mjt0k/qemu.git tags/pull-trivial-patches

for you to fetch changes up to 8a780cd212647a6013c8ea59e0929dad996e2c54:

docs: use "buses" rather than "busses" (2024-01-05 22:28:54 +0300)

----------------------------------------------------------------
trivial patches for 2024-01-05

Random stuff here and there, plus a riscv bugfix.

----------------------------------------------------------------
Bin Meng (1):
hw/net: cadence_gem: Fix MDIO_OP_xxx values

Max Erenberg (1):
edu: fix DMA range upper bound check

Michael Tokarev (2):
chardev/char.c: fix "abstract device type" error message audio/audio.c: remove trailing newline in error_setg

Samuel Tardieu (1):
docs: use "buses" rather than "busses"

Xu Lu (1):
target/riscv: Fix mcycle/minstret increment behavior

 audio/audio.c               |  2 +-
 chardev/char.c              |  2 +-
 docs/system/arm/palm.rst    |  2 +-
 docs/system/arm/xscale.rst  |  2 +-
 docs/system/devices/can.rst |  6 +++---
 hw/misc/edu.c               |  2 +-
 hw/net/cadence_gem.c        |  4 ++--
 target/riscv/csr.c          | 14 +++++++-------
 8 files changed, 17 insertions(+), 17 deletions(-)
#1 lore raw

[PULL 1/6] target/riscv: Fix mcycle/minstret increment behavior

From: Xu Lu <[email protected]>

The mcycle/minstret counter's stop flag is mistakenly updated on a copy on stack. Thus the counter increments even when the CY/IR bit in the mcountinhibit register is set. This commit corrects its behavior.

Fixes 3780e33732f88 (target/riscv: Support mcycle/minstret write operation)
---
 target/riscv/csr.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
target/riscv/csr.c +7 -7
index fde7ce1a53..c50a33397c 100644
@@ -907,11 +907,11 @@ static int write_mhpmcounterh(CPURISCVState *env, int csrno, target_ulong val)
 static RISCVException riscv_pmu_read_ctr(CPURISCVState *env, target_ulong *val,
                                          bool upper_half, uint32_t ctr_idx)
 {
-    PMUCTRState counter = env->pmu_ctrs[ctr_idx];
-    target_ulong ctr_prev = upper_half ? counter.mhpmcounterh_prev :
-                                         counter.mhpmcounter_prev;
-    target_ulong ctr_val = upper_half ? counter.mhpmcounterh_val :
-                                        counter.mhpmcounter_val;
+    PMUCTRState *counter = &env->pmu_ctrs[ctr_idx];
+    target_ulong ctr_prev = upper_half ? counter->mhpmcounterh_prev :
+                                         counter->mhpmcounter_prev;
+    target_ulong ctr_val = upper_half ? counter->mhpmcounterh_val :
+                                        counter->mhpmcounter_val;
 
     if (get_field(env->mcountinhibit, BIT(ctr_idx))) {
         /*
@@ -919,12 +919,12 @@ static RISCVException riscv_pmu_read_ctr(CPURISCVState *env, target_ulong *val,
          * stop the icount counting. Just return the counter value written by
          * the supervisor to indicate that counter was not incremented.
          */
-        if (!counter.started) {
+        if (!counter->started) {
             *val = ctr_val;
             return RISCV_EXCP_NONE;
         } else {
             /* Mark that the counter has been stopped */
-            counter.started = false;
+            counter->started = false;
         }
     }
 
Signature · 1 line
2.39.2
#2 lore raw

[PULL 2/6] chardev/char.c: fix "abstract device type" error message

In reply to Michael Tokarev

Current error message:

qemu-system-x86_64: -chardev spice,id=foo: Parameter 'driver' expects an abstract device type

while in fact the meaning is in reverse, -chardev expects a non-abstract device type.

Fixes 777357d758d9 ("chardev: qom-ify" 2016-12-07)
---
 chardev/char.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
chardev/char.c +1 -1
index 996a024c7a..119b548784 100644
@@ -518,7 +518,7 @@ static const ChardevClass *char_get_class(const char *driver, Error **errp)
 
     if (object_class_is_abstract(oc)) {
         error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver",
-                   "an abstract device type");
+                   "a non-abstract device type");
         return NULL;
     }
 
Signature · 1 line
2.39.2
#3 lore raw

[PULL 3/6] audio/audio.c: remove trailing newline in error_setg

In reply to Michael Tokarev

error_setg() appends newline to the formatted message.

Fixes cb94ff5f80c5 ("audio: propagate Error * out of audio_init")
---
 audio/audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
audio/audio.c +1 -1
index a1097bb016..af0ae33fed 100644
@@ -1744,7 +1744,7 @@ static AudioState *audio_init(Audiodev *dev, Error **errp)
         if (driver) {
             done = !audio_driver_init(s, driver, dev, errp);
         } else {
-            error_setg(errp, "Unknown audio driver `%s'\n", drvname);
+            error_setg(errp, "Unknown audio driver `%s'", drvname);
         }
         if (!done) {
             goto out;
Signature · 1 line
2.39.2
#4 lore raw

[PULL 4/6] hw/net: cadence_gem: Fix MDIO_OP_xxx values

In reply to Michael Tokarev

From: Bin Meng <[email protected]>

Testing upstream U-Boot with 'sifive_u' machine we see:

=> dhcp
ethernet@10090000: PHY present at 0
Could not get PHY for ethernet@10090000: addr 0
phy_connect failed

This has been working till QEMU 8.1 but broken since QEMU 8.2.

Fixes 1b09eeb122aa ("hw/net/cadence_gem: use FIELD to describe PHYMNTNC register fields")
---
 hw/net/cadence_gem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/cadence_gem.c +2 -2
index d7b7b134b0..ec7bf562e5 100644
@@ -199,8 +199,8 @@ REG32(PHYMNTNC, 0x34) /* Phy Maintenance reg */
     FIELD(PHYMNTNC, PHY_ADDR, 23, 5)
     FIELD(PHYMNTNC, OP, 28, 2)
     FIELD(PHYMNTNC, ST, 30, 2)
-#define MDIO_OP_READ    0x3
-#define MDIO_OP_WRITE   0x2
+#define MDIO_OP_READ    0x2
+#define MDIO_OP_WRITE   0x1
 
 REG32(RXPAUSE, 0x38) /* RX Pause Time reg */
 REG32(TXPAUSE, 0x3c) /* TX Pause Time reg */
Signature · 1 line
2.39.2
#5 lore raw

[PULL 5/6] edu: fix DMA range upper bound check

In reply to Michael Tokarev

From: Max Erenberg <[email protected]>

The edu_check_range function checks that start <= end1 < end2, where end1 is the upper bound (exclusive) of the guest-supplied DMA range and end2 is the upper bound (exclusive) of the device's allowed DMA range. When the guest tries to transfer exactly DMA_SIZE (4096) bytes, end1 will be equal to end2, so the check fails and QEMU aborts with this puzzling error message (newlines added for formatting):

qemu: hardware error: EDU: DMA range

    0x0000000000040000-0x0000000000040fff out of bounds

(0x0000000000040000-0x0000000000040fff)!

By checking end1 <= end2 instead, guests will be allowed to transfer exactly 4096 bytes. It is not necessary to explicitly check for start <= end1 because the previous two checks (within(addr, start, end2) and end1 > addr) imply start < end1.

Fixes b30934cb52a7 ("hw: misc, add educational driver", 2015-01-21)
---
 hw/misc/edu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/misc/edu.c +1 -1
index a1f8bc77e7..e64a246d3f 100644
@@ -115,7 +115,7 @@ static void edu_check_range(uint64_t addr, uint64_t size1, uint64_t start,
     uint64_t end2 = start + size2;
 
     if (within(addr, start, end2) &&
-            end1 > addr && within(end1, start, end2)) {
+            end1 > addr && end1 <= end2) {
         return;
     }
 
Signature · 1 line
2.39.2
#6 lore raw

[PULL 6/6] docs: use "buses" rather than "busses"

In reply to Michael Tokarev

From: Samuel Tardieu <[email protected]>

If "busses" might be encountered as a plural of "bus" (5 instances), the correct spelling is "buses" (26 instances). Fixing those 5 instances makes the doc more consistent.

---
 docs/system/arm/palm.rst    | 2 +-
 docs/system/arm/xscale.rst  | 2 +-
 docs/system/devices/can.rst | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)
docs/system/arm/palm.rst +1 -1
index 47ff9b36d4..61bc8d34f4 100644
@@ -14,7 +14,7 @@ following elements:
 -  On-chip Real Time Clock
 
 -  TI TSC2102i touchscreen controller / analog-digital converter /
-   Audio CODEC, connected through MicroWire and |I2S| busses
+   Audio CODEC, connected through MicroWire and |I2S| buses
 
 -  GPIO-connected matrix keypad
 
docs/system/arm/xscale.rst +1 -1
index d2d5949e10..e239136c3c 100644
@@ -32,4 +32,4 @@ The clamshell PDA models emulation includes the following peripherals:
 
 -  Three on-chip UARTs
 
--  WM8750 audio CODEC on |I2C| and |I2S| busses
+-  WM8750 audio CODEC on |I2C| and |I2S| buses
docs/system/devices/can.rst +3 -3
index 0af3d9912a..09121836fd 100644
@@ -1,12 +1,12 @@
 CAN Bus Emulation Support
 =========================
 The CAN bus emulation provides mechanism to connect multiple
-emulated CAN controller chips together by one or multiple CAN busses
-(the controller device "canbus"  parameter). The individual busses
+emulated CAN controller chips together by one or multiple CAN buses
+(the controller device "canbus"  parameter). The individual buses
 can be connected to host system CAN API (at this time only Linux
 SocketCAN is supported).
 
-The concept of busses is generic and different CAN controllers
+The concept of buses is generic and different CAN controllers
 can be implemented.
 
 The initial submission implemented SJA1000 controller which
Signature · 1 line
2.39.2
#7 lore raw
In reply to Michael Tokarev
Quoted 9 lines · Michael Tokarev

The following changes since commit 0c1eccd368af8805ec0fb11e6cf25d0684d37328:

Merge tag 'hw-cpus-20240105' of https://github.com/philmd/qemu into staging (2024-01-05 16:08:58 +0000)

are available in the Git repository at:

https://gitlab.com/mjt0k/qemu.git tags/pull-trivial-patches

Quoted 9 lines

for you to fetch changes up to 8a780cd212647a6013c8ea59e0929dad996e2c54:

docs: use "buses" rather than "busses" (2024-01-05 22:28:54 +0300)

----------------------------------------------------------------
trivial patches for 2024-01-05

Random stuff here and there, plus a riscv bugfix.

Applied, thanks.

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

-- PMM