[Qemu-commits] [qemu/qemu] 765fdc: target/openrisc: Set EPCR to next PC on FPE except...

2023-08-09 Thread Richard Henderson via Qemu-commits
  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 765fdc1e8355d4bae563b3b185c5f9d079384164
  
https://github.com/qemu/qemu/commit/765fdc1e8355d4bae563b3b185c5f9d079384164
  Author: Stafford Horne 
  Date:   2023-07-31 (Mon, 31 Jul 2023)

  Changed paths:
M target/openrisc/interrupt.c

  Log Message:
  ---
  target/openrisc: Set EPCR to next PC on FPE exceptions

The architecture specification calls for the EPCR to be set to "Address
of next not executed instruction" when there is a floating point
exception (FPE).  This was not being done, so fix it by using the same
pattern as syscall.  Also, we move this logic down to be done for
instructions not in the delay slot as called for by the architecture
manual.

Without this patch FPU exceptions will loop, as the exception handling
will always return back to the failed floating point instruction.

This was not noticed in earlier testing because:

 1. The compiler usually generates code which clobbers the input operand
such as:

  lf.div.s r19,r17,r19

 2. The target will store the operation output before to the register
before handling the exception.  So an operation such as:

  float a = 100.0f;
  float b = 0.0f;
  float c = a / b;/* lf.div.s r19,r17,r19 */

Will first execute:

  100 / 0-> Store inf to c (r19)
 -> triggering divide by zero exception
 -> handle and return

Then it will execute:

  100 / inf  -> Store 0 to c  (no exception)

To confirm the looping behavior and the fix I used the following:

float fpu_div(float a, float b) {
float c;
asm volatile("lf.div.s %0, %1, %2"
  : "+r" (c)
  : "r" (a), "r" (b));
return c;
}

Reviewed-by: Richard Henderson 
Signed-off-by: Stafford Horne 


  Commit: 64d3be986f9e2379bc688bf1d0aca0557e0035ca
  
https://github.com/qemu/qemu/commit/64d3be986f9e2379bc688bf1d0aca0557e0035ca
  Author: Richard Henderson 
  Date:   2023-08-09 (Wed, 09 Aug 2023)

  Changed paths:
M target/openrisc/interrupt.c

  Log Message:
  ---
  Merge tag 'or1k-pull-request-20230809' of https://github.com/stffrdhrn/qemu 
into staging

OpenRISC FPU Fix for 8.1

A patch to pass the correct exception address when handling floating
point exceptions.

# -BEGIN PGP SIGNATURE-
#
# iQIzBAABCAAdFiEE2cRzVK74bBA6Je/xw7McLV5mJ+QFAmTT95sACgkQw7McLV5m
# J+TV2g/8CTpOm2bvyFF0YmRhmTBit0kqyDcX1Shi8/2SMO4++CCpIp1mlaxdHZKe
# swdOqIqJeCl3+v+z4xN3ubNMis1Gac8DmXVpVmnUoocDS6m0zM3ly9kETKjYy2vn
# +GLGzOJ+GnPeQ2oApWwOyCqdCwSx2ZuIYK+FRKIx8T1pRm4Nb1gGP6nRKYAy0+C9
# aINdaQEZrFMKl8mlEuGcNmw5YDVvT6M9+KAMaNG0AzG8N9oMCo8VZpeY4z0qkZVp
# forksGucRoWVZ5JWl6kzcPAxxAf49olRx0njfbbUcUlyXtsVQpNhPPsdDGAE5gLu
# 8kHqtRG5OIJUvsZUaedHmJW9BsISnKqIhB7keG72xeBCYPqsKkzpWotq79I50hWY
# arTvAbyEwNCPEi1kpevveuGokoKsHKr/6yJRsA2VXM5AFhIy54DkLNz6Zh8W1OGA
# Nst45kSt7tQsTwxXHTHWGO6gRK/7ZtSr/afsEYZCz9vRUnb4UMeBBAuM9u0W+WYZ
# +hEZivQI7AEVuFbfzCTpw96jAPg4tpJ0JzC0o3Vh/EKIZahrPdzvmBlsV15geu4/
# xa5PBWRFpySLEO/6/I9XrIux8wjQ1NHOTC6NtJkH33tu9tJ9pfmyRs+jdUiNwWyd
# mMz0jvDUhjGaqUYSbXDvBLcSAIKbpXpnay2StSt0S/Enr08KU+o=
# =yZi9
# -END PGP SIGNATURE-
# gpg: Signature made Wed 09 Aug 2023 01:31:23 PM PDT
# gpg:using RSA key D9C47354AEF86C103A25EFF1C3B31C2D5E6627E4
# gpg: Good signature from "Stafford Horne " [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:  There is no indication that the signature belongs to the owner.
# Primary key fingerprint: D9C4 7354 AEF8 6C10 3A25  EFF1 C3B3 1C2D 5E66 27E4

