From patchwork Wed Sep 11 06:49:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 173583 Delivered-To: patch@linaro.org Received: by 2002:ac9:19ad:0:0:0:0:0 with SMTP id d45csp414681oce; Tue, 10 Sep 2019 23:53:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzcziqpyiVtsKBysObjYVlME6KF33HVtG8REacPFSsidWVUtH4avVNHY10/ZhrQCow2GHGI X-Received: by 2002:a05:6214:1591:: with SMTP id m17mr12745203qvw.222.1568184811286; Tue, 10 Sep 2019 23:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568184811; cv=none; d=google.com; s=arc-20160816; b=UncCodogoN9EmnOS8q56BVyMp7Z+8MyPlIkPzxvmnLWmV8X0iErbtqRjLlV1q2+a9P r7AGUqFNY5l2Ohr1ijVekl5EwcyZ33BMh+ZceaPwfBTQ1duTaPuyAbk4WDv5jQaNQQXL N8VdnQ5hrdqAmLlpQSgifypNRCuQRpXFELKXyaIrnY9Tmpn6XdCfTlFQvsHJ7qjoDGK2 zxoMppzpvsEOpU09zAyVzz/8+ldWE3fsxPHjhqMDCBXvxttQz/yBlUGPr9rnrc96Nzfg 7GgsVe36KdbEJ2EL4gGQKKsTvqzwQt1Jfn94xuXCri6v5CInVpacboqRPtOlYQdoqJYW IhnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=NFKImPmr08G8SsfslwDCiB7mSjMEwDNYejz9mjUnLgQ=; b=UgwGmrJ1x9MDYa/uJ0ATbMBjzsoTo5wZ2k4/U4KM7NjPNMpgbvVEoekuG1kYFThufm GFBCjJM6M0XtUrkwjw1eTWnx5RKAOiT7ogZlfaBZBG2s4PrX0MxV7wr5PTXWCQWQ/MP5 wzCQ1sP4wGTwF+1wL7HdIgdtoCz7AVY2r5get9JcVdXNowrmiooOQtm/IruZTlks/qdH u4CTrGAjlTKWk88Chi6ppyS8ZvhGVmeGQgJd5uQa080/0I5Hl5C1DekoOlOm/zz8kx+/ V05EUWtmMEaqUZ++9eJWNxVHL5850zkhYer/v7VYU+Y1rd+SynnGmO46ku7s6/lXyCU8 10hg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j23si14360272qkk.160.2019.09.10.23.53.31 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Sep 2019 23:53:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7wVO-0002C3-0e for patch@linaro.org; Wed, 11 Sep 2019 02:53:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40764) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7wRb-0005wi-5a for qemu-devel@nongnu.org; Wed, 11 Sep 2019 02:49:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7wRa-0004Kg-1Y for qemu-devel@nongnu.org; Wed, 11 Sep 2019 02:49:34 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:41833) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i7wRZ-0004Jr-Py for qemu-devel@nongnu.org; Wed, 11 Sep 2019 02:49:33 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MQNAv-1hmGox1OCH-00MH9W; Wed, 11 Sep 2019 08:49:26 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 11 Sep 2019 08:49:07 +0200 Message-Id: <20190911064920.1718-3-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190911064920.1718-1-laurent@vivier.eu> References: <20190911064920.1718-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:UhOsa0Li3ZyDuFmsDVyrTCLiv2TPTPABsCgKe8F3x9i9OA/gwZ9 vo06RmXRwf7uVchkxm5aXG9q0BsRImvXqf3YYoTBLvXQUQHjTrPM9ne0xswrJMcodq/Uhtf Tv2kfIy2PTN9AYoS663uR0+5Odd4+xw49C26ertwvCc4qbEEYH4h/Vl71cUSZmCBcabhdKO dmaSeX/cjQFTKTNS4PPbA== X-UI-Out-Filterresults: notjunk:1; V03:K0:9pFxjYD9aoQ=:aH3Zo5CmoFyoORO/tWz+bD WWPkPj2z9y/K8DzYONkHBhWnT7jYmAjMRIKg3+FX0+J0qTS37GQgGF6Di2l8FO/j2aboRXXNR md9m3NBzUsTA2PhAfEt4DZcDdf4qHE8MeswkA7bp99MRqvQbWzdg1SsAkedU6/JkEWpUxZSfi YVpNW+2c3cSMfitCTiAKhXc4rZURRlm1XWFNo2sEz2lWkOgjtmCLUuNY3BuiYntaLuDFcgQvk 1sk7XC3timCt0On/Rt+D3YeTn/Vzspg1yScFEgDgLzyaYmjQQCaHlfdhFPixPiQ2fx4YimBD8 70Lh97J+r58w9alfpOBj3F6uoz8p12f2+ADRsTByoKl/Si/1g+KhBIoxk8j17Qf/On33jpLIA SG3wX69wB8b2e5wn0rU9/YNxZsPWYb4dJyVnT2O8OjA0sU3ZqvWGr8PFq79MymZZKVrSM4BSe c2/9ovOZr/xP+or5skr5LJkf/blfaPAldbNIvrkMUMf8ER0q+UUaDkxGF0MrHJfbZQN75gV66 UAVbBYhyyJBfK86x+IXX2HH7LiBNlzBisT/RW/b3BGHDbv1VhdbzKRba0B3uHrppy/1DuBmEt jIDZVTUcpej5KATOB6oTlgSPQtqao1MfTdW2ok5u24hf6oTlwFCQjtQTkwjcay2wDSFIhIQnK M5ruflqlEqOms+X7/o6YzvvPy2RBb7VRgIa8xToc+plBWfONYhDid+5NMuZ4dioDtjUP86mp5 OFFyNt2cg1YHmvbfPAtqCNcAEp6VKTazDzmP+iKfQTX1FyfkIW2hjtSw5EknXoGwbhybUxnoB HVHzqkFd8xFjttmQmx2X4Fj4QsY7EISXMD/blbtAIjUVzkMnJM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.187 Subject: [Qemu-devel] [PULL v2 02/15] linux-user: Add AT_HWCAP2 for aarch64-linux-user 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: Max Filippov , Riku Voipio , Richard Henderson , Laurent Vivier , Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Add the HWCAP2_* bits from kernel version v5.3-rc3. Enable the bits corresponding to ARMv8.5-CondM and ARMv8.5-FRINT. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-Id: <20190809171156.3476-1-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/elfload.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) -- 2.21.0 diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 3365e192eb3f..43c16a846d33 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -607,9 +607,23 @@ enum { ARM_HWCAP_A64_SB = 1 << 29, ARM_HWCAP_A64_PACA = 1 << 30, ARM_HWCAP_A64_PACG = 1UL << 31, + + ARM_HWCAP2_A64_DCPODP = 1 << 0, + ARM_HWCAP2_A64_SVE2 = 1 << 1, + ARM_HWCAP2_A64_SVEAES = 1 << 2, + ARM_HWCAP2_A64_SVEPMULL = 1 << 3, + ARM_HWCAP2_A64_SVEBITPERM = 1 << 4, + ARM_HWCAP2_A64_SVESHA3 = 1 << 5, + ARM_HWCAP2_A64_SVESM4 = 1 << 6, + ARM_HWCAP2_A64_FLAGM2 = 1 << 7, + ARM_HWCAP2_A64_FRINT = 1 << 8, }; -#define ELF_HWCAP get_elf_hwcap() +#define ELF_HWCAP get_elf_hwcap() +#define ELF_HWCAP2 get_elf_hwcap2() + +#define GET_FEATURE_ID(feat, hwcap) \ + do { if (cpu_isar_feature(feat, cpu)) { hwcaps |= hwcap; } } while (0) static uint32_t get_elf_hwcap(void) { @@ -621,8 +635,6 @@ static uint32_t get_elf_hwcap(void) hwcaps |= ARM_HWCAP_A64_CPUID; /* probe for the extra features */ -#define GET_FEATURE_ID(feat, hwcap) \ - do { if (cpu_isar_feature(feat, cpu)) { hwcaps |= hwcap; } } while (0) GET_FEATURE_ID(aa64_aes, ARM_HWCAP_A64_AES); GET_FEATURE_ID(aa64_pmull, ARM_HWCAP_A64_PMULL); @@ -645,11 +657,22 @@ static uint32_t get_elf_hwcap(void) GET_FEATURE_ID(aa64_sb, ARM_HWCAP_A64_SB); GET_FEATURE_ID(aa64_condm_4, ARM_HWCAP_A64_FLAGM); -#undef GET_FEATURE_ID + return hwcaps; +} + +static uint32_t get_elf_hwcap2(void) +{ + ARMCPU *cpu = ARM_CPU(thread_cpu); + uint32_t hwcaps = 0; + + GET_FEATURE_ID(aa64_condm_5, ARM_HWCAP2_A64_FLAGM2); + GET_FEATURE_ID(aa64_frint, ARM_HWCAP2_A64_FRINT); return hwcaps; } +#undef GET_FEATURE_ID + #endif /* not TARGET_AARCH64 */ #endif /* TARGET_ARM */ From patchwork Wed Sep 11 06:49:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 173585 Delivered-To: patch@linaro.org Received: by 2002:ac9:19ad:0:0:0:0:0 with SMTP id d45csp416580oce; Tue, 10 Sep 2019 23:56:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyF0UIJcYUZUrozgXku9DdILWBgKsrOk6lJKHW5aYO6o35ZN/30gcjMyM9PYtsk0RWdinnT X-Received: by 2002:a37:4802:: with SMTP id v2mr15916720qka.496.1568184966980; Tue, 10 Sep 2019 23:56:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568184966; cv=none; d=google.com; s=arc-20160816; b=RdTVMElR+8YNdZ+6/ZvnpZ0vOzrz07r0PkMzghwfoY97BY4Un2Dfy1/ePKX480MrFb e2MUWZOdNRh0Ogk4egDZ0kBPk/aFH/TcqINe1rB30i2OzoWDFMJC59dv1twEvgzdb3vM rIdYEpaFKs5gz06LYzoypjuD9aRYMD6iFcZCSoJ7uJfdxy60t5yPdglWLNnuGYroQHd5 mbnakUM17jGz2OZQDciXxaEqqK8DOgWoiHMvcFjrNzmS5DhqDfA3enbsbZHMpi45ahHp 9KD57zXwpI8y2LpLWJlJVX6R+/ntSsInk1lXORK6ALvaFRKvRL9s2OPe2N4r68Qsq7JC JBCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=tWWTRqX1cq7pInOa3UIPDwDmPhfOe1V/Y5nF6blMpkU=; b=Ug1z1hTCPbReK0alCOvE0eiDGUq5+awl2p39RFy/t4jjPPDS33b/Unj529TTg73vU/ xMgiWJ4aeXTnDOca/qfNlw7BottwkVcr/JzrLA6diTeBO7wazpb6Pc3r8bZ2XBRNEACI OUBWkqzcxZ8fjTI8xfDa93Z8u+MLRsOaunSXVclZCHxruxzIJqgn/D0x+diNp6Auje5m /lTm8UsgPMN/HCccdxKKsS8oOjtD14pFlJzC9/ZpBkdgjrwBlrfbzJfmVDi9NxQFP5fj zlNHY3gpp6AkFXp/ERBHYDexT8K5X9yxM8dZOaJ3tmJiNZLWPOpOdv7gXeMOx17L4IKA R03Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b56si15953342qvb.137.2019.09.10.23.56.06 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Sep 2019 23:56:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7wXu-0004eN-0U for patch@linaro.org; Wed, 11 Sep 2019 02:56:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40818) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7wRf-00061q-76 for qemu-devel@nongnu.org; Wed, 11 Sep 2019 02:49:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7wRe-0004Mp-1u for qemu-devel@nongnu.org; Wed, 11 Sep 2019 02:49:39 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:60443) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i7wRd-0004MK-QF for qemu-devel@nongnu.org; Wed, 11 Sep 2019 02:49:38 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mo77T-1iSRH21szb-00pfb6; Wed, 11 Sep 2019 08:49:27 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 11 Sep 2019 08:49:09 +0200 Message-Id: <20190911064920.1718-5-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190911064920.1718-1-laurent@vivier.eu> References: <20190911064920.1718-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:tZI6n73vaB5Qv0qy5MoNsYEtjZ5ZaZbRe8BNUoALuIYHSgURjaB 3I8034V3qK3vmu2YNHZRf9tNx/70H2DOEquDRe5C4ecb/PCTNxmGamqHOUD1I6O+WjQlBBS jBHqmWT0p7Drg8ZdSKxx23fQpQcMzHiKZh9nD/78MWayDxb3lDgjTHEDXFYGp/njvVi5+lo j/sH0FciNz0RlCizQMslg== X-UI-Out-Filterresults: notjunk:1; V03:K0:hToNasJc+CI=:l8Huln66Xq1zBK/XPsnOan 0jzkaJHK3hRFQrILRcE4QNRir5CgxXu8xUnyh2ObbPnif/ji5Lh+qevST95SVDWi28Uh3mld1 qo4R87gfu0r5lSntBQDo7qE8uctHwYhHd41uKyDAC3QtfJtmh/4s4EuO+s1KyU7hp+qfEt+H0 pfsqfWz8NUizGFRh3XHc5rgV8hl2ExjDKmTEUF66FImx8/APNLHOV+xi65aRO/2DHdfUvuLCn +f2680fH6DCPiCxJ44C0/ZOPHWBk/6qEkQZ6QAs7ndiLPh5nMgsBl0XnwFDQdZWO2cpm11IZv L3GjNK04zhcyjlup0Mk2OKvZqNMdjz56LbOt8OllyuY2U8FRYE1UTbACt7myankS9Bm1SbPr7 Hz5M2zBJ7qkpi5YVhjna99KMiaADtjtIrbdIRH0znYBsemMDLhLO3DKHjItrFOrPLv7b4gr/w 3h38rOIbjCtbTI5amz/Kk7H0F0INHW5INijfEl8+AmJVHKrUQLgItoWF7dla7estOSxXBbm4G 6xEdh0xNRNKowPb84zszOOpmEYoEe21ruBAjpBhGvXlW0ClkEHm98w8M83n9LtVId+2BXqVA4 63OudArRd3Ba77ZgZ9a3tAsuJCpBL5ixxmm9SSc/Wk/h0n7MH1r4HLl+J00ABYPBTb2PEjZJE yaSpQNjVuXRtG3kxMw4XLEwWi3uYbAc6pldi/pFfJALAoOb9zhX8+2alf+yipQT+KKZkNqih1 tbARWKU8Ur/B9/QgM9es9Y9l7CdrwGd64ylIpuithH3YgQwnfT8Mn/o6v5NlyKnar29pvEnW/ +jXbWEptu/vI3kPQPlha+BRK3a09ctROSB7RLuvniVQQxHsBHM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.130 Subject: [Qemu-devel] [PULL v2 04/15] linux-user: fail and report on bad dfilter specs 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: Max Filippov , Riku Voipio , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée Just passing NULL means we end up ignoring the bad dfilter spec instead of reporting it and exiting as we should. Signed-off-by: Alex Bennée Reviewed-by: Laurent Vivier Message-Id: <20190830143648.2967-1-alex.bennee@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.21.0 diff --git a/linux-user/main.c b/linux-user/main.c index 28f0065b6ddf..c257b063dbc1 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -235,7 +235,7 @@ static void handle_arg_log(const char *arg) static void handle_arg_dfilter(const char *arg) { - qemu_set_dfilter_ranges(arg, NULL); + qemu_set_dfilter_ranges(arg, &error_fatal); } static void handle_arg_log_filename(const char *arg) From patchwork Wed Sep 11 06:49:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 173587 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp364053ilq; Wed, 11 Sep 2019 00:05:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyftM0UkF+nC5Kb35z1bU2waf/Af4tZu7ScUTSG5LJJ5bebwzSNboI2gJ9amdBUoLWjmZBf X-Received: by 2002:a17:906:3644:: with SMTP id r4mr6400394ejb.92.1568185502148; Wed, 11 Sep 2019 00:05:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568185502; cv=none; d=google.com; s=arc-20160816; b=r2Z/ltlbRgJI1exfpekMNchLUW0AImqJHxfrm1r4OWxU7mvgYwEhBC0eqPEpnD/9/Z cUSOcDhorz76um5BdWYHDVLGqw5T1E1cLK5rsrQVTO98NICVRzW00C3f4z3h0hvFkZ/m NAriCOYXFawvIG05E/+U5vOAQ3O8fcka4MXWN9Ww4Kd2QjxVsdihbFgrMeFbyzuwjqjl n/G/O66SwlTZnXrzTY9V3Hm6Qa457wPoec/JvPij7ItHnxTkbRw0wuX6VvnjvVpwSG80 2UeipyvOkmIxXyyvn/KyVDW60uwuW6bo/8EzSeuuIhoM68qtovsKBSxYaUpn5zvsoJxR LC4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=/Dqr83SHQ3z/XApHSO4Zg34LIjGtHnwefMj5rEzrPDs=; b=ZAFdBDSBne4Fz4B+JBmP5dO8NVmKd0htiPcxjZ4mH5npw3jVTt18eR+FRN1+3v8oPb WPvKXm7NJQ6QI8EAKPENAKc/ruQdctxd3BNXQHtNSp5bjJ5ui6Xw3Mud8Z8cDLdFxkLY XtL2CW27NfMo+U9CjzBkI8OD4jczzPi1wxEUVKdTRL2Bo2O3Cq0xlgYarGdVjRv1H2Su y8wXRqljYbzVK/5SsZ7POE1zCwVhwZPrhRrZWEBlMHOaU+MqWSq2VAMzXxGw83rAMrhx sToraRtuIZ+ge/wjIHk5nnL4B/rV8PKKD6i+JTK3CCOegwhzxl0FtXIf1j7wX2hbebeV 0sEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a8si3162772edn.332.2019.09.11.00.05.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Sep 2019 00:05:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7wgW-0003up-NX for patch@linaro.org; Wed, 11 Sep 2019 03:05:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40858) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7wRh-00064k-BS for qemu-devel@nongnu.org; Wed, 11 Sep 2019 02:49:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7wRf-0004OM-V1 for qemu-devel@nongnu.org; Wed, 11 Sep 2019 02:49:41 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:58283) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i7wRf-0004NS-LU for qemu-devel@nongnu.org; Wed, 11 Sep 2019 02:49:39 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MWRi7-1hbqgV2OPT-00XrjM; Wed, 11 Sep 2019 08:49:28 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 11 Sep 2019 08:49:11 +0200 Message-Id: <20190911064920.1718-7-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190911064920.1718-1-laurent@vivier.eu> References: <20190911064920.1718-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:lfv5mfUSpaYqspHFKcdASL7d5yzUy8SzbylCwkjxEMMQX0pt1dN WQW6rI2nCkDkFAiWvSAPysNHfX2PU7Qe45U9dcp47ivUYgEMkwinEnwH99BvjT+2FN6x5kJ HaKMksge0wZnCFb+vZSykuR1OZY6z5CuLtFggw1Ke6bMb6qpOTIhyxz5W2PPC3yJIM708ma VYO0f0UNibC2KBd6NNcVA== X-UI-Out-Filterresults: notjunk:1; V03:K0:6e6TxgXutMw=:kbGnVGt81wm7jYxVXxAjbh 7zacYdDUQwMER/eSkAFZ7VNjWIMmi+wGzqcje5pVnhK2rj8gUuZbAhoPttcvXgkEOo+J8sJE1 WdgKjXPq1RKCbLiZVg96TuWPa7eMCOZvjwbuEmKEVF8e+OhgQrfkUbeCLr4G2qaYGRVCEqFel LEh2aNkZ29T5TZN7Hub7v9Fccc7ULVpsTQzJfQ+xyUf7qpQ2ZN7/VVeFbSZrLNt6mrbTP4JkC yoE6BIWIiiGhzV3cBEl0K220Pusr8G4t8YF7/KGrNA8vhwFRfp7YxrXB4yG6Y63yMZtdBmtoU 5wmLHH4z1cctgqc6Y5WzGQwFtuKksqXFQDMTap0vxjejt5jz1bpSpUQfBZqccx7sqRVAhT733 ti/jwr0kBlH8r+Dc6KmVBBHEXly5tnawsq1qCvDPDOsQjx3Mg0eJThzuqfcj5nzzW9dzJjo1X J3ATpSbz077Ar5Ei4O6uPp41DgCd0BLZHSEogvxlJGiVp7+cZu3z/j2hx25zbEOZnLxemXXFs RTVqXDXNmMy/KuJWXxpv7Amlru0+yw8iwLHNvjK2qf6GB3ywkVHs5uYFhzL4sPbEuBgz5WeW1 IyYFbxqoyEBor0G9ifZwrzpNqiyD2qvGFI+lVDXfXBk7o37d/rIm2deRMwWhCJLdCRffkSKwT lc3Ah5xDpopr2uurllzxPgEeyOznIEjuAAebtMg1SGTF8R4I/VcBnIZFVwQ8yLQvK5Ypz3j2l q4p/D2Uw2t4tfyCSc7ICKxdvE7Q9C6EuLPl6i+73HRLph6nnhZsFQp2sIL7HWYRNcRypNHVre i2VCQ2+JH7GTn4ec9/E6R9Bf1CUS9tghIMCopx3IF+Lrf8IxtE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.187 Subject: [Qemu-devel] [PULL v2 06/15] linux-user: Pass CPUState to MAX_RESERVED_VA 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: Max Filippov , Riku Voipio , Richard Henderson , Laurent Vivier , Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Turn the scalar macro into a functional macro. Move the creation of the cpu up a bit within main() so that we can pass it to the invocation of MAX_RESERVED_VA. Delay the validation of the -R parameter until MAX_RESERVED_VA is computed. So far no changes to any of the MAX_RESERVED_VA macros to actually use the cpu in any way, but ARM will need it. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-Id: <20190822185929.16891-2-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/arm/target_cpu.h | 2 +- linux-user/main.c | 43 +++++++++++++++++++++---------------- 2 files changed, 26 insertions(+), 19 deletions(-) -- 2.21.0 diff --git a/linux-user/arm/target_cpu.h b/linux-user/arm/target_cpu.h index 8a3764919ad9..279ea532d5b7 100644 --- a/linux-user/arm/target_cpu.h +++ b/linux-user/arm/target_cpu.h @@ -21,7 +21,7 @@ /* We need to be able to map the commpage. See validate_guest_space in linux-user/elfload.c. */ -#define MAX_RESERVED_VA 0xffff0000ul +#define MAX_RESERVED_VA(CPU) 0xffff0000ul static inline void cpu_clone_regs(CPUARMState *env, target_ulong newsp) { diff --git a/linux-user/main.c b/linux-user/main.c index c257b063dbc1..24cb24f0bf8f 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -77,12 +77,12 @@ int have_guest_base; (TARGET_LONG_BITS == 32 || defined(TARGET_ABI32)) /* There are a number of places where we assign reserved_va to a variable of type abi_ulong and expect it to fit. Avoid the last page. */ -# define MAX_RESERVED_VA (0xfffffffful & TARGET_PAGE_MASK) +# define MAX_RESERVED_VA(CPU) (0xfffffffful & TARGET_PAGE_MASK) # else -# define MAX_RESERVED_VA (1ul << TARGET_VIRT_ADDR_SPACE_BITS) +# define MAX_RESERVED_VA(CPU) (1ul << TARGET_VIRT_ADDR_SPACE_BITS) # endif # else -# define MAX_RESERVED_VA 0 +# define MAX_RESERVED_VA(CPU) 0 # endif #endif @@ -356,8 +356,7 @@ static void handle_arg_reserved_va(const char *arg) unsigned long unshifted = reserved_va; p++; reserved_va <<= shift; - if (reserved_va >> shift != unshifted - || (MAX_RESERVED_VA && reserved_va > MAX_RESERVED_VA)) { + if (reserved_va >> shift != unshifted) { fprintf(stderr, "Reserved virtual address too big\n"); exit(EXIT_FAILURE); } @@ -605,6 +604,7 @@ int main(int argc, char **argv, char **envp) int i; int ret; int execfd; + unsigned long max_reserved_va; error_init(argv[0]); module_call_init(MODULE_INIT_TRACE); @@ -670,24 +670,31 @@ int main(int argc, char **argv, char **envp) /* init tcg before creating CPUs and to get qemu_host_page_size */ tcg_exec_init(0); - /* Reserving *too* much vm space via mmap can run into problems - with rlimits, oom due to page table creation, etc. We will still try it, - if directed by the command-line option, but not by default. */ - if (HOST_LONG_BITS == 64 && - TARGET_VIRT_ADDR_SPACE_BITS <= 32 && - reserved_va == 0) { - /* reserved_va must be aligned with the host page size - * as it is used with mmap() - */ - reserved_va = MAX_RESERVED_VA & qemu_host_page_mask; - } - cpu = cpu_create(cpu_type); env = cpu->env_ptr; cpu_reset(cpu); - thread_cpu = cpu; + /* + * Reserving too much vm space via mmap can run into problems + * with rlimits, oom due to page table creation, etc. We will + * still try it, if directed by the command-line option, but + * not by default. + */ + max_reserved_va = MAX_RESERVED_VA(cpu); + if (reserved_va != 0) { + if (max_reserved_va && reserved_va > max_reserved_va) { + fprintf(stderr, "Reserved virtual address too big\n"); + exit(EXIT_FAILURE); + } + } else if (HOST_LONG_BITS == 64 && TARGET_VIRT_ADDR_SPACE_BITS <= 32) { + /* + * reserved_va must be aligned with the host page size + * as it is used with mmap() + */ + reserved_va = max_reserved_va & qemu_host_page_mask; + } + if (getenv("QEMU_STRACE")) { do_strace = 1; } From patchwork Wed Sep 11 06:49:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 173586 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp363671ilq; Wed, 11 Sep 2019 00:04:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKFuMzMCngqLnSngye14oPt2tjfeWgz0VT3AnpMfH0D/lh+gzpbRakQOeOJkym9X/K7Rny X-Received: by 2002:a50:b885:: with SMTP id l5mr33807578ede.190.1568185477922; Wed, 11 Sep 2019 00:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568185477; cv=none; d=google.com; s=arc-20160816; b=rgwYaZcr0MHUpW+H+5Gq6ibhXBqsXFQcsn2duOsVjDza3EbOpPLaTjv5/RzAU+sXSH 00V/LwxrEU0kgd0gJME/SFdOui28PrLi5Jh3PP+iI/31CZQJD6OgKhnAZF91z8ZRx/51 UzuJpUAgknsfAsNI2Q82OZHUR2bKnWaSkH3mOe3Zr0n3fXBbVGdr5L2T4DVYBoKtCqlX HyM7j8NIAUtiU1YOjuk8DPoUWuLI/FEsLmdjYuS60X6+3K2/Bc5k+RwHBwK++Yc6H3hk dmVva5L6RXXZhj+xzgLYO0ViBEt+PsaBXLgi7o60dWJwGszPPwHxWiFlQw5BWtNaU4b8 OVvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=5WUn/6kfhidm5mpu0C/wAtccXkgTaI7FLXy5AetX8q8=; b=M/cejHgCuksQTAdgFDsX9zIOwIap9fbJK1g95aKExTo/bs0c6RqCtEzBRw11lLoqSG 5G/3AmvnjP7naYhZzmPi738iyMEOND6j2ZKtohxObf+pS+AmaqB8P9vS6gPB6eYmwvHD q1r16SB6SWWWEGwI/YJV9TnURxp119LufcwJXZrbTePmFPW6+KN81+NtMZEDed+nrlqY l98TLYijsWzdpESKZ7tZNzSs4idKVz/69p/I9AZ5sNgVeXr6JDmMcnMhpZc7WmTCeMwI 0uoGsQPuS5F53A8th42Drc7MlkSknk+fAWrkl7t1dt/qkxFkPRy9JkQcBycEGYlp4m0q Nh2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c14si12890802edc.81.2019.09.11.00.04.37 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Sep 2019 00:04:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7wg7-0003a5-UN for patch@linaro.org; Wed, 11 Sep 2019 03:04:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40819) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7wRf-00061x-8n for qemu-devel@nongnu.org; Wed, 11 Sep 2019 02:49:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7wRe-0004Mz-7K for qemu-devel@nongnu.org; Wed, 11 Sep 2019 02:49:39 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:55867) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i7wRd-0004MP-Va for qemu-devel@nongnu.org; Wed, 11 Sep 2019 02:49:38 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M433w-1i7wRV0koi-0005Zb; Wed, 11 Sep 2019 08:49:29 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 11 Sep 2019 08:49:12 +0200 Message-Id: <20190911064920.1718-8-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190911064920.1718-1-laurent@vivier.eu> References: <20190911064920.1718-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:j1F0yFaoMBQbhDzxmPD/ys5XuuMgxXp2xefCRwWzaxgBAq1Qh3Y XnXREZG434/svVgJWbJFkhZWP2mZgf+nj1Wd+MNGLW54VD0DuihYSGH9mjuYsFyBAvdvfb3 DSfavkSh/rrOerPWH9p1PIO7ZFOQE8vWQ/IB1i5Mcdt83cPdFQ6LnUDJ0yHOr0iXYXDtQbo 5sW5mhIBET57KsWKgLUHg== X-UI-Out-Filterresults: notjunk:1; V03:K0:KvlJrzyYUls=:nUrra4ZjROo/bXiDf4TkaG DpJTcZ3KbUbA/oB5W1FAlyOYtcwt373QGxC9h/7fUTdc/amveaIpeuEcx9hiYsbHpcS+PnGNp 1ggUaT3/L7ThyUGweeBC8PhvSGiqL899UFVIQ6kH4RcsbIGMSBOezIAGokE4dQx0pQSdw3Ot9 kUICto5xq+46r2uvKHk6Doje2Vsr8UJTKTWXVUmWrpgxt+A0qFPq0GVb/3MJOrVS6gtCfXt96 JQ5YbvoaXxBzh2iK/+7/tT37ETZWPEB+73M8b0fLzZ61HyCXrVlX9F0MbTRxYWT7/wydno5Gl unvrJIbLnVlageGdJ2BxjOxlAsWwhiD4Lrb5A0RQQG28Y/qw5bYkyKAJMxMcBj2tHwrkt9H6Z SpHA+bSYz53KVsGGCCtiA0hAPi3qBvQMQl65e+WZ/Pg9AtVUNis4T2aoH3t2bfsmefrpYFUqi QyUsG10PqwM3Q7OsI/NDFGNmq4vWJHJ/wmSvRa6pCCXzs1rzBXsSu7gIAr+8RHBpD9k1uOAqg uTSOsSLmS1MaSG7z+gO0XIzG1uVGhkD/k6tCdfy+rEJC/sjzz3KZwPAHvJQjYTDI/8gjs1uQC JZZ5WG/v025B9zj+7FJirH5oY0FqRt5b8jwWNSvw7nEuq+wTSPzFUNwNKcfHAR4kqOe7Ac2I1 qzEtQ9LLjpTMsCNsJ+JqseZG7vkuCz5dHE87Ni4rgnEThrCgxoyN6YRa/ENdsAL3UmgGCdxKm hv8/Icf8qlrWSNQKYJoqmD9/d0j3hiB3+GP25MS/GYZiQqMEsY3ZQBRxncda4FXZ3Bbnda6Lx bCDKTgldaPP/DqpHC1kfcf26DWuq5KoOOKTrNzGoqMdmnVk5ZnyLTmY5HhbHXsNSwIsdWybAR W+dMya93idaAwZAZ8Gmo3SDOR/fAN3XIdQyEdqkx3jtsvEvjv4ZT30NnpDISMzxOcEwJoyhqq Dwj8xb8D619mtdNdgsbWgH3bmEo3UjU5vDrjVHSyeso7XqyVe2cX7vCnU+QDrMlYmer45+Zm5 xWw56EaQ7WW0DhBDxU62KX0bmc7GVgdKFEaBJTK2QV72 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.130 Subject: [Qemu-devel] [PULL v2 07/15] linux-user/arm: Adjust MAX_RESERVED_VA for M-profile 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: Max Filippov , Riku Voipio , Richard Henderson , Laurent Vivier , Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Limit the virtual address space for M-profile cpus to 2GB, so that we avoid all of the magic addresses in the top half of the M-profile system map. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-Id: <20190822185929.16891-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/arm/target_cpu.h | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) -- 2.21.0 diff --git a/linux-user/arm/target_cpu.h b/linux-user/arm/target_cpu.h index 279ea532d5b7..3f79356a07fc 100644 --- a/linux-user/arm/target_cpu.h +++ b/linux-user/arm/target_cpu.h @@ -19,9 +19,27 @@ #ifndef ARM_TARGET_CPU_H #define ARM_TARGET_CPU_H -/* We need to be able to map the commpage. - See validate_guest_space in linux-user/elfload.c. */ -#define MAX_RESERVED_VA(CPU) 0xffff0000ul +static inline unsigned long arm_max_reserved_va(CPUState *cs) +{ + ARMCPU *cpu = ARM_CPU(cs); + + if (arm_feature(&cpu->env, ARM_FEATURE_M)) { + /* + * There are magic return addresses above 0xfe000000, + * and in general a lot of M-profile system stuff in + * the high addresses. Restrict linux-user to the + * cached write-back RAM in the system map. + */ + return 0x80000000ul; + } else { + /* + * We need to be able to map the commpage. + * See validate_guest_space in linux-user/elfload.c. + */ + return 0xffff0000ul; + } +} +#define MAX_RESERVED_VA arm_max_reserved_va static inline void cpu_clone_regs(CPUARMState *env, target_ulong newsp) {