From patchwork Tue Sep 10 16:35:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 173540 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp6043374ilq; Tue, 10 Sep 2019 09:43:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOhzH2YD8AiaAdb84mfFwGtAzTCZ3QwXxFt6/78lMMDApPpZnQFmfBr9ImNHPj96sfQXF0 X-Received: by 2002:a37:85c7:: with SMTP id h190mr8946979qkd.233.1568133812462; Tue, 10 Sep 2019 09:43:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568133812; cv=none; d=google.com; s=arc-20160816; b=wiyqkvSjJ4FFle1x0I93gs44HK5QnvOY91dG5/cV5y8QQrEJzZuQEYWIGD/CaJyZ4q Uv4IcWX3opV6ZiuD/AO/l9OIGH995GDyWPn+NfQ6LWZBU22kAucRo9PEfdH+b3igVt4J UoRGNyJTASFkX0v9lXyznqqO6RUMTODHOhNc96AMv3r5WkO1NGTcSGd/yV0PzW4PlYdZ LrPJGzc3j4qJ3hS0mmU8mLFut8wthQlK0vIozl/KG/wtKzgOgRxR6qshDPaDN74YMR8W Feu8wO+G+z5pddR91k3/+c316mq93aT4aOc4XGhXhR8aIzyuTVFpPh4QgM1OA+o2EVQz oSZQ== 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=z05nAU5iKaP8qL2+RdkuMnHzUJIIhsCR9uDBJGadOKpcc9sHyVaMtX2MpZkgQF/iIk apE1PPzb3fIH7UqUhFlRFoGciFDK3BfzKwGi5vLmVRyjD/lf/zzYpqKg3IFvM9BSIsw7 zEALJB7ZRsauV3IzM22doe7iOD1a5SenjWToAP+Z6BITHJ9u/Zm+w9TMYt9mRVQzFjiw mRPUSf9R2kiBBLKklSDJJILHgQK2mowAWnWFL+9qIoeBr6DUgyvETyLutgZFPDCBerSs pbcyV/M545aMAADN9P110QYXipLZs8FfHGqSC5eG1jltiPFsJFNzVLhwupN3mN0ALaUY LEGQ== 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 d24si13964068qtc.53.2019.09.10.09.43.31 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Sep 2019 09:43:32 -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]:43152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7jEo-0003zZ-4B for patch@linaro.org; Tue, 10 Sep 2019 12:43:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53240) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7j7x-0004fa-Hq for qemu-devel@nongnu.org; Tue, 10 Sep 2019 12:36:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7j7w-00029X-Ce for qemu-devel@nongnu.org; Tue, 10 Sep 2019 12:36:25 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:48109) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i7j7w-00028g-3y for qemu-devel@nongnu.org; Tue, 10 Sep 2019 12:36:24 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MEmMt-1hvvnu1rh5-00GJZm; Tue, 10 Sep 2019 18:36:09 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 10 Sep 2019 18:35:47 +0200 Message-Id: <20190910163600.19971-3-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190910163600.19971-1-laurent@vivier.eu> References: <20190910163600.19971-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:0KXaXHtt6r83pzwF5arVoOGeOG2MJZuwiWfdj6t9LUAuKaYJDOi KsXZfV/1poENgUcxzfe3k6IpKK2jX6ZTcTo3x5gQqnkKdQavG+p5K2aAK6Cxa5EOlnSgERM 5d+l3DtXNeSrmJXmG4RuGsIAyNvOnMobh78rYctUyOVT4JfUVw1dTLgCe7eqzPJKYVuXklH MMYLLmkRVcUX7J48+l7yA== X-UI-Out-Filterresults: notjunk:1; V03:K0:S01fj9U4d/k=:gRbZXPngHBiiycGGbUtTrB g1+PyRCWvXGj9g95EuHEM3B09b2N3CQK5qeNq/Xbp4PikkuzX3e3kaeUjqz7uozjTMK18D27O KCR6AKdzPiEfFF8Mj/jIabT/CAhNvgPgBv3fsAH6xCn9Ve5GXnzujem9UVx0dg62sCLhH+Cjj 4HxlKeR3Shii4y2E41tuw5sLOjqy3xEfJBGSU/sy9FoOerw87wPeQIWx9P3X+lMidNX3S9Q6Q PEbxme2e7v7XnAvbJ35e7mx4dE8XnZQ77PNeFMg8Php6ylHBbRA68KPrgaYb2kwJsip9q9FYZ rTdpxIxWaPFz02+tmu/d1ZNN7sfZoQFhw57dRQ5HCCv7iY3C/xYmpaFzI2vufEBjcrK9bb5vL AkuH9MXnboS0BtCU8zXO8xW0OyRqq7ByuvYLYhv7biR68XBbfOHrjmF7JXvYn2RsnW2ElF7uE t7Mf2b1097DdTfqtAdhe+3HKxzOdXmUwT1IS+J04cX3x2ZZIvdcF+x0n2PlE+965xVOtq36Yc 4CYExUP8PphzAbWl/uL2XvI+rIpqD7lhGV0yeNGZEGzEivSuI6MEJv8B4AwShgyR0rxrWP73E l5va/CQhQi+V8j4NXIljjqkXXe5zZcGcmVtANhBOTgTrJtrQuYWaC5FLgbgc8ID4xBu6EzXqI 3X6gV8g5ELSLx48K4f9IJNVruP3Y2UihlVLQlOon8US8AEW6fxcxqi0tlBtaivwk0U+/tr9fU 1gOMo45DrKFVk38nZpnG658xLXbjloGxaZM2C1BZla5PHE5hTbqF67ls7mKjboaJUnxfsyeoi o/nnITporo6yuO5CFPFsGNUQnV1IfgXNntx7DZRCAKxvk44+Fg= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.135 Subject: [Qemu-devel] [PULL 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 Tue Sep 10 16:35:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 173539 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp6041168ilq; Tue, 10 Sep 2019 09:41:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyb0ipYnuy5ja+tPyw/NgjaIem2Y2rZSCFCjZGh4T+2fTsVIuV/Kz2xXbzFAUbgslTlHaC8 X-Received: by 2002:a50:95a3:: with SMTP id w32mr31827859eda.211.1568133675907; Tue, 10 Sep 2019 09:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568133675; cv=none; d=google.com; s=arc-20160816; b=WrjOhDdg1+VHFv34uKsIuWMNlbJKN5fSrQZsVEoCuwjVdIU/tP775exVXgNwWM9Dru NHHh2VTV4LgnLqBAba0EG1bi9X+pQJupMoJM8DKSsDorl3+Qe4Mt/ur99NLRCYi9/hoG 229pZ/15ccfJO53z2lE7/qLA6TA43iUcedH/FEz3yFlGx+oVvJ1ZZfjVTcCcaNISKFQL j8ECLIJt72CxpkY5/8hSE6ME0WHP8XGyMXMbdG+VXqC8bdsm84Rgv043Qj93b03eZLUr ihZP+QxjCGE+KzhEU9m/diCLgo+4kvaDzOsU0PXIOJpujkt4vyh37STQnHzNqEsstkvJ I6pA== 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=jUZeE4CYrjvelVPIChMt6D+LRw4K9g8rFTslxBxhZrD5VZiA+ilWo3G99TkG0ZAQ8g SU9n1kxc0hfh1ssBVzWjxMrmOtph2kShmz+wKtc/jNC/JJsMfmbPwov/aQCN/S8FnAgD 5n/EGxgvXTXaLsLVyqWFQMl2NkcnICs6jrkuWdMbBSXPFInGl7wJ6ML3XtFVgXBEPrGp 31RGZDs7XPrClypwnFvcc/jCVIWAC+F+7WuAuz4G1LYuXG+Fy2MvC0OYR4X7bxsbS7bf co6ZQSPM/b0N315rCSiULBnJ1kGRNbUrNd36ZB/5TBL4SeIDOXB62VgRtRKfovXxhZwM zmFg== 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 b47si10271410edc.45.2019.09.10.09.41.15 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Sep 2019 09:41:15 -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]:42955 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7jCc-00004u-El for patch@linaro.org; Tue, 10 Sep 2019 12:41:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53126) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7j7r-0004X1-J1 for qemu-devel@nongnu.org; Tue, 10 Sep 2019 12:36:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7j7q-00021s-JD for qemu-devel@nongnu.org; Tue, 10 Sep 2019 12:36:19 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:48125) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i7j7q-00021B-AU for qemu-devel@nongnu.org; Tue, 10 Sep 2019 12:36:18 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MsqIi-1iRKL50RYW-00tAs1; Tue, 10 Sep 2019 18:36:11 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 10 Sep 2019 18:35:49 +0200 Message-Id: <20190910163600.19971-5-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190910163600.19971-1-laurent@vivier.eu> References: <20190910163600.19971-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:Snl31syHCaRUwPZeR5XWR6Csa5PyqsiRk6pbWTvrU2g9jMoikBf Yh7q/CyPLwmmJXTQ6L0N3tMIVEAktqdNuo9qbvj4tGNXPnj5oDAe4vPsPmiz4rVutI4X1tT 4O+iil0yIhC5B2F+BL5RrpdTp86neml/SZWBueax5nExFhsMSclMV2KfUopxE1eWCapaKpt 9SC+OFyTzHaJO8r4cAYeg== X-UI-Out-Filterresults: notjunk:1; V03:K0:aswRB7F3vmY=:ZIV49uQwCuIrOMSeDbp618 2GpOMkCf2+dHx6H1++YrgDF504Y6iiVnWyMZ7PFEKbQuAHQ0wVELVADa0EXAvLf92kgscsy/m CF5ddfI3378gNfSVI4P1dZ1og3zidRBh5N3Q1aQIT9pBS+/chiC6B7NCx/wk1IT2JpVT6n3xS QT6iGslUP4+YbJXmzQcOUWY/99jkTbHrzdg7sfQFDt0wUvfcYdgjGtifjDql/BAUQPaQbjjRB ktoehj2hwfRq6GXWdOvZqpAp8vDBrfEUKIwd7dTirw3LKppxmThLjCzkGhszsl9lPaScUMIO5 6lPtzgsYSAreSi5ANXs8QhmIItz1oL22eAYesMab6zY/r6sFLNB/dAY+zFybQK9vQtGBkm5eG ik7jiqSWAbPMTKqr/f/5vswQZchK0n7SupjX3uEfkH5OslovbY9jDYKfjYASr0B2Hkx7xzZVb 9tiJQyR1ZutNR/YQxsKz9zHPz2x9anzFrsfoRDuqXVPJOg5FZkS34ESBfNBTdjkFHWOT2YVf8 vcvr5ZHfL8X2bp+MgWQmYECVK8OPkrZgI9XMFNGdUWc47Xvh5ix+Bg1Ls6G14454z2yQcfOwq oCDSDiahYezGzd0LqARYgLfeYyDesoQmDYP4FLIvUZlYZ1pKrxyz+CbP+36X5gudi8lvwvNye AN75ec+dfjNbTAVXJoCTxz5trpMutvC+GJFM5LitWNgXi86oO5EudEQXmKDfJ8hnFp/COZbLj KOFmBBXpiXz/fcskrLWyuKcjqImwtAA5Wg+4OjZR+SThWgDRhoHDlBFGGXFI+lUQ7Ri55Kntp dghiev9OxkKESTHb/9k/lwUuXXtMWA+TT81u+iIN3cvDTb5M4Q= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.133 Subject: [Qemu-devel] [PULL 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 Tue Sep 10 16:35:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 173538 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp6037497ilq; Tue, 10 Sep 2019 09:37:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTX2PElCz96PM6uFVYhiXM9iRY+mmrF3gIHfBte6iGtuEm76eqAVncsXSfDqilVG9njnXY X-Received: by 2002:a50:f41a:: with SMTP id r26mr9754519edm.300.1568133467997; Tue, 10 Sep 2019 09:37:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568133467; cv=none; d=google.com; s=arc-20160816; b=aBhIDuODRSpkj5rwKQ0anAK4RvwRGe+dF++c7DNU/ZgCtMk1HpNBu2ch2s78JY8Wqj ydK2uaG1ikVNiUHwgvQmZUcbnJUizzOQVjDPfb/7HN8EsWjrH4SAB8xBgmkU7Rf/3hzW DqE47BHyLKIigxAM67zzgegSRHBzZvLVo8lnmI1u7nAoJz237vzU1OgYC7exuLtEJFKi weYafeK8fsa9BrNO4dRB5jc2WDI0Z17kxN3ZMVJGE+Ebm17nThnyugBDO6ElXSFnO5vM v4X/W9+zffclbaZJ0x8AAOwVj1fA5VL1yBbk/eD7lTlbQUG5u4s0v7uYURVhrtR+2VDC xzTw== 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=h4WSUD+FvHV6rMW1zVGJ7rG/UctlQuO6MLzhCnoYEjbZoJ6ZqH3aFdO3sd+OgPp72t OzGjHeZ6kgyUJHLcM0ePd7RYvhC+81ILJfGxaGABVmeAxjgH3ZnkTVFoV22yz1PXwbZ9 XA++z0WPchI0OuK/wOgVDNc8KTroyTLWcgJCmTA88mdZcuK8wCrYigOpSbsMICipoNP8 XC40LJzVS1AC9+qxzLIAJaVGcMiBZAx5JcDTpRRc5YsldXBQfaDCbeen4xsfSH2MjgV+ s6Yp+I2EN8PXc4BNN9ilJpEKH5dCKEWZgfgzIRj3eDkdrAKi9SK0M8NULR/7C3DIhdgI CEvg== 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 a36si7184821edf.123.2019.09.10.09.37.47 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Sep 2019 09:37:47 -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]:42884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7j9G-0004aM-5j for patch@linaro.org; Tue, 10 Sep 2019 12:37:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53073) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7j7p-0004Uf-Rn for qemu-devel@nongnu.org; Tue, 10 Sep 2019 12:36:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7j7o-00020T-G4 for qemu-devel@nongnu.org; Tue, 10 Sep 2019 12:36:17 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:59679) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i7j7o-0001zK-6b for qemu-devel@nongnu.org; Tue, 10 Sep 2019 12:36:16 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M6lUk-1i3sIc16fW-008Mwl; Tue, 10 Sep 2019 18:36:12 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 10 Sep 2019 18:35:51 +0200 Message-Id: <20190910163600.19971-7-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190910163600.19971-1-laurent@vivier.eu> References: <20190910163600.19971-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:ELE3NguVAMW9oC7+Roai81gb83Tae7RgDGcbFSQPSxhXLlnKWiF WJYSH1vNO7P7AD1L/ej5Jai0Znd3mJrGMUGHcRmI5EC+C6MnmFuf+I4u7Sa7iRkvu3Ql/vW ++AnuhJL9FCbNXpSg2SuxNTqmcVbirTbIGtdAd9493Q/mYTawHfBVxQK2pZhsefvaIPiTAP 9OtOnl6sEZNxnPPmXJ5Ug== X-UI-Out-Filterresults: notjunk:1; V03:K0:I2jXH4wke7Q=:D+Mo61yGKXvn+FjM5shYRv uYp3Z7bmk4LU0+Yc6qDieIL4yEcMFBDdknmnheWENIbsOc+UKHEneZitCTs9w7j14mnGL1ua2 hLIHnsbxdTMtBX8F/ssDbGll49i5jGVhYLmVtGtJqx/FiVdKwYsHsh4PzPT2edLx0LaXjTEFy o8ATeQQdMJRuzGpHrCDM5myCy6nuKkjIMWt9aOOKyWnBctExqGawWOajNSSvFr4IEn938r2gO PR1ghDv7idn0UBtKXggB/JZBkgIP+T9fWEl9UF95fqwbGLVkJ+pcbBCCv9VF3nA2UyppXYthJ 0TjQq4KKm+qt/lujMI25WbXUGPzs6cha39vVkMMFNi1AA1ROHOvg0TNYO5obPvjz9/X9Q/ojx Z+f2srms0TUBAlXcrQB0t8SRwb7hoXquxmlwgzkBYT0u9LE7oc+wMba58bDX+w90dVX672zER IWU+ma+cPAdUHzyy9BNINDd6E7Qvlr6ekGbCGbvwY+SBbv0+SI2W9SQL6mVNIyxdaSzdnTc32 Ytrg2JN+6jEg/Bi/pLgbEXiT6J01Ue1Z5LUFrZlDwdWnNUgsCa9qDzsN9nhHGH6GIhLdn//CO e/Xr5Gm5GDzgY31FI2YCLcTfMMB3Ut2uKHLx+W3uS0ZWKCM9BrRelDS4lgfFmhBP7cKvBs9NM Stuu2Sfts3LNH9PdRbkOhbvnsPvlogYzhUW/8P2LIP1RW4Ljn02ttYACGX6VmSTo5O2ZCJ5gE zp8bctkOJv6JQXna7zZEridIldTFZFQ7KP15KdAbP9p/NFqg0RW57xmIPdWjGhHn+ezo+BuU6 NpQqFaSNFSZnFN+QwU1VMrntCmMs6GKsTHRvkIml8/5rgopJaY= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.131 Subject: [Qemu-devel] [PULL 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 Tue Sep 10 16:35:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 173541 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp6043820ilq; Tue, 10 Sep 2019 09:44:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMAe08RDCivWN4mPZmCHd9xQ3BOBKDCwIKIb38DClcSthN7PvGiJ76qQjg6B1h2HMnRC0U X-Received: by 2002:ac8:342a:: with SMTP id u39mr30416576qtb.7.1568133841210; Tue, 10 Sep 2019 09:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568133841; cv=none; d=google.com; s=arc-20160816; b=WYtHR4atQCK8D669Zy5JO65GBhU7t3Rgr498uRznHC3FmI6F5WTnzGTsdF0K4sOgca 3GCvlt0CTpwSyy9YiMjEJrqp20O4doLk08iCL49d7+6/vu37XDhpROnikgJeNHlc6e6F XHrpXvFcfRV7/8iKp5fBmEQU7HB+2pdn5mmNYhB6GnpniOAkypl4XH8HSg7Rs9B4uUli av9Ptz0b+Kk0D3c7d3rc+AtaqjNATna5mX6zzZ50c+dS6E2AAVxsp6iRrMBSnhyom+eJ HPUBtdVQP00PsbKxgXjnKgrZtJCYzcjs9TdOS9SNRrvs0zclSxJaBvgBc4mPDFWZVJml Wqpw== 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=JoTMFd/dXA9rgEWEOP8m/L26vFAPHf0wqfDyhRFV9IFbsX4W3uXxuf6KtiUJEYNmcU B0Su7vwh34tIv0xVM+VICGaGXnrpJJtv4G5XdQVeWKVY+8H9NJPXypnkestWbCf84nlN h6lWcNR6WOaaAcKKYPLfnTV8USP10mzqTld6pMX/W93iav3O23MGjvg7qK5TYGJanF0Q QZPbUmc2IpyKbN3rH5QQtPsZJr1q15PVbMVBTViSRa1DTJ6fnKI1AJUhVIllou12sbB6 1D5pAiQfG9NzLPjXkDK8FTDzarYWo+V26JouHNMoED4ZaZ3RBqbDL5nk/8R7sYuK94sA N+zw== 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 l2si13926851qvc.152.2019.09.10.09.44.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Sep 2019 09:44:01 -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]:43122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7jFH-0003QD-Qx for patch@linaro.org; Tue, 10 Sep 2019 12:43:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53089) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7j7q-0004VY-Go for qemu-devel@nongnu.org; Tue, 10 Sep 2019 12:36:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7j7p-000214-FZ for qemu-devel@nongnu.org; Tue, 10 Sep 2019 12:36:18 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:54549) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i7j7p-0001zX-6l for qemu-devel@nongnu.org; Tue, 10 Sep 2019 12:36:17 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MYehP-1hc3TT3cWp-00VeZS; Tue, 10 Sep 2019 18:36:13 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 10 Sep 2019 18:35:52 +0200 Message-Id: <20190910163600.19971-8-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190910163600.19971-1-laurent@vivier.eu> References: <20190910163600.19971-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:NrnoZuyyvRcyXw1YmJnEBT5z5hd9yw8C+ku7f8wk+z9qKrAlHck uCVbZz7r6GrkavrDF4ketOG9NLa70mg8LNA6VvR1+h8inYuG+LSc+5AOimViH1QqOAc1zu6 QvfleKpfOoVL3VIuK/P15SXBUkgd/bBuEVNWkTgH1GJjbC02C/rKSVKN1QVq9CUKNH9rdbl NuUOiF2kSSPo8ZJv01eSw== X-UI-Out-Filterresults: notjunk:1; V03:K0:INcU2wQI8OU=:Ff0ZBHMdaNTC0/POC9Fpdm QntY9sG9OO+S9w0NXg+kBTPA5kZp/Qmt9sBdUysiKhamNP2zoY78Pcez4Nujqt/9qBHtZ1xoS L2t4eC57uH8k/6EBi2+l6L3en6rr9VKJnKOVNiPN5Yu8RTpLdBesaRBuYYnlj2Pdn4VJQG7Xq 3gLZ5s19Rza3BJcHTLbhq+L2A7msjhNezC3C7VooNTxZbCSH/rjawtdUSDeHe7hlynntnQMWx 3F9SVuNzAAb5YGc+Ir79CSMpwXnCC5NVvqATn1WsNuzSZBYI23BkkCIY/vyvLX8YKvFdJu8oc UwmlkstbMt5P8ecUPJJpWl5pqnVV3sERYHj2E5f4Ph1kgk0AwBZS6zYsBE4KRzCRm5qkRFMhy C9FANKi0SpPDEcLP6XbBcL126EzBHXsa6bm8C0PLMjHnph81Eqa9UQIup2f/CAWfi7mpjEyxX fbS3go4CA/NyVpRsmdvcldEnH7uAwoqqekXyRX0yoTDG+YJ5Zf1Iz9GZQdvo3uyxOrycG4nat Z1NZvseb2dfsanDIsMoaq+ZzLfKCRXfyH0fnuw5I0T/1fxiDJb21PV6u1qx2fiDhnz4oF001r rnXW1E+tzKasdhoPPNrbogoT3M0HHo0NHhc4NqtR3FSLDG9GlukaS7giO5NdBdk09jsfs135U 4S6Eiv0ylbkNweq/EFfVXMnUIJAA5hXDnTDj8EQgZNdqdPEkBkEjUyacdCUIL1DwEZEJmUiDA PPHt6nMbveX0MwJIio+T3nzV2/+Bk0h/Y4176HgLcAypWPldwdAD6i39cu0xZdvoYL5GzEAPy IvuBGfFp1iL1RKAUErHEqb8JpLPwSbRwpe7EgDSEB/mPcItlZ8= 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 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) {