* tag 'or1k-pull-request-20230809' of https://github.com/stffrdhrn/qemu:
  target/openrisc: Set EPCR to next PC on FPE exceptions

Signed-off-by: Richard Henderson 


Compare: https://github.com/qemu/qemu/compare/e53e2e2a1bfe...64d3be986f9e



[Qemu-commits] [qemu/qemu] 765fdc: target/openrisc: Set EPCR to next PC on FPE except...

2023-08-09 Thread Richard Henderson via Qemu-commits
  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 765fdc1e8355d4bae563b3b185c5f9d079384164
  
https://github.com/qemu/qemu/commit/765fdc1e8355d4bae563b3b185c5f9d079384164
  Author: Stafford Horne 
  Date:   2023-07-31 (Mon, 31 Jul 2023)

  Changed paths:
M target/openrisc/interrupt.c

  Log Message:
  ---
  target/openrisc: Set EPCR to next PC on FPE exceptions

The architecture specification calls for the EPCR to be set to "Address
of next not executed instruction" when there is a floating point
exception (FPE).  This was not being done, so fix it by using the same
pattern as syscall.  Also, we move this logic down to be done for
instructions not in the delay slot as called for by the architecture
manual.

Without this patch FPU exceptions will loop, as the exception handling
will always return back to the failed floating point instruction.

This was not noticed in earlier testing because:

 1. The compiler usually generates code which clobbers the input operand
such as:

  lf.div.s r19,r17,r19

 2. The target will store the operation output before to the register
before handling the exception.  So an operation such as:

  float a = 100.0f;
  float b = 0.0f;
  float c = a / b;/* lf.div.s r19,r17,r19 */

Will first execute:

  100 / 0-> Store inf to c (r19)
 -> triggering divide by zero exception
 -> handle and return

Then it will execute:

  100 / inf  -> Store 0 to c  (no exception)

To confirm the looping behavior and the fix I used the following:

float fpu_div(float a, float b) {
float c;
asm volatile("lf.div.s %0, %1, %2"
  : "+r" (c)
  : "r" (a), "r" (b));
return c;
}

Reviewed-by: Richard Henderson 
Signed-off-by: Stafford Horne 


  Commit: 64d3be986f9e2379bc688bf1d0aca0557e0035ca
  
https://github.com/qemu/qemu/commit/64d3be986f9e2379bc688bf1d0aca0557e0035ca
  Author: Richard Henderson 
  Date:   2023-08-09 (Wed, 09 Aug 2023)

  Changed paths:
M target/openrisc/interrupt.c

  Log Message:
  ---
  Merge tag 'or1k-pull-request-20230809' of https://github.com/stffrdhrn/qemu 
into staging

OpenRISC FPU Fix for 8.1

A patch to pass the correct exception address when handling floating
point exceptions.

