* [Qemu-devel] [PATCH v2 0/2] Add pseudo /proc/hardware and /proc/cpuinfo
@ 2019-05-17 13:31 Laurent Vivier
2019-05-17 13:31 ` [Qemu-devel] [PATCH v2 1/2] linux-user: add pseudo /proc/cpuinfo for sparc Laurent Vivier
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Laurent Vivier @ 2019-05-17 13:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, Laurent Vivier
They are used by some package setup scripts to set the default configuration.
v2: rebase
Laurent Vivier (2):
linux-user: add pseudo /proc/cpuinfo for sparc
linux-user: add pseudo /proc/hardware for m68k
linux-user/syscall.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
--
2.20.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v2 1/2] linux-user: add pseudo /proc/cpuinfo for sparc
2019-05-17 13:31 [Qemu-devel] [PATCH v2 0/2] Add pseudo /proc/hardware and /proc/cpuinfo Laurent Vivier
@ 2019-05-17 13:31 ` Laurent Vivier
2019-05-20 3:03 ` Richard Henderson
2019-05-17 13:31 ` [Qemu-devel] [PATCH v2 2/2] linux-user: add pseudo /proc/hardware for m68k Laurent Vivier
2019-05-20 10:57 ` [Qemu-devel] [PATCH v2 0/2] Add pseudo /proc/hardware and /proc/cpuinfo Philippe Mathieu-Daudé
2 siblings, 1 reply; 6+ messages in thread
From: Laurent Vivier @ 2019-05-17 13:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, Laurent Vivier
SPARC libc6 debian package wants to check the cpu level to be
installed or not:
WARNING: This machine has a SPARC V8 or earlier class processor.
Debian lenny and later does not support such old hardware
any longer.
To avoid this, it only needs to know if the machine type is sun4u or sun4v,
for that it reads the information from /proc/cpuinfo.
Fixes: 9a93c152fcdb4ab2cd85094487b33578fd693915
("linux-user: fix UNAME_MACHINE for sparc/sparc64")
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/syscall.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f5ff6f5dc8a8..43b1b106765c 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6786,12 +6786,15 @@ static int is_proc_myself(const char *filename, const char *entry)
return 0;
}
-#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
+#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) || \
+ defined(TARGET_SPARC)
static int is_proc(const char *filename, const char *entry)
{
return strcmp(filename, entry) == 0;
}
+#endif
+#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
static int open_net_route(void *cpu_env, int fd)
{
FILE *fp;
@@ -6836,6 +6839,14 @@ static int open_net_route(void *cpu_env, int fd)
}
#endif
+#if defined(TARGET_SPARC)
+static int open_cpuinfo(void *cpu_env, int fd)
+{
+ dprintf(fd, "type\t\t: sun4u\n");
+ return 0;
+}
+#endif
+
static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags, mode_t mode)
{
struct fake_open {
@@ -6851,6 +6862,9 @@ static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags,
{ "cmdline", open_self_cmdline, is_proc_myself },
#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
{ "/proc/net/route", open_net_route, is_proc },
+#endif
+#if defined(TARGET_SPARC)
+ { "/proc/cpuinfo", open_cpuinfo, is_proc },
#endif
{ NULL, NULL, NULL }
};
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v2 2/2] linux-user: add pseudo /proc/hardware for m68k
2019-05-17 13:31 [Qemu-devel] [PATCH v2 0/2] Add pseudo /proc/hardware and /proc/cpuinfo Laurent Vivier
2019-05-17 13:31 ` [Qemu-devel] [PATCH v2 1/2] linux-user: add pseudo /proc/cpuinfo for sparc Laurent Vivier
@ 2019-05-17 13:31 ` Laurent Vivier
2019-05-20 3:03 ` Richard Henderson
2019-05-20 10:57 ` [Qemu-devel] [PATCH v2 0/2] Add pseudo /proc/hardware and /proc/cpuinfo Philippe Mathieu-Daudé
2 siblings, 1 reply; 6+ messages in thread
From: Laurent Vivier @ 2019-05-17 13:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, Laurent Vivier
Debian console-setup uses /proc/hardware to guess the keyboard layout.
If the file /proc/hardware cannot be opened, the installation fails.
This patch adds a pseudo /proc/hardware file to report the model of
the machine. Instead of reporting a known and fake model, it
reports "qemu-m68k", which is true, and avoids to set the configuration
for an Amiga/Apple/Atari and let the user to chose the good one.
Bug: https://github.com/vivier/qemu-m68k/issues/34
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/syscall.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 43b1b106765c..544fcd02be9a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6787,7 +6787,7 @@ static int is_proc_myself(const char *filename, const char *entry)
}
#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) || \
- defined(TARGET_SPARC)
+ defined(TARGET_SPARC) || defined(TARGET_M68K)
static int is_proc(const char *filename, const char *entry)
{
return strcmp(filename, entry) == 0;
@@ -6847,6 +6847,14 @@ static int open_cpuinfo(void *cpu_env, int fd)
}
#endif
+#if defined(TARGET_M68K)
+static int open_hardware(void *cpu_env, int fd)
+{
+ dprintf(fd, "Model:\t\tqemu-m68k\n");
+ return 0;
+}
+#endif
+
static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags, mode_t mode)
{
struct fake_open {
@@ -6865,6 +6873,9 @@ static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags,
#endif
#if defined(TARGET_SPARC)
{ "/proc/cpuinfo", open_cpuinfo, is_proc },
+#endif
+#if defined(TARGET_M68K)
+ { "/proc/hardware", open_hardware, is_proc },
#endif
{ NULL, NULL, NULL }
};
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/2] linux-user: add pseudo /proc/cpuinfo for sparc
2019-05-17 13:31 ` [Qemu-devel] [PATCH v2 1/2] linux-user: add pseudo /proc/cpuinfo for sparc Laurent Vivier
@ 2019-05-20 3:03 ` Richard Henderson
0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2019-05-20 3:03 UTC (permalink / raw)
To: Laurent Vivier, qemu-devel; +Cc: Riku Voipio
On 5/17/19 6:31 AM, Laurent Vivier wrote:
> SPARC libc6 debian package wants to check the cpu level to be
> installed or not:
>
> WARNING: This machine has a SPARC V8 or earlier class processor.
> Debian lenny and later does not support such old hardware
> any longer.
>
> To avoid this, it only needs to know if the machine type is sun4u or sun4v,
> for that it reads the information from /proc/cpuinfo.
>
> Fixes: 9a93c152fcdb4ab2cd85094487b33578fd693915
> ("linux-user: fix UNAME_MACHINE for sparc/sparc64")
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
> linux-user/syscall.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/2] linux-user: add pseudo /proc/hardware for m68k
2019-05-17 13:31 ` [Qemu-devel] [PATCH v2 2/2] linux-user: add pseudo /proc/hardware for m68k Laurent Vivier
@ 2019-05-20 3:03 ` Richard Henderson
0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2019-05-20 3:03 UTC (permalink / raw)
To: Laurent Vivier, qemu-devel; +Cc: Riku Voipio
On 5/17/19 6:31 AM, Laurent Vivier wrote:
> Debian console-setup uses /proc/hardware to guess the keyboard layout.
> If the file /proc/hardware cannot be opened, the installation fails.
>
> This patch adds a pseudo /proc/hardware file to report the model of
> the machine. Instead of reporting a known and fake model, it
> reports "qemu-m68k", which is true, and avoids to set the configuration
> for an Amiga/Apple/Atari and let the user to chose the good one.
>
> Bug: https://github.com/vivier/qemu-m68k/issues/34
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
> linux-user/syscall.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/2] Add pseudo /proc/hardware and /proc/cpuinfo
2019-05-17 13:31 [Qemu-devel] [PATCH v2 0/2] Add pseudo /proc/hardware and /proc/cpuinfo Laurent Vivier
2019-05-17 13:31 ` [Qemu-devel] [PATCH v2 1/2] linux-user: add pseudo /proc/cpuinfo for sparc Laurent Vivier
2019-05-17 13:31 ` [Qemu-devel] [PATCH v2 2/2] linux-user: add pseudo /proc/hardware for m68k Laurent Vivier
@ 2019-05-20 10:57 ` Philippe Mathieu-Daudé
2 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-05-20 10:57 UTC (permalink / raw)
To: Laurent Vivier, qemu-devel; +Cc: Riku Voipio
On 5/17/19 3:31 PM, Laurent Vivier wrote:
> They are used by some package setup scripts to set the default configuration.
>
> v2: rebase
>
> Laurent Vivier (2):
> linux-user: add pseudo /proc/cpuinfo for sparc
> linux-user: add pseudo /proc/hardware for m68k
>
> linux-user/syscall.c | 27 ++++++++++++++++++++++++++-
> 1 file changed, 26 insertions(+), 1 deletion(-)
>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-05-20 10:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-17 13:31 [Qemu-devel] [PATCH v2 0/2] Add pseudo /proc/hardware and /proc/cpuinfo Laurent Vivier
2019-05-17 13:31 ` [Qemu-devel] [PATCH v2 1/2] linux-user: add pseudo /proc/cpuinfo for sparc Laurent Vivier
2019-05-20 3:03 ` Richard Henderson
2019-05-17 13:31 ` [Qemu-devel] [PATCH v2 2/2] linux-user: add pseudo /proc/hardware for m68k Laurent Vivier
2019-05-20 3:03 ` Richard Henderson
2019-05-20 10:57 ` [Qemu-devel] [PATCH v2 0/2] Add pseudo /proc/hardware and /proc/cpuinfo Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).