From nobody Fri May 3 20:28:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561551253; cv=none; d=zoho.com; s=zohoarc; b=Bmd7qvjy7hqCkHGBiVBKHov6ei1F0vjZ1qIX2XLvYuYigH6OtmWpib3gSxWsxcffrcG46C4rydogZ/YYD9fMltuy5V82Zyzp6HH98/UPebCdA0nyjful06N5jS8G1KkKFL1nf/8fWK3EvmdytcMM/xPAooNwj7KHryqQGVoN0iY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561551253; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=7IAnOpTAvsa4GALAnec2izL6zcpVTAjqU/HqIBACSyA=; b=XXWGbAkNzeEY1qM1A7hXzMr3osh5b/6j51nUROb2o2eXxs7x+V+hcbjfrEKGFgC5e++EYt3V3LvfX6UO6ASE//q7wYwHwA60uQDIc+Y9eOgAjrILnqvL9nQr3zA7Oar5w1LwRkpe4bzlwubPWrdKQbvsVsoa/a+3GW22dCjeVA8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561551253792897.8747021357756; Wed, 26 Jun 2019 05:14:13 -0700 (PDT) Received: from localhost ([::1]:39456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hg6oW-0007Sa-T2 for importer@patchew.org; Wed, 26 Jun 2019 08:14:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49913) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hg6mV-0005bP-GV for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hg6mT-0000pL-Le for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:07 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:58451) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hg6mT-0000l5-36 for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:05 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MAwPf-1hqo1q0ucL-00BJMb; Wed, 26 Jun 2019 14:11:47 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 26 Jun 2019 14:11:34 +0200 Message-Id: <20190626121139.19114-2-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190626121139.19114-1-laurent@vivier.eu> References: <20190626121139.19114-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:ui0tnn6wr8frkgkNKUI2A5bMESmhU0/bggWXerM4U3JzIGWhPzj SDcYe/WEQeD3/6u7R06IPk1+uipyZsz0qKDf5ERxSaW+fNAOffzhwlCyQNJI7ekAx2w10G0 G3DShJuZ1DUcr1H0M1dngBE1+KsTlZWE/hQOF2Z4+qtvKkSkyB5pufTSsAYMZ0KjSFQcf4J FzaH67N/4WI5rNa7o5LRg== X-UI-Out-Filterresults: notjunk:1;V03:K0:v7FjBSlm+fk=:y7w1AUsHyS4jQbtYxiop6t ulz3tGZi8uENGzaGKXaS/M+v1GdW6Rpcc6ae76LHK4SkwBwMXKGFC1pZ8rlKE1LV7WZJQbG0J ePTG5pVH7O/nWvRiBHkP6zYRvGvTx9tdldNIZO8FooxIYHTu8aaJ2xLZiABuPH4LHCrOd6HyO 6YGwaPavOFC+k8ujjpcPlZ2IJze20Lo2W82MBBlqFKHdjlnYqyMY5M0CLKK21MgO44/7Q1CAy YiQj5j3qKv8Prz8s8fvyxeBY12IDzSYx4+zVFQtNXFb2OcDaQh/4ZqDxVKQzcJTiT1jTPq4Ei QITzHOZUZGxdeqKtPo+LS3PbdtvIg755+gi2bhvuKmOtWMzeEJyQ8O1maAtEF4MrMb6J+3rf5 bCCZFcKCz4s1hH5xA0lD81C4G8s0/Jy91vCRY1/2Iu42+yZFa01sKf9kHRKz+g7EuWaBnKTOz fqshisatzc6yhDP1voW3U4INQfTzLO9PcMrVCXpDByiU6MnmG3sFVtQptH/2m8YcvuBIPwafD 4hinh1RB5HzKf9vx6E3V96uHs+kJco0UUAG7+U6x6Ho+Oq+1i/9KBcvbjR0pI8iB7WZnqVjse seELPfsE90NaxpyJ+Sino6Xk+TUQMdFy+locWnfeyBX9GtXNNoTn6UABMy7EK9P1L+tLAHNEq WHHgWF/yMZaZaHcZVJOCXyQC4r+rTDLH3G1y/+Yprq9bIEe8YNzdS0RIjvZfNokY9VO9W+Dz3 0YpzSXk714yTeZTjA4ho+hWNWzWqn5luZVl+Bg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.73 Subject: [Qemu-devel] [PULL 1/6] util/path: Do not cache all filenames at startup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Richard Henderson If one uses -L $PATH to point to a full chroot, the startup time is significant. In addition, the existing probing algorithm fails to handle symlink loops. Instead, probe individual paths on demand. Cache both positive and negative results within $PATH, so that any one filename is probed only once. Use glib filename functions for clarity. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier Tested-by: Laurent Vivier Message-Id: <20190519201953.20161-2-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- util/path.c | 193 ++++++++++++---------------------------------------- 1 file changed, 43 insertions(+), 150 deletions(-) diff --git a/util/path.c b/util/path.c index 7f9fc272fbb3..8e174eb43642 100644 --- a/util/path.c +++ b/util/path.c @@ -8,170 +8,63 @@ #include #include "qemu/cutils.h" #include "qemu/path.h" +#include "qemu/thread.h" =20 -struct pathelem -{ - /* Name of this, eg. lib */ - char *name; - /* Full path name, eg. /usr/gnemul/x86-linux/lib. */ - char *pathname; - struct pathelem *parent; - /* Children */ - unsigned int num_entries; - struct pathelem *entries[0]; -}; - -static struct pathelem *base; - -/* First N chars of S1 match S2, and S2 is N chars long. */ -static int strneq(const char *s1, unsigned int n, const char *s2) -{ - unsigned int i; - - for (i =3D 0; i < n; i++) - if (s1[i] !=3D s2[i]) - return 0; - return s2[i] =3D=3D 0; -} - -static struct pathelem *add_entry(struct pathelem *root, const char *name, - unsigned type); +static const char *base; +static GHashTable *hash; +static QemuMutex lock; =20 -static struct pathelem *new_entry(const char *root, - struct pathelem *parent, - const char *name) -{ - struct pathelem *new =3D g_malloc(sizeof(*new)); - new->name =3D g_strdup(name); - new->pathname =3D g_strdup_printf("%s/%s", root, name); - new->num_entries =3D 0; - return new; -} - -#define streq(a,b) (strcmp((a), (b)) =3D=3D 0) - -/* Not all systems provide this feature */ -#if defined(DT_DIR) && defined(DT_UNKNOWN) && defined(DT_LNK) -# define dirent_type(dirent) ((dirent)->d_type) -# define is_dir_maybe(type) \ - ((type) =3D=3D DT_DIR || (type) =3D=3D DT_UNKNOWN || (type) =3D=3D DT_= LNK) -#else -# define dirent_type(dirent) (1) -# define is_dir_maybe(type) (type) -#endif - -static struct pathelem *add_dir_maybe(struct pathelem *path) +void init_paths(const char *prefix) { - DIR *dir; - - if ((dir =3D opendir(path->pathname)) !=3D NULL) { - struct dirent *dirent; - - while ((dirent =3D readdir(dir)) !=3D NULL) { - if (!streq(dirent->d_name,".") && !streq(dirent->d_name,"..")){ - path =3D add_entry(path, dirent->d_name, dirent_type(diren= t)); - } - } - closedir(dir); + if (prefix[0] =3D=3D '\0' || !strcmp(prefix, "/")) { + return; } - return path; -} - -static struct pathelem *add_entry(struct pathelem *root, const char *name, - unsigned type) -{ - struct pathelem **e; - - root->num_entries++; - - root =3D g_realloc(root, sizeof(*root) - + sizeof(root->entries[0])*root->num_entries); - e =3D &root->entries[root->num_entries-1]; =20 - *e =3D new_entry(root->pathname, root, name); - if (is_dir_maybe(type)) { - *e =3D add_dir_maybe(*e); + if (prefix[0] =3D=3D '/') { + base =3D g_strdup(prefix); + } else { + char *cwd =3D g_get_current_dir(); + base =3D g_build_filename(cwd, prefix, NULL); + g_free(cwd); } =20 - return root; -} - -/* This needs to be done after tree is stabilized (ie. no more reallocs!).= */ -static void set_parents(struct pathelem *child, struct pathelem *parent) -{ - unsigned int i; - - child->parent =3D parent; - for (i =3D 0; i < child->num_entries; i++) - set_parents(child->entries[i], child); + hash =3D g_hash_table_new(g_str_hash, g_str_equal); + qemu_mutex_init(&lock); } =20 -/* FIXME: Doesn't handle DIR/.. where DIR is not in emulated dir. */ -static const char * -follow_path(const struct pathelem *cursor, const char *name) -{ - unsigned int i, namelen; - - name +=3D strspn(name, "/"); - namelen =3D strcspn(name, "/"); - - if (namelen =3D=3D 0) - return cursor->pathname; - - if (strneq(name, namelen, "..")) - return follow_path(cursor->parent, name + namelen); - - if (strneq(name, namelen, ".")) - return follow_path(cursor, name + namelen); - - for (i =3D 0; i < cursor->num_entries; i++) - if (strneq(name, namelen, cursor->entries[i]->name)) - return follow_path(cursor->entries[i], name + namelen); - - /* Not found */ - return NULL; -} - -void init_paths(const char *prefix) +/* Look for path in emulation dir, otherwise return name. */ +const char *path(const char *name) { - char pref_buf[PATH_MAX]; - - if (prefix[0] =3D=3D '\0' || - !strcmp(prefix, "/")) - return; + gpointer key, value; + const char *ret; =20 - if (prefix[0] !=3D '/') { - char *cwd =3D getcwd(NULL, 0); - size_t pref_buf_len =3D sizeof(pref_buf); + /* Only do absolute paths: quick and dirty, but should mostly be OK. = */ + if (!base || !name || name[0] !=3D '/') { + return name; + } =20 - if (!cwd) - abort(); - pstrcpy(pref_buf, sizeof(pref_buf), cwd); - pstrcat(pref_buf, pref_buf_len, "/"); - pstrcat(pref_buf, pref_buf_len, prefix); - free(cwd); - } else - pstrcpy(pref_buf, sizeof(pref_buf), prefix + 1); + qemu_mutex_lock(&lock); =20 - base =3D new_entry("", NULL, pref_buf); - base =3D add_dir_maybe(base); - if (base->num_entries =3D=3D 0) { - g_free(base->pathname); - g_free(base->name); - g_free(base); - base =3D NULL; + /* Have we looked up this file before? */ + if (g_hash_table_lookup_extended(hash, name, &key, &value)) { + ret =3D value ? value : name; } else { - set_parents(base, base); + char *save =3D g_strdup(name); + char *full =3D g_build_filename(base, name, NULL); + + /* Look for the path; record the result, pass or fail. */ + if (access(full, F_OK) =3D=3D 0) { + /* Exists. */ + g_hash_table_insert(hash, save, full); + ret =3D full; + } else { + /* Does not exist. */ + g_free(full); + g_hash_table_insert(hash, save, NULL); + ret =3D name; + } } -} - -/* Look for path in emulation dir, otherwise return name. */ -const char *path(const char *name) -{ - /* Only do absolute paths: quick and dirty, but should mostly be OK. - Could do relative by tracking cwd. */ - if (!base || !name || name[0] !=3D '/') - return name; =20 - return follow_path(base, name) ?: name; + qemu_mutex_unlock(&lock); + return ret; } --=20 2.21.0 From nobody Fri May 3 20:28:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561551696; cv=none; d=zoho.com; s=zohoarc; b=jkIG4H86tKwxHGPXhHaCIAufWljveoxJUffOLcoUGTE8rZRLfJm9yNH4z6eTnpJ2oU7JJqDT1jnYBCMyeQSMiN5duAg92wHRVRcP5V/P83WFop0gnDwMMQF6avSig0w33H4xGpc6JBG9nBbcaxHk/qecgLmJ0Wz+r4CcS4zHwPk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561551696; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ZCw3pYrci0jUSVsgwpyje/r1dWi3geWG9TuieSfyV3A=; b=WIYFGDx7K5xEc/18bTngxeBByPGTN7A9ZsyzJHCxc6zhA02GOQzq//2n/qgvmBffUbfwfh2W1IA4LxceM50zM+mAZV2NqY3Uaj8JE99uDB1QQqYAFsVlN8+ewKAC7Sx6TRSatB74Cz+kv0kS5vBCBiAdP/HwBZ/bU6Mx3ZxIbEQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561551696419793.8863472007172; Wed, 26 Jun 2019 05:21:36 -0700 (PDT) Received: from localhost ([::1]:39613 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hg6vd-0005D5-Bb for importer@patchew.org; Wed, 26 Jun 2019 08:21:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50005) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hg6mo-00061D-VZ for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hg6mn-0001Vs-2e for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:26 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:47701) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hg6ml-0001R0-Ef for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:24 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M3UhQ-1hfYoL3bZC-000YeE; Wed, 26 Jun 2019 14:11:48 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 26 Jun 2019 14:11:35 +0200 Message-Id: <20190626121139.19114-3-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190626121139.19114-1-laurent@vivier.eu> References: <20190626121139.19114-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:FOwiOG93lZxN3jZq8PqE1FTpHQMpEYZGlvzo+TTxjuB6C3iXL3S Ole3VcfL9p6XjEndwziC8GoQsbZPaI95U3Mvv4MVrKH8oFoj04mEfcq1xYjtFWTqpAsuRrH 2ZItz5FMh0Z+ZLkJlqOmyNva/FuMvaCUE9uAXBZC2WXqk+qDAI/m0TIz4pHnk+pbptl+t4Z KTIz++fIZhLXm3GeFgtow== X-UI-Out-Filterresults: notjunk:1;V03:K0:YhjZtYQ93Zg=:gRqpnlKAfjKsGei51/+KjF YWfjf+gndprJb7N2S8smsYOII4VHa7o6mNSTOGn3WsRGxuvzm3t+INmUsLy0K0bTAPb+3AN37 A/+oqPrk5MmbQjdGGORGbJKdgnIQykAw1r0Oq8BCxsqYwM1BL4HvAxeW1oDd5PNVz2W1uHG6M jCfcyTiVPTbjERe67mx6ds02JS+O7xCO38DdJf1X/+rtEaSFHtUEf+cSVIgCYehBHqo/Ud02g wsuO42WlVPjPdZX015WlQfN0Dxg4VFtQxjSYZvwZXM3iMkD3BYe7t6gXFPPhI5sllV6kJTA5j N46+ZIFXVUemIR4fJPc0c1hGP7/lnc+gFOY4CEfmjIpyeYxCgjuWUluiU4O/nzo5wZnFCmpdw B2h2CXsgx1g2nv+VA/++3lFkgXGiq2EjQ+sRITedKoqzsD36TZCKw6/KxgFXCv8mJMSEmL9V4 42kVNCoT4ebCm8urz+prsVQXTUWCszmSCZGRXjNfiTCYzH9027UtY24ajk9r3Fx369/I/BiEn azP/eF+cukT8PnYGaXr5/tClvJwu4eTfkR1pg9vdGOKuDM8IhhSxVaq+ZN7rVu5UYr9Mm0MeV qltnBJs6b+BwKkjzgZSo44vYyeebT6MKusYDJu35s1TRayHH664K39eqLNN7hlxh0ofgMxTXE joMTYXVfepicAAdNio9B4Em5LKmdc2BkiaYNlBsZE39mLH2h1flM0+xOp1DkDpzFcppA/4O4D pqDVmHlhWWPoFM/bOJdasTcAuBrZs6XN+XKZyA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.24 Subject: [Qemu-devel] [PULL 2/6] linux-user: emulate msgsnd(), msgrcv() and semtimedop() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier , Cornelia Huck Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" When we have updated kernel headers to 5.2-rc1 we have introduced new syscall numbers that can be not supported by older kernels and fail with ENOSYS while the guest emulation succeeded before because the syscalls were emulated with ipc(). This patch fixes the problem by using ipc() if the new syscall returns ENOSYS. Fixes: 86e636951ddc ("linux-user: fix __NR_semtimedop undeclared error") Signed-off-by: Laurent Vivier Reviewed-by: Cornelia Huck Message-Id: <20190529084804.25950-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 61 +++++++++++++++++++-------------------- linux-user/syscall_defs.h | 1 + 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index b187c1281dce..e942049cb0da 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -762,50 +762,21 @@ safe_syscall2(int, nanosleep, const struct timespec *= , req, safe_syscall4(int, clock_nanosleep, const clockid_t, clock, int, flags, const struct timespec *, req, struct timespec *, rem) #endif -#if !defined(__NR_msgsnd) || !defined(__NR_msgrcv) || !defined(__NR_semtim= edop) -/* This host kernel architecture uses a single ipc syscall; fake up - * wrappers for the sub-operations to hide this implementation detail. - * Annoyingly we can't include linux/ipc.h to get the constant definitions - * for the call parameter because some structs in there conflict with the - * sys/ipc.h ones. So we just define them here, and rely on them being - * the same for all host architectures. - */ -#define Q_SEMTIMEDOP 4 -#define Q_MSGSND 11 -#define Q_MSGRCV 12 -#define Q_IPCCALL(VERSION, OP) ((VERSION) << 16 | (OP)) - +#ifdef __NR_ipc safe_syscall6(int, ipc, int, call, long, first, long, second, long, third, void *, ptr, long, fifth) #endif #ifdef __NR_msgsnd safe_syscall4(int, msgsnd, int, msgid, const void *, msgp, size_t, sz, int, flags) -#else -static int safe_msgsnd(int msgid, const void *msgp, size_t sz, int flags) -{ - return safe_ipc(Q_IPCCALL(0, Q_MSGSND), msgid, sz, flags, (void *)msgp= , 0); -} #endif #ifdef __NR_msgrcv safe_syscall5(int, msgrcv, int, msgid, void *, msgp, size_t, sz, long, msgtype, int, flags) -#else -static int safe_msgrcv(int msgid, void *msgp, size_t sz, long type, int fl= ags) -{ - return safe_ipc(Q_IPCCALL(1, Q_MSGRCV), msgid, sz, flags, msgp, type); -} #endif #ifdef __NR_semtimedop safe_syscall4(int, semtimedop, int, semid, struct sembuf *, tsops, unsigned, nsops, const struct timespec *, timeout) -#else -static int safe_semtimedop(int semid, struct sembuf *tsops, unsigned nsops, - const struct timespec *timeout) -{ - return safe_ipc(Q_IPCCALL(0, Q_SEMTIMEDOP), semid, nsops, 0, tsops, - (long)timeout); -} #endif #if defined(TARGET_NR_mq_open) && defined(__NR_mq_open) safe_syscall5(int, mq_timedsend, int, mqdes, const char *, msg_ptr, @@ -3529,11 +3500,21 @@ static inline abi_long target_to_host_sembuf(struct= sembuf *host_sembuf, static inline abi_long do_semop(int semid, abi_long ptr, unsigned nsops) { struct sembuf sops[nsops]; + abi_long ret; =20 if (target_to_host_sembuf(sops, ptr, nsops)) return -TARGET_EFAULT; =20 - return get_errno(safe_semtimedop(semid, sops, nsops, NULL)); + ret =3D -TARGET_ENOSYS; +#ifdef __NR_semtimedop + ret =3D get_errno(safe_semtimedop(semid, sops, nsops, NULL)); +#endif +#ifdef __NR_ipc + if (ret =3D=3D -TARGET_ENOSYS) { + ret =3D get_errno(safe_ipc(IPCOP_semtimedop, semid, nsops, 0, sops= , 0)); + } +#endif + return ret; } =20 struct target_msqid_ds @@ -3688,7 +3669,16 @@ static inline abi_long do_msgsnd(int msqid, abi_long= msgp, } host_mb->mtype =3D (abi_long) tswapal(target_mb->mtype); memcpy(host_mb->mtext, target_mb->mtext, msgsz); + ret =3D -TARGET_ENOSYS; +#ifdef __NR_msgsnd ret =3D get_errno(safe_msgsnd(msqid, host_mb, msgsz, msgflg)); +#endif +#ifdef __NR_ipc + if (ret =3D=3D -TARGET_ENOSYS) { + ret =3D get_errno(safe_ipc(IPCOP_msgsnd, msqid, msgsz, msgflg, + host_mb, 0)); + } +#endif g_free(host_mb); unlock_user_struct(target_mb, msgp, 0); =20 @@ -3716,7 +3706,16 @@ static inline abi_long do_msgrcv(int msqid, abi_long= msgp, ret =3D -TARGET_ENOMEM; goto end; } + ret =3D -TARGET_ENOSYS; +#ifdef __NR_msgrcv ret =3D get_errno(safe_msgrcv(msqid, host_mb, msgsz, msgtyp, msgflg)); +#endif +#ifdef __NR_ipc + if (ret =3D=3D -TARGET_ENOSYS) { + ret =3D get_errno(safe_ipc(IPCOP_CALL(1, IPCOP_msgrcv), msqid, msg= sz, + msgflg, host_mb, msgtyp)); + } +#endif =20 if (ret > 0) { abi_ulong target_mtext_addr =3D msgp + sizeof(abi_ulong); diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 7f141f699c1a..3175440e9dd9 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -32,6 +32,7 @@ #define TARGET_SYS_RECVMMSG 19 /* recvmmsg() */ #define TARGET_SYS_SENDMMSG 20 /* sendmmsg() */ =20 +#define IPCOP_CALL(VERSION, OP) ((VERSION) << 16 | (OP)) #define IPCOP_semop 1 #define IPCOP_semget 2 #define IPCOP_semctl 3 --=20 2.21.0 From nobody Fri May 3 20:28:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561551563; cv=none; d=zoho.com; s=zohoarc; b=Uuok4LrFZAXQIYCebBwcvh/IAhHNBpcw4ZH40O9UyRrvGummMd/uQFKBpLSWBJBa64Iu34B3Yh0cMGv2eEntC+7LpR72Ff3KfWnVYg3u15DL4fkO62RoGROl4J7JDq74iUGX/r5TN7js68HnNC+qU1vc+hlYlDCuy3g73zWeyWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561551563; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Stk5lAhQydyrPV3x+uAPEaTFZpEzGlgi2MnqRk2CN28=; b=hZQ+DIoZY1XIHt+m32/UZF1UpCkr8mrPQLAtZDiYoGYDl9MR00crb1o3wPU5kkY4Ri+qxxEZw78mIjoBsv1BtOgBXHjLbXq1vzQNJ3ONYZ08uh2TcvlsnHhiKkdImLZAdXoqvDUpERCeEmH6rEaFb2Yb4AGFX0+IEVFiaDUXHag= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156155156327539.05295322201778; Wed, 26 Jun 2019 05:19:23 -0700 (PDT) Received: from localhost ([::1]:39592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hg6tW-0002tg-5F for importer@patchew.org; Wed, 26 Jun 2019 08:19:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49932) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hg6mX-0005cy-FM for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hg6mV-0000uS-H3 for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:09 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:60285) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hg6mU-0000nN-8M for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:07 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MRCFu-1huMPQ1xUi-00NCN6; Wed, 26 Jun 2019 14:11:48 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 26 Jun 2019 14:11:36 +0200 Message-Id: <20190626121139.19114-4-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190626121139.19114-1-laurent@vivier.eu> References: <20190626121139.19114-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:8LioHe/lMony4uDwZrVGQsbC9Th7eTsFeIHzFVAi45zJBUTzqFn pmWkYTXEeaUiG7xgg+4Qu5yTkXBJh3S/MofESJvCl2VhtsI5ciHHZ/XlkUHR2P+cbWZUALK XEXAEphkossUkRRKCBTPeb6+U2YcdBdg4voFEDuHBjbewitNULW8KBOHFZ2Xhw2dtbswaiA D9AW8FlNAj1ObofY0+Kug== X-UI-Out-Filterresults: notjunk:1;V03:K0:b35BU5mdNIY=:/nxkDKTFZgl5CieTikNQrG atnCnsGWjDJ0euJeWIMR+dfQZUgjlj+xtruAnuox39/kBXSDE/AVnSG3g0U8gXx9jz8C6Y6PA ujq2IR9S904d4yvaiT0iNq6foKRpVNWeLSAcM5U1BFBHAK0qi15gzcbQbvf7wtAsN40yGN1c9 B9FpD75rj/D2BNn9qbgEF1IbUQL/1yMF0PtILZoqdjBf7ukeolRrVoEEQygHh0UAW0bkDtb/9 BHdusuci2Foo3XSwo3uQaxnsKWlyjjXQL5qTSXuG5LHK++x6PzzzlQ28uVrn43lCGD/bVG1XQ nw1z16IH3FIArKD9asTd0LwnmKD9faLMt3Ule2Cs9dIrYMpM7IAiTcG2VLpUMv7O2KpfHxUG0 504t4MNSqyee7ws0vY0olJ7uLcCYSWnhjitZVLM51/NafrKzA4w/8sDIRc/SblxLqM9yzTJmD a7SnMp+RVC7OSllveVxr9DW3S+teJ72WeF8rcsvnk3Me4oTxpli1cx0QFv/3uXGYmiQEp1Qc1 pSaRokXlxYxXP7sr2YEREMx41/nDVc2P+Za1GWhMhLk8fpobZzh5+1GHaNYlxZML+/OJ8pIf5 phmHACncH09wZtwQ5gk6z/RnTQ2GcjKGqfLUqbSAjG3Hitws5wxZHmsM1TcFQEKh5bnV1k8jd xE5iYz2YGnzvA42mXDYJkJIDTwIp/z+Oxe3DWFcz9CENTw5FApxkbn8bCX5xkZpeoUyR9UX2K XTJQ46P4/puKetu8dkErl/34X9OgdzM8PFi4aU+kvgDwb6iX5hsYUog6drQ= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.75 Subject: [Qemu-devel] [PULL 3/6] linux-user: Add support for setsockopt() option SOL_ALG X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Yunqiang Su , Laurent Vivier , Aleksandar Markovic Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Yunqiang Su Add support for options SOL_ALG of the syscall setsockopt(). This option is used in relation to Linux kernel Crypto API, and allows a user to set additional information for the cipher operation via syscall setsockopt(). The field "optname" must be one of the following: - ALG_SET_KEY =E2=80=93 seting the key - ALG_SET_AEAD_AUTHSIZE =E2=80=93 set the authentication tag size SOL_ALG is relatively newer setsockopt() option. Therefore, the code that handles SOL_ALG is enclosed in "ifdef" so that the build does not fail for older kernels that do not contain support for SOL_ALG. "ifdef" also contains check if ALG_SET_KEY and ALG_SET_AEAD_AUTHSIZE are defined. Signed-off-by: Yunqiang Su Signed-off-by: Aleksandar Markovic Reviewed-by: Laurent Vivier Message-Id: <1560953834-29584-3-git-send-email-aleksandar.markovic@rt-rk.co= m> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index e942049cb0da..ed1c9b0033be 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -102,6 +102,7 @@ #include #include #include +#include #include "linux_loop.h" #include "uname.h" =20 @@ -1941,6 +1942,36 @@ static abi_long do_setsockopt(int sockfd, int level,= int optname, goto unimplemented; } break; +#if defined(SOL_ALG) && defined(ALG_SET_KEY) && defined(ALG_SET_AEAD_AUTHS= IZE) + case SOL_ALG: + switch (optname) { + case ALG_SET_KEY: + { + char *alg_key =3D g_malloc(optlen); + + if (!alg_key) { + return -TARGET_ENOMEM; + } + if (copy_from_user(alg_key, optval_addr, optlen)) { + g_free(alg_key); + return -TARGET_EFAULT; + } + ret =3D get_errno(setsockopt(sockfd, level, optname, + alg_key, optlen)); + g_free(alg_key); + break; + } + case ALG_SET_AEAD_AUTHSIZE: + { + ret =3D get_errno(setsockopt(sockfd, level, optname, + NULL, optlen)); + break; + } + default: + goto unimplemented; + } + break; +#endif case TARGET_SOL_SOCKET: switch (optname) { case TARGET_SO_RCVTIMEO: --=20 2.21.0 From nobody Fri May 3 20:28:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561551711; cv=none; d=zoho.com; s=zohoarc; b=ESXEmaZnk0efOS9wPHQJ4K/ZsUB2guRv6uktSmMAB/Usn/nAvY+YWJTBffxoT6LDvPv2PGZPI18GqDyt4PUYpQDC27dHl8/d/R/Tk7Jt9zpbLy1pVF4eFv8FZ67af6b8CsGDC5iDwujmwAcYqR/r9FfD89apEEfuCoUzQ1dioL4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561551711; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=LSN0KDiaIYb2W+rIu3CM8TT0pwUpj1DCyJRo8P9FYfc=; b=KgzS3XPAm5cqCqnxCDnFqpk5SeEnZwQXyDVBXNbzSlmRqJuo4PSwt/LUssnKx6kl0HaJU3iqN+581aIT71SySacLlbFKwCrB96jyE6f30SyPVlYQyO2BHQXSHgd0RpP355jKu3Gp0pqysRAAo5l5NnY3k86fxAbPv5/SilkrrXs= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561551711815454.40480845176614; Wed, 26 Jun 2019 05:21:51 -0700 (PDT) Received: from localhost ([::1]:39616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hg6vs-0005NU-MB for importer@patchew.org; Wed, 26 Jun 2019 08:21:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49947) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hg6mZ-0005fK-Fb for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hg6mX-0000yq-Dc for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:11 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:50379) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hg6mV-0000q9-Dx for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:07 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MnJdC-1iPJUv02VQ-00jHfM; Wed, 26 Jun 2019 14:11:49 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 26 Jun 2019 14:11:37 +0200 Message-Id: <20190626121139.19114-5-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190626121139.19114-1-laurent@vivier.eu> References: <20190626121139.19114-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:7TAxZSKcncYtCqBr1MuuDh5e7eyk5WkHUwdqneS78+dWpefslQ9 q5m8nq1dmd3hIj2Ho5c1h66NKOGqCeMqBOOvRid/pq9kWSN5CwfQ8GsAxBc3/pvD7KTjSWg rucahPSSUiOeeMJdTVuzvR2GhDrha+i5bVmKA4Z0xY6VwetH5OEGqqntOWTWkCCKunN/Oel OK7SQQcLn7xpxV4gdasjA== X-UI-Out-Filterresults: notjunk:1;V03:K0:GlpujgIpShw=:DNtxMrgebXyaauCP4V996w QK+Ngex/96afYAx5wqp+CbqqwhD7u6BTAmvmegeTM/V5qAOMT7/J6RlyxpMBWw5fqBeJ2lAdN 9dUVSwbl65ktUmSfYHBH0eue8Cf+cSEdsY6W4cyfpbjJaHHFN3AYTIkj+bnChSbmEOwzOFPcM 25nw0B7Xgdp/MOlHYx+AyYFNiKtW8aeb9qBsEM8cp74teFtm5IlU+jvqN7LBgdWOHYFs2nzZ0 4vKnbFgqmcNkxg0GI6Gy83cXmEyd/LL1DdbZsh0gUymC6HusD8ccIAbMJm+n9JCUi+hLA2NgG cPBiR9Z1BmN/Eslp/FjyIYQh2VZ5IFmoZYLAyxpngXX0yKHHgA8IrRoAAH8Twn1VjExmfJ+H+ YRg1opPITMraqY/7eolkRLGRVyu6vMJy/PzbyGfodfusWE3Y293NKV7G4Xssv6w8CBIt/D65u iiovLt1B0807okIhdZ4YbR5u2MHjnbAqlioba2fqa9gm5pW+OtgxHg99uA6yn92yTt0PpiYwU Hb68vTj9/ogBMadY7/HU/+K/jjEGQIQXSU1wPCVxd0Q5QvY062+0YmoYjSQZBjdzys0U6tga8 X5Y/n/pFDCn3PlmBO1pEfJUyZbCnaHyCZMGDXyPp+uxJtm7uGBB7aebpXDbER+qO9vm8qS3U8 aBz3rcpRzMByzhgeJ4mwIPmHWMw4UKGxRSso+Sy7BVngf9NCcdmTfGlkUF7EHyIdMj5jHcmQp UMDEVSFIZ6VjqkEGRpM/zoeAXw4A70VYJyf2wQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.73 Subject: [Qemu-devel] [PULL 4/6] linux-user: Add support for setsockopt() options IPV6__MEMBERSHIP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Markovic , Riku Voipio , Laurent Vivier , Neng Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Neng Chen Add support for the option IPV6__MEMBERSHIP of the syscall setsockopt(). This option controls membership in multicast groups. Argument is a pointer to a struct ipv6_mreq. The glibc header defines the ipv6_mreq structure, which includes the following members: struct in6_addr ipv6mr_multiaddr; unsigned int ipv6mr_interface; Whereas the kernel in its header defines following members of the same structure: struct in6_addr ipv6mr_multiaddr; int ipv6mr_ifindex; POSIX defines ipv6mr_interface [1]. __UAPI_DEF_IVP6_MREQ appears in kernel headers with v3.12: cfd280c91253 net: sync some IP headers with glibc Without __UAPI_DEF_IVP6_MREQ, kernel defines ipv6mr_ifindex, and this is explained in cfd280c91253: "If you include the kernel headers first you get those, and if you include the glibc headers first you get those, and the following patch arranges a coordination and synchronization between the two." So before 3.12, a program can't include both and . In linux-user/syscall.c, we only include (glibc) and not (kernel headers), so ipv6mr_interface is the one to use. [1] http://pubs.opengroup.org/onlinepubs/009695399/basedefs/netinet/in.h.ht= ml Signed-off-by: Neng Chen Signed-off-by: Aleksandar Markovic Reviewed-by: Laurent Vivier Message-Id: <1560953834-29584-2-git-send-email-aleksandar.markovic@rt-rk.co= m> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index ed1c9b0033be..d2c9817938c9 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1892,6 +1892,25 @@ static abi_long do_setsockopt(int sockfd, int level,= int optname, &pki, sizeof(pki))); break; } + case IPV6_ADD_MEMBERSHIP: + case IPV6_DROP_MEMBERSHIP: + { + struct ipv6_mreq ipv6mreq; + + if (optlen < sizeof(ipv6mreq)) { + return -TARGET_EINVAL; + } + + if (copy_from_user(&ipv6mreq, optval_addr, sizeof(ipv6mreq))) { + return -TARGET_EFAULT; + } + + ipv6mreq.ipv6mr_interface =3D tswap32(ipv6mreq.ipv6mr_interfac= e); + + ret =3D get_errno(setsockopt(sockfd, level, optname, + &ipv6mreq, sizeof(ipv6mreq))); + break; + } default: goto unimplemented; } --=20 2.21.0 From nobody Fri May 3 20:28:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561551252; cv=none; d=zoho.com; s=zohoarc; b=Ho1I1DpgsRF9aRDWd0nsaFbAz/V32b9JgV3PcAh+CjQE7KoTJWp3/MXYpOCap8DNGjbbGmGTFE9dEXRynA+VBzQ3D4G5Y9jllFj16jBWK/x1PPOMY2r8nQTvioE2gw3PcxI2ExoN+8HjqkGCKv3kLAgTTJujfVi3Rbz6Z0N3qJg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561551252; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=KBNzCR7yVweuXUwAEIZjnKhBhj7LaDw+saEWjPm9T8g=; b=Wr4Es8rS1qYRwNvPKe0WeTpYgsQDI+mgJ6PQEN1miED22AkxOhhkYtTDG+7FDzobUyHUP+w9DDl4kqbHkD/8tIfj36XFMvYPBEAGtIvllJlgi5mw5nXsZ9W0jPSn1BVODVqf/CaeFgVC2UIbhLrOyzPN83z5XBMvutebqyv/ITg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561551252467728.0465564994888; Wed, 26 Jun 2019 05:14:12 -0700 (PDT) Received: from localhost ([::1]:39452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hg6oS-0007Mn-Hd for importer@patchew.org; Wed, 26 Jun 2019 08:14:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49865) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hg6mP-0005ZI-Ql for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hg6mN-0000XF-Ay for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:01 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:59925) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hg6mM-0000PJ-5f for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:11:59 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MqJuP-1iJ0FC1rKF-00nQ8d; Wed, 26 Jun 2019 14:11:49 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 26 Jun 2019 14:11:38 +0200 Message-Id: <20190626121139.19114-6-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190626121139.19114-1-laurent@vivier.eu> References: <20190626121139.19114-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:DY24OluJBP6dpVY2Eewm/U9gPbN5GvyYdhzTNOe/HppzORaXKxh zA/G9+SPII72PWHbujM0lU5/BXAh7Inda8WtlI7yU7PciKlWX9tSv1EUbgldiWFDOc5G1fO +/KaO2XbUyqZc4j9MOLyhArbh3rqBIZjI9gl5JjLnGmWg59wIY0lW5a/PpJP0VmHAdiQRYP WwKpYgNQirWtiQC8y3Z9w== X-UI-Out-Filterresults: notjunk:1;V03:K0:Nv+gFETMw6I=:yY7qBbTXmbS8zRVMd6084k L25dtkQr+dExPko6TBTPstDcYjA9CrMYRegga1D9fR1ovpwzHUJIFJrym3552lu8Sf068KAvV AXWXaIMON0BXJKhdhlu3QfKfGR6AwbTGBDtuUuRmqs11gbhd5sM6P3DTh/ZB/5RdurrS2HKRU w3DB3Hsvg0zbgIK4GWEflo2X3675tHZS3zndz8j4rVsYMbkHYUXHaMxhxQhTKfBoZ7tDMpGNq uRP84RqekLuN6xavV+O0pT51YoIP/gxlIFEuCXUTZ7+04iC7u3i1u5FGFIUZ7xoXvmGBMKza1 wvGso+ifJO2JZY0i6knL5CSuoENHr/0P29KNZQvdR2XQK3o4AF2QOBhvhhZ7I0wjLETDKDYkN 6jczXBTpJ+KDVhy5mecMb4B+o5WQrTGqd75gJvX8/uhOUhmM4PI/wn3cjstyy3pi++qc4G/PU B8MrxxJLjCNiGS0OXtmNoet1ZIlV6uZ6WBcjnjHnKtM2KRgWg+4/Hpd1k+50eNXgQP9Kwn621 VkAh7m9LAUMPCzlkIbCusBhrG76sdCxXP0L7N0qW1F4Gv/G3FegTZRL8Pke4bgbmJCO5JTgLb 3DJ3jJTBivfLPpOyKz0nyHePEKUAa/BkbW/DbKH3Ps9R8YmtUs815GYUg7Ra7nqfwaDyG+bmL IgDfJ9yP4hcSAl8sv4QG0mAlv2BGAr2MV6TbDVUskHZ8hE/aWTz8cqcC5f2rzdli1g26IFuM/ xk4e8etRoGxipc8PwRPFbpHI02v3jHk47vdBgw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.75 Subject: [Qemu-devel] [PULL 5/6] linux-user: update PPC64 HWCAP2 feature list X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" QEMU_PPC_FEATURE2_VEC_CRYPTO enables the use of VSX instructions in libcrypto that are accelerated by the TCG vector instructions now. QEMU_PPC_FEATURE2_DARN allows to use the new builtin qemu_guest_getrandom() function. Signed-off-by: Laurent Vivier Message-Id: <20190609143521.19374-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier --- linux-user/elfload.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 9fd65708c4c4..bd43c4817df8 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -768,7 +768,13 @@ enum { QEMU_PPC_FEATURE2_HAS_EBB =3D 0x10000000, /* Event Base Branching */ QEMU_PPC_FEATURE2_HAS_ISEL =3D 0x08000000, /* Integer Select */ QEMU_PPC_FEATURE2_HAS_TAR =3D 0x04000000, /* Target Address Register */ + QEMU_PPC_FEATURE2_VEC_CRYPTO =3D 0x02000000, + QEMU_PPC_FEATURE2_HTM_NOSC =3D 0x01000000, QEMU_PPC_FEATURE2_ARCH_3_00 =3D 0x00800000, /* ISA 3.00 */ + QEMU_PPC_FEATURE2_HAS_IEEE128 =3D 0x00400000, /* VSX IEEE Bin Float 12= 8-bit */ + QEMU_PPC_FEATURE2_DARN =3D 0x00200000, /* darn random number insn */ + QEMU_PPC_FEATURE2_SCV =3D 0x00100000, /* scv syscall */ + QEMU_PPC_FEATURE2_HTM_NO_SUSPEND =3D 0x00080000, /* TM w/o suspended s= tate */ }; =20 #define ELF_HWCAP get_elf_hwcap() @@ -822,8 +828,10 @@ static uint32_t get_elf_hwcap2(void) GET_FEATURE(PPC_ISEL, QEMU_PPC_FEATURE2_HAS_ISEL); GET_FEATURE2(PPC2_BCTAR_ISA207, QEMU_PPC_FEATURE2_HAS_TAR); GET_FEATURE2((PPC2_BCTAR_ISA207 | PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 | - PPC2_ISA207S), QEMU_PPC_FEATURE2_ARCH_2_07); - GET_FEATURE2(PPC2_ISA300, QEMU_PPC_FEATURE2_ARCH_3_00); + PPC2_ISA207S), QEMU_PPC_FEATURE2_ARCH_2_07 | + QEMU_PPC_FEATURE2_VEC_CRYPTO); + GET_FEATURE2(PPC2_ISA300, QEMU_PPC_FEATURE2_ARCH_3_00 | + QEMU_PPC_FEATURE2_DARN); =20 #undef GET_FEATURE #undef GET_FEATURE2 --=20 2.21.0 From nobody Fri May 3 20:28:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561551253; cv=none; d=zoho.com; s=zohoarc; b=LmkuVTuWf3g9PnfQ95iNM2EzaT+dxL3wL+UQIX1dLCZu74yhsj09pDCm8G3gz0VIZ/ZFM7mTTAm2vBn1edr6G/pZMDrQ1kmHpESizIPxNkqo002YqaHErMQA4rmJqCtTe3soetozKdbe7jJN6ddy02QUOlWo7ikMUzPV4XSG7Ws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561551253; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=i2Ds+pB17lPkfFWZsFofeEylRuF92SK9OtyELXONxgY=; b=K071czdSSHSJN+lo9zZK7N8rGPr/KWUTzDZHnSlsQyVOUuGHVctCLMneKhI7410lLBCKZ27W+L3gD9lMFpiXCVqt1mzo98DmXUPSE9PixQB2vj/Jxb0AvSy74aVfNoN3Vkjs009kBHA81oGxJSaUmJpdO76zkDS60t9I6MazVsM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561551253429684.1963194076501; Wed, 26 Jun 2019 05:14:13 -0700 (PDT) Received: from localhost ([::1]:39454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hg6oU-0007PJ-6i for importer@patchew.org; Wed, 26 Jun 2019 08:14:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49901) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hg6mU-0005au-9z for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hg6mT-0000nh-2z for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:06 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:46299) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hg6mR-0000eK-Fd for qemu-devel@nongnu.org; Wed, 26 Jun 2019 08:12:03 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MCsLu-1hosDd3hVA-008qO4; Wed, 26 Jun 2019 14:11:50 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 26 Jun 2019 14:11:39 +0200 Message-Id: <20190626121139.19114-7-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190626121139.19114-1-laurent@vivier.eu> References: <20190626121139.19114-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Lxe9LVwcW5n3k+00I+6eF7McLrcLyYRterrhAxEULvbIEohd+kr sc+bU5Fapiz/o9Ypi4aCgv5ndVd0+MDisv+pZUjB5gz2VYn5PHJ7WslEy4HDVMHS+NS1iV5 tcfSLzipB1WzA5MG6990F1QgZ/Q+eg9ockFWJ7wFCypBKdN4VZYs9CEAucTTykm8fDm1dPj QAc4mg9V68s3fNJpW269Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:Pfqx+sg7EPI=:IXteKgPB94kC/rLvpeSli0 HhE6SAbC83feD9rsLDacg1RPS//F7xPf7XMeyGqwk5zLWEA/GLDHKog5fKP0u/I+FiSFhKHFx vPBVMDxRqftOLatVOu9L9R9dvBSwNmT8ncAiJ0TJdU7lL1+VhHyvuiRC4+8lHyr2cDTaJXsSr vA8fYL4Wn63hbpNVueLHhxxAo/yv5XZ8VWDxW1/WO7FUESyAGuzVNd0EYnNkci2Bnztusgg4e NcAKMtMdR+UrycRb3LLZVxTyKjMw+9fLbm01MtHUkvqyQhxKTRu/PHChpCtdMT5s7xYSjZ2RM Xn/A9utdB3XS2WsnrPZr7mOZlzUvUAmSyae7oi7+ELq//7oYjcI6RPnaLfsQdGTpbBxKIxfhV ++lkIW/pUVWW49EbPFssjjN/R+5AjAk6QWzhEI8zE7Qg2Qqwy4kgnwkWJcv3gpxYHYVp8teb2 zIYEzfJXg4Fg3HvblaYuSMaKtnZky8Vl059n4lMLUXgcfphdffRM/HTRTTBzdBHJF62Mpe1PD hN8tH4bIweaLh4BA42IlOyQjq8bVNBJtSsm9XGIRFYWIVyHjC3Zh90TEoLOo8CJlQJo5dkG75 fa5aiAeZgCEKDNG2YJZhCH2qVBAiqkZJ+L1t8EqAStPwZg9lEYlutAz0RhRJCx7QSk4nYaBZe ATBqoD6z1T4WZphRmZ6ZbzV2l5TdjnXdJfLuuSfyBO1oKGIGWlc+PESiJVPyTX1strRPkjHzV MDHawE0LLOL7jpOwEUld0d2gpdgWiXl3Alqslg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.24 Subject: [Qemu-devel] [PULL 6/6] linux-user: set default PPC64 CPU X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The default CPU for pseries has been set to POWER9 by default. We can use the same default for linux-user Signed-off-by: Laurent Vivier Message-Id: <20190609143521.19374-2-laurent@vivier.eu> Signed-off-by: Laurent Vivier --- linux-user/ppc/target_elf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/ppc/target_elf.h b/linux-user/ppc/target_elf.h index 576a5b9959f4..061661885423 100644 --- a/linux-user/ppc/target_elf.h +++ b/linux-user/ppc/target_elf.h @@ -10,7 +10,7 @@ static inline const char *cpu_get_model(uint32_t eflags) { #ifdef TARGET_PPC64 - return "POWER8"; + return "POWER9"; #else return "750"; #endif --=20 2.21.0