# -BEGIN PGP SIGNATURE-
#
# iQIzBAABCAAdFiEE2cRzVK74bBA6Je/xw7McLV5mJ+QFAmTT95sACgkQw7McLV5m
# J+TV2g/8CTpOm2bvyFF0YmRhmTBit0kqyDcX1Shi8/2SMO4++CCpIp1mlaxdHZKe
# swdOqIqJeCl3+v+z4xN3ubNMis1Gac8DmXVpVmnUoocDS6m0zM3ly9kETKjYy2vn
# +GLGzOJ+GnPeQ2oApWwOyCqdCwSx2ZuIYK+FRKIx8T1pRm4Nb1gGP6nRKYAy0+C9
# aINdaQEZrFMKl8mlEuGcNmw5YDVvT6M9+KAMaNG0AzG8N9oMCo8VZpeY4z0qkZVp
# forksGucRoWVZ5JWl6kzcPAxxAf49olRx0njfbbUcUlyXtsVQpNhPPsdDGAE5gLu
# 8kHqtRG5OIJUvsZUaedHmJW9BsISnKqIhB7keG72xeBCYPqsKkzpWotq79I50hWY
# arTvAbyEwNCPEi1kpevveuGokoKsHKr/6yJRsA2VXM5AFhIy54DkLNz6Zh8W1OGA
# Nst45kSt7tQsTwxXHTHWGO6gRK/7ZtSr/afsEYZCz9vRUnb4UMeBBAuM9u0W+WYZ
# +hEZivQI7AEVuFbfzCTpw96jAPg4tpJ0JzC0o3Vh/EKIZahrPdzvmBlsV15geu4/
# xa5PBWRFpySLEO/6/I9XrIux8wjQ1NHOTC6NtJkH33tu9tJ9pfmyRs+jdUiNwWyd
# mMz0jvDUhjGaqUYSbXDvBLcSAIKbpXpnay2StSt0S/Enr08KU+o=
# =yZi9
# -END PGP SIGNATURE-
# gpg: Signature made Wed 09 Aug 2023 01:31:23 PM PDT
# gpg:using RSA key D9C47354AEF86C103A25EFF1C3B31C2D5E6627E4
# gpg: Good signature from "Stafford Horne " [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:  There is no indication that the signature belongs to the owner.
# Primary key fingerprint: D9C4 7354 AEF8 6C10 3A25  EFF1 C3B3 1C2D 5E66 27E4

* tag 'or1k-pull-request-20230809' of https://github.com/stffrdhrn/qemu:
  target/openrisc: Set EPCR to next PC on FPE exceptions

Signed-off-by: Richard Henderson 


Compare: https://github.com/qemu/qemu/compare/e53e2e2a1bfe...64d3be986f9e



[Qemu-commits] [qemu/qemu]

2023-08-09 Thread Alex Bennée via Qemu-commits
  Branch: refs/heads/mas
  Home:   https://github.com/qemu/qemu



[Qemu-commits] [qemu/qemu]

2023-08-09 Thread Alex Bennée via Qemu-commits
  Branch: refs/heads/mas
  Home:   https://github.com/qemu/qemu



[Qemu-commits] [qemu/qemu] c42e77: qemu/osdep: Remove fallback for MAP_FIXED_NOREPLACE

2023-08-09 Thread Richard Henderson via Qemu-commits
val-tree.c

  Log Message:
  ---
  util/interval-tree: Check root for null in interval_tree_iter_first

Fix a crash in qemu-user when running

cat /proc/self/maps

in a chroot, where /proc isn't mounted.

The problem was introduced by commit 3ce3dd8ca965 ("util/selfmap:
Rewrite using qemu/interval-tree.h") where in open_self_maps_1() the
function read_self_maps() is called and which returns NULL if it can't
read the hosts /proc/self/maps file. Afterwards that NULL is fed into
interval_tree_iter_first() which doesn't check if the root node is NULL.

Fix it by adding a check if root is NULL and return NULL in that case.

Signed-off-by: Helge Deller 
Fixes: 3ce3dd8ca965 ("util/selfmap: Rewrite using qemu/interval-tree.h")
Message-Id: 
Reviewed-by: Richard Henderson 
Signed-off-by: Richard Henderson 


  Commit: b8002058c45a50d893c51cf62ec96c70128fc1eb
  
https://github.com/qemu/qemu/commit/b8002058c45a50d893c51cf62ec96c70128fc1eb
  Author: Helge Deller 
  Date:   2023-08-09 (Wed, 09 Aug 2023)

  Changed paths:
M linux-user/syscall.c

  Log Message:
  ---
  linux-user: Fix openat() emulation to correctly detect accesses to /proc

In qemu we catch accesses to files like /proc/cpuinfo or /proc/net/route
and return to the guest contents which would be visible on a real system
(instead what the host would show).

This patch fixes a bug, where for example the accesses
cat /proccpuinfo
or
cd /proc && cat cpuinfo
will not be recognized by qemu and where qemu will wrongly show
the contents of the host's /proc/cpuinfo file.

Signed-off-by: Helge Deller 
Reviewed-by: Daniel P. Berrangé 
Message-Id: <20230803214450.647040-2-del...@gmx.de>
Reviewed-by: Richard Henderson 
Signed-off-by: Richard Henderson 


  Commit: c0b7823b2d1496771e0e0b20bd2fb96343ed9d17
  
https://github.com/qemu/qemu/commit/c0b7823b2d1496771e0e0b20bd2fb96343ed9d17
  Author: Richard Henderson 
  Date:   2023-08-09 (Wed, 09 Aug 2023)

  Changed paths:
M hw/nvme/ctrl.c

  Log Message:
  ---
  Merge tag 'nvme-fixes-pull-request' of https://gitlab.com/birkelund/qemu into 
staging

hw/nvme: fixes

# -BEGIN PGP SIGNATURE-
#
# iQEzBAABCgAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmTTlmcACgkQTeGvMW1P
# DemjjggAnhEvaJ4fgS9rsvtxCwtzLNc405xMpNxh6rPaxa+sL3RXPIrW6vWG13+W
# VcHw8DI8EV4DzAFP919ZmTUq9/boRbgxx84bStlILUPHWol8+eGYVVfT75wFKszx
# d4Vi3nyPSGlrxieSrosARqimcUDtFtDGGAxjvEcKgzhkcU3a8DVYAOmx/hdlWJJQ
# KSk4h/E1pKItFbvv+w9yszsbToeZN65oIy7kQtFgx0JOULyWvEYSVygotw/AruF3
# FPQ0nrJuZ115w3cJWDszznVJ6+3EcWbD3luQc3zE1FOPp76EkAOkcnPh1XbBJrE2
# 2BsCX/XnXcZT7BWSJbEzGXLsHjqsPg==
# =Zy0+
# -END PGP SIGNATURE-
# gpg: Signature made Wed 09 Aug 2023 06:36:39 AM PDT
# gpg:using RSA key 522833AA75E2DCE6A24766C04DE1AF316D4F0DE9
# gpg: Good signature from "Klaus Jensen " [unknown]
# gpg: aka "Klaus Jensen " [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:  There is no indication that the signature belongs to the owner.
# Primary key fingerprint: DDCA 4D9C 9EF9 31CC 3468  4272 63D5 6FC5 E55D A838
#  Subkey fingerprint: 5228 33AA 75E2 DCE6 A247  66C0 4DE1 AF31 6D4F 0DE9

* tag 'nvme-fixes-pull-request' of https://gitlab.com/birkelund/qemu:
  hw/nvme: fix null pointer access in ruh update
  hw/nvme: fix null pointer access in directive receive

Signed-off-by: Richard Henderson 


  Commit: e53e2e2a1bfe2dbf11333875705a0064e1183c0b
  
https://github.com/qemu/qemu/commit/e53e2e2a1bfe2dbf11333875705a0064e1183c0b
  Author: Richard Henderson 
  Date:   2023-08-09 (Wed, 09 Aug 2023)

  Changed paths:
M bsd-user/syscall_defs.h
M include/exec/user/thunk.h
M include/qemu/osdep.h
M linux-user/syscall.c
M linux-user/thunk.c
M tests/tcg/multiarch/gdbstub/test-proc-mappings.py
M util/interval-tree.c

  Log Message:
  ---
  Merge tag 'pull-lu-20230809' of https://gitlab.com/rth7680/qemu into staging

linux-user: Fixes for mmap syscall emulation
linux-user: Correctly detect access to /proc in openat
util/interval-tree: Check root for null in interval_tree_iter_first
tests/tcg: Disable filename test for info proc mappings

# -BEGIN PGP SIGNATURE-
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmTT0O4dHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV9NeQf/SGtJsvcMdPPcOt1P
# ZK9fBK+gS9XzWvkquSL2wehs0ZY61u2IHznIqsFxhhmPqNTZPKb27u6Cg8DCxYdw
# Hc+YMtjx2MOBv2pXTCc14XWkTsclP2jJaf2VUFIR/MowBJb7Xcgbv53PvRnCn3xT
# KC80Pm6eJZFT0EkQZwHbT8doakkjyIx8JIapdNFvD6Ne0CWCKOwDK9sF5ob1Tf5g
# BXyCw5ZtnCiToYw+RpBnhZ1wsInV+o/MV7FwcgrxGWB+4ovwRLknBzAggHvhz3ZO
# pdCqvobBtUk88+txMX6ewIDYU9BsuOnWDR+j99MD9/kPtbgSLlRYzxJ0PAjCMG6m
# xu0Tyg==
# =n1TD
# -END PGP SIGNATURE-
# gpg: Signature made Wed 09 Aug 2023 10:46:22 AM PDT
# gpg:using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:issuer "richard.hender...@linaro.org"
# gpg: Good si

[Qemu-commits] [qemu/qemu] c42e77: qemu/osdep: Remove fallback for MAP_FIXED_NOREPLACE

2023-08-09 Thread Richard Henderson via Qemu-commits
val-tree.c

  Log Message:
  ---
  util/interval-tree: Check root for null in interval_tree_iter_first

Fix a crash in qemu-user when running

cat /proc/self/maps

in a chroot, where /proc isn't mounted.

The problem was introduced by commit 3ce3dd8ca965 ("util/selfmap:
Rewrite using qemu/interval-tree.h") where in open_self_maps_1() the
function read_self_maps() is called and which returns NULL if it can't
read the hosts /proc/self/maps file. Afterwards that NULL is fed into
interval_tree_iter_first() which doesn't check if the root node is NULL.

Fix it by adding a check if root is NULL and return NULL in that case.

Signed-off-by: Helge Deller 
Fixes: 3ce3dd8ca965 ("util/selfmap: Rewrite using qemu/interval-tree.h")
Message-Id: 
Reviewed-by: Richard Henderson 
Signed-off-by: Richard Henderson 


  Commit: b8002058c45a50d893c51cf62ec96c70128fc1eb
  
https://github.com/qemu/qemu/commit/b8002058c45a50d893c51cf62ec96c70128fc1eb
  Author: Helge Deller 
  Date:   2023-08-09 (Wed, 09 Aug 2023)

  Changed paths:
M linux-user/syscall.c

  Log Message:
  ---
  linux-user: Fix openat() emulation to correctly detect accesses to /proc

In qemu we catch accesses to files like /proc/cpuinfo or /proc/net/route
and return to the guest contents which would be visible on a real system
(instead what the host would show).

This patch fixes a bug, where for example the accesses
cat /proccpuinfo
or
cd /proc && cat cpuinfo
will not be recognized by qemu and where qemu will wrongly show
the contents of the host's /proc/cpuinfo file.

Signed-off-by: Helge Deller 
Reviewed-by: Daniel P. Berrangé 
Message-Id: <20230803214450.647040-2-del...@gmx.de>
Reviewed-by: Richard Henderson 
Signed-off-by: Richard Henderson 


  Commit: c0b7823b2d1496771e0e0b20bd2fb96343ed9d17
  
https://github.com/qemu/qemu/commit/c0b7823b2d1496771e0e0b20bd2fb96343ed9d17
  Author: Richard Henderson 
  Date:   2023-08-09 (Wed, 09 Aug 2023)

  Changed paths:
M hw/nvme/ctrl.c

  Log Message:
  ---
  Merge tag 'nvme-fixes-pull-request' of https://gitlab.com/birkelund/qemu into 
staging

hw/nvme: fixes

# -BEGIN PGP SIGNATURE-
#
# iQEzBAABCgAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmTTlmcACgkQTeGvMW1P
# DemjjggAnhEvaJ4fgS9rsvtxCwtzLNc405xMpNxh6rPaxa+sL3RXPIrW6vWG13+W
# VcHw8DI8EV4DzAFP919ZmTUq9/boRbgxx84bStlILUPHWol8+eGYVVfT75wFKszx
# d4Vi3nyPSGlrxieSrosARqimcUDtFtDGGAxjvEcKgzhkcU3a8DVYAOmx/hdlWJJQ
# KSk4h/E1pKItFbvv+w9yszsbToeZN65oIy7kQtFgx0JOULyWvEYSVygotw/AruF3
# FPQ0nrJuZ115w3cJWDszznVJ6+3EcWbD3luQc3zE1FOPp76EkAOkcnPh1XbBJrE2
# 2BsCX/XnXcZT7BWSJbEzGXLsHjqsPg==
# =Zy0+
# -END PGP SIGNATURE-
# gpg: Signature made Wed 09 Aug 2023 06:36:39 AM PDT
# gpg:using RSA key 522833AA75E2DCE6A24766C04DE1AF316D4F0DE9
# gpg: Good signature from "Klaus Jensen " [unknown]
# gpg: aka "Klaus Jensen " [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:  There is no indication that the signature belongs to the owner.
# Primary key fingerprint: DDCA 4D9C 9EF9 31CC 3468  4272 63D5 6FC5 E55D A838
#  Subkey fingerprint: 5228 33AA 75E2 DCE6 A247  66C0 4DE1 AF31 6D4F 0DE9

* tag 'nvme-fixes-pull-request' of https://gitlab.com/birkelund/qemu:
  hw/nvme: fix null pointer access in ruh update
  hw/nvme: fix null pointer access in directive receive

Signed-off-by: Richard Henderson 


  Commit: e53e2e2a1bfe2dbf11333875705a0064e1183c0b
  
https://github.com/qemu/qemu/commit/e53e2e2a1bfe2dbf11333875705a0064e1183c0b
  Author: Richard Henderson 
  Date:   2023-08-09 (Wed, 09 Aug 2023)

  Changed paths:
M bsd-user/syscall_defs.h
M include/exec/user/thunk.h
M include/qemu/osdep.h
M linux-user/syscall.c
M linux-user/thunk.c
M tests/tcg/multiarch/gdbstub/test-proc-mappings.py
M util/interval-tree.c

  Log Message:
  ---
  Merge tag 'pull-lu-20230809' of https://gitlab.com/rth7680/qemu into staging

linux-user: Fixes for mmap syscall emulation
linux-user: Correctly detect access to /proc in openat
util/interval-tree: Check root for null in interval_tree_iter_first
tests/tcg: Disable filename test for info proc mappings

# -BEGIN PGP SIGNATURE-
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmTT0O4dHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV9NeQf/SGtJsvcMdPPcOt1P
# ZK9fBK+gS9XzWvkquSL2wehs0ZY61u2IHznIqsFxhhmPqNTZPKb27u6Cg8DCxYdw
# Hc+YMtjx2MOBv2pXTCc14XWkTsclP2jJaf2VUFIR/MowBJb7Xcgbv53PvRnCn3xT
# KC80Pm6eJZFT0EkQZwHbT8doakkjyIx8JIapdNFvD6Ne0CWCKOwDK9sF5ob1Tf5g
# BXyCw5ZtnCiToYw+RpBnhZ1wsInV+o/MV7FwcgrxGWB+4ovwRLknBzAggHvhz3ZO
# pdCqvobBtUk88+txMX6ewIDYU9BsuOnWDR+j99MD9/kPtbgSLlRYzxJ0PAjCMG6m
# xu0Tyg==
# =n1TD
# -END PGP SIGNATURE-
# gpg: Signature made Wed 09 Aug 2023 10:46:22 AM PDT
# gpg:using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:issuer "richard.hender...@linaro.org"
# gpg: Go