From patchwork Tue Apr 4 15:52:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 670050 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp2520828wrt; Tue, 4 Apr 2023 08:53:18 -0700 (PDT) X-Google-Smtp-Source: AKy350ZY/azJjXsLQuakJC88SzxRSbqVLEB7OZx4vNyqIo5ViP7C707SviLjOoG87VFwoAv43KGx X-Received: by 2002:ac8:58ca:0:b0:3e4:f04b:dc5c with SMTP id u10-20020ac858ca000000b003e4f04bdc5cmr4590883qta.41.1680623598788; Tue, 04 Apr 2023 08:53:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680623598; cv=none; d=google.com; s=arc-20160816; b=Yie8Wpqf1ud425WQRNhfI4aQVY6KVO4RGXnAaO6+s4rep3Yvn0qx4Jrw6hWxKUXO+5 iy7cptSKX4BNyZ7KRzCk/G73ScFL4oFLNxqPRyLqbrcLBNfmS935Z2xNq6ePc6FqG7Og hHb9q6nUI60vTEGS1naWBIWKjR+er5RyqSQbDF7Qo3+eNMPBcD18asegzTtUx6vssbE4 N8+lGJCYhtpoiQST31/j1Mhg6YEVmbRcQI+4r3GnexCBiYXYqpqKFrNht6AIRlooTzJ0 mGTuCI8pu1YJcG+GtIpOJecHwbggQ/D/kztf5C/6yo+VA/T+W/zI953KgYMi9aFfvjWb rhHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZDfd7ct7wzbilubUOyiCb11C3SBKGvBqjiC3GyKJqDQ=; b=VJppQ+Q2xara072FM7NhziJ99CnWjpibwdKlZAkc1T0AgbKFMNSeSEkRpDKpeNpt9Z GT9Ucdcf77c0bffgGgzFpODUUMMe2YCu47bU5gXk6gdF1go9jWg/wCFY5f6kA+QdxYR0 dqDDgup8UB1Okbjn2w9WCVJB9o5PUXgM1fP89Fpdyf/N2NFfBKNANZxR8lQBlZhuj85C Q1CNipDmP/utK+7UsMFCtcPFjhpsYyciHgkomppPkm7NrioBj5uyOyrAZA6g9ViBlD7I gpttSdoBF5WmY/QsKRkIjon/I47ORgJDYkG9hme4mY/odRZqk4PExfpImj/GtrUYY1pY EvRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dWt3W6Dn; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c1-20020a05620a268100b00747a2434dc2si7313241qkp.782.2023.04.04.08.53.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Apr 2023 08:53:18 -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; dkim=pass header.i=@linaro.org header.s=google header.b=dWt3W6Dn; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pjixQ-0006yE-6k; Tue, 04 Apr 2023 11:52:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pjixO-0006vA-Bi for qemu-devel@nongnu.org; Tue, 04 Apr 2023 11:52:26 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pjixM-0004uu-LD for qemu-devel@nongnu.org; Tue, 04 Apr 2023 11:52:26 -0400 Received: by mail-pl1-x62a.google.com with SMTP id c18so31693792ple.11 for ; Tue, 04 Apr 2023 08:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680623543; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZDfd7ct7wzbilubUOyiCb11C3SBKGvBqjiC3GyKJqDQ=; b=dWt3W6DngnlilRvCb2mSTe/G1dSM9sYrKAy4oRRQhiFU0qcO9ETq63DXVE38RrqAZd ZvKs2F66d3Ig/6JeVntGqlvY68cW5muWC+yMmvzwn6xXw6bKl7byAEa3zvEFYBSeOeq0 Ivc53INaiZN0/yjbCLSxyjYcQhf0Unk5vRpOEx5JuRHYKoCMRywGnDtTzvrYWBGzx7wG fV83I+kAVZ/O5tFcglz74eUVnmTCu5/q77B92kCgZ15FqSYk21K5iqgaQexL+9ES43kw rLINDoIz9UQA0pLVAf4sLpUV34hx7OtFcahZpTGg8hr+4xGLxoLjA2Q8wyX7nwfJJ8wp e1Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680623543; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZDfd7ct7wzbilubUOyiCb11C3SBKGvBqjiC3GyKJqDQ=; b=BzUGMkPi6H7RomZ7Tlr8zqezD/EysZEzgirrcf5REELBPmfeIVSKuMq0rgFlI+KRtp VGm9ifaADvv8KRR4TzE+QMFy6FF+0faPwRjyDu/MzXlY1Ean/z8rDUAujWX+kst+7CTw yl3IepLPpZYHUvRUtcz0TbOXNO/Svqs6x/bU2Rp+dCcCzqwdAIUy5Jvj+tXQ4NkVMxY8 lWICrriCElS4mWg/RX0rL5I8elIbtHwFsxi86NFD9NB8SnjBpJnBfGwMY7NMdvMNDpIJ pNuzbChA6JWZoLXW+hsui3yHBHcVxbZ6oY69/Yb9fZ2q/m2j2j5CSsLIxZOcr0Z+OpXG /qBw== X-Gm-Message-State: AAQBX9ewPl7iQdLFbbdy6+/6gntpXRDdkpiucDr1fUI9wlpXpxW+5Jz/ kKzMJPuVFj3gX/TfvmfLCnmdxhF/07K/d9V1aWc= X-Received: by 2002:a17:90b:1647:b0:237:50b6:7835 with SMTP id il7-20020a17090b164700b0023750b67835mr3288422pjb.20.1680623542822; Tue, 04 Apr 2023 08:52:22 -0700 (PDT) Received: from stoup.. ([2602:ae:1541:f901:1d41:7730:d7dd:6f41]) by smtp.gmail.com with ESMTPSA id nl5-20020a17090b384500b00233ccd04a15sm11562013pjb.24.2023.04.04.08.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 08:52:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 1/4] Revert "linux-user/arm: Take more care allocating commpage" Date: Tue, 4 Apr 2023 08:52:17 -0700 Message-Id: <20230404155220.1572650-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230404155220.1572650-1-richard.henderson@linaro.org> References: <20230404155220.1572650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This reverts commit 4f5c67f8df7f26e559509c68c45e652709edd23f. This exposes bugs in target_mmap et al with respect to overflow with the final page of the guest address space. To be fixed in the next development cycle. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/elfload.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index b96b3e566b..f1370a7a8b 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -423,32 +423,12 @@ enum { static bool init_guest_commpage(void) { - ARMCPU *cpu = ARM_CPU(thread_cpu); - abi_ptr want = HI_COMMPAGE & TARGET_PAGE_MASK; - abi_ptr addr; + abi_ptr commpage = HI_COMMPAGE & -qemu_host_page_size; + void *want = g2h_untagged(commpage); + void *addr = mmap(want, qemu_host_page_size, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0); - /* - * M-profile allocates maximum of 2GB address space, so can never - * allocate the commpage. Skip it. - */ - if (arm_feature(&cpu->env, ARM_FEATURE_M)) { - return true; - } - - /* - * If reserved_va does not cover the commpage, we get an assert - * in page_set_flags. Produce an intelligent error instead. - */ - if (reserved_va != 0 && want + TARGET_PAGE_SIZE - 1 > reserved_va) { - error_report("Allocating guest commpage: -R 0x%" PRIx64 " too small", - (uint64_t)reserved_va + 1); - exit(EXIT_FAILURE); - } - - addr = target_mmap(want, TARGET_PAGE_SIZE, PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0); - - if (addr == -1) { + if (addr == MAP_FAILED) { perror("Allocating guest commpage"); exit(EXIT_FAILURE); } @@ -457,12 +437,15 @@ static bool init_guest_commpage(void) } /* Set kernel helper versions; rest of page is 0. */ - put_user_u32(5, 0xffff0ffcu); + __put_user(5, (uint32_t *)g2h_untagged(0xffff0ffcu)); - if (target_mprotect(addr, qemu_host_page_size, PROT_READ | PROT_EXEC)) { + if (mprotect(addr, qemu_host_page_size, PROT_READ)) { perror("Protecting guest commpage"); exit(EXIT_FAILURE); } + + page_set_flags(commpage, commpage | ~qemu_host_page_mask, + PAGE_READ | PAGE_EXEC | PAGE_VALID); return true; } From patchwork Tue Apr 4 15:52:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 670047 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp2520668wrt; Tue, 4 Apr 2023 08:53:01 -0700 (PDT) X-Google-Smtp-Source: AKy350aHTUmo1yysXf8Cz9RxRR3ROYS+4ohfe9NmyKQSdf1nGkGkEu5GxLe0OKze/Li9/w4ypAmw X-Received: by 2002:a05:622a:198f:b0:3b9:b70c:9697 with SMTP id u15-20020a05622a198f00b003b9b70c9697mr4382195qtc.5.1680623581072; Tue, 04 Apr 2023 08:53:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680623581; cv=none; d=google.com; s=arc-20160816; b=HW8X4nxy0fnxlBHjO4QhHo2/+qqzxl6i8f6NhuFtvi9eYgcz4WWpIGtQ+swBWFvrQr 5XM00ZIImtMipUNXPeIFf7E96nMpt5BA2/5AN0Fno6kZeaptivvotPZTwfTdjySAC+lT grUjt+nD+P7R7NGc0c8f4zBg/6ZgK1pGu3aPW8t831Em21Y9i8fSY1geEofJIvy6gBLl DIESen7P/k0Zc8dW2WlNb7jBNoHaviUkauMnrRpSGRCI16tsWo3ZXvU3vPdqrnvyjQwQ PZiNc09i0mp4czXf38+v+GEG5VqgyeH67Lnde4Ht9gpZyBPBghjXMAvh7n1f8ZN7W0q6 mD4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d+WZ/JeLd2TCORRW5pywaUIN6+48/A6dV/BPHE6Q81A=; b=H42/9EcWYJ2nsXB0MqAe9h+JSae8FudO9s+DCL32riqJzxWXaiq6RWr5PMmvWwAB6t xnOFCCF4QshwLP7fwllepqk7hcC6nbg13+ha0Rxkpdjiwtfjo0igIgr/c6GuNJeh8qQQ voViK8pxPvxsMUFKmtOM6BaDMjxe0ekH0xXbm4B/jceL49w18QgGqKlNyqqgoQ59LVcg cyTlUa96vY5OB5CgMumuMG5ovk7jdp9CqTg35B6epQcz2BoBKU6+cKHFqJoAEgf29Wgv BxYD7p3eNk4jE08EUqQefxZgIQoR5hzdGYgTPZmPzQQ+aUccTQDjrrxVmq9stZ+9UH2v pqwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vAOqESGy; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bp41-20020a05622a1ba900b003e6460973a5si6542584qtb.733.2023.04.04.08.53.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Apr 2023 08:53: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; dkim=pass header.i=@linaro.org header.s=google header.b=vAOqESGy; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pjixW-0007JH-CY; Tue, 04 Apr 2023 11:52:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pjixO-0006x0-Te for qemu-devel@nongnu.org; Tue, 04 Apr 2023 11:52:26 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pjixN-0004uz-9l for qemu-devel@nongnu.org; Tue, 04 Apr 2023 11:52:26 -0400 Received: by mail-pj1-x102a.google.com with SMTP id lr16-20020a17090b4b9000b0023f187954acso34412612pjb.2 for ; Tue, 04 Apr 2023 08:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680623544; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=d+WZ/JeLd2TCORRW5pywaUIN6+48/A6dV/BPHE6Q81A=; b=vAOqESGyqSb9Oz923Ox8+oDJXp4cheQBEX2f/gtiyfJeew0KTfqfNhqe+VPdO2goLG zbmE6SHLdxmG73liTort4X1KCIq7F2lkcYKy6+eO00ytW8H13yEgADKHfzs1QqMgpCDY 346UNhC9nf+EgEtCXt1Wi8X4WrLEw7/pN3ph3CpmGsBvacmZm2dumM0TCuW3fxFdoO+P WA8ULvH5BjIkAjJvgKynBh+9c7ztuuPtjYqBtwasToBn/HGhC304RVKWYAnClQLp/aDN ckis4w5A8kL9oGAXGUVFsXdEPkxywQcl7GgrelSr4gR+rG9i0+nBr5GZMm3gSxhpSIPu yWxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680623544; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d+WZ/JeLd2TCORRW5pywaUIN6+48/A6dV/BPHE6Q81A=; b=u20MVjDctMy2Ib9vk6rDHHy51ypDjIe7g/NRIxwZ0+ft8eZOkVm5/u7bK25VQbNmPu Q43pdOhYWKlnA2lRSvT58QPOitmZP1Y6+dNvlFX+dav1CklA9WPjIm9GSiC8kr1fPTWh xYJKq+ddpnc3lQMXnksW3ZonO8twTyiBdn2CVUSJaPXB6voIWxXle783RA0znf1oNvmw mYk5mKmpVRnaehY29LjArsHNWeUc7pZppIiCtwIk6WnHtku4dFDYCX6AcQ5cJl6qbs1j ZaU2+7l9zIXcckE4JyNJ2uxLi7dF2nmpUhuHtvw9H7dfnEN9hcAPfzOmP1m9onGSTqJQ pZZA== X-Gm-Message-State: AAQBX9fa3UvcJ2EkJl/ja54H3At4ZXQSbr4dT8Y29i09hsDDSPKqea9/ DaKIWuTexc6smUZcGZ85iRQuIZzXlj2LGjrLEtE= X-Received: by 2002:a17:90b:1e0b:b0:23b:45be:a15a with SMTP id pg11-20020a17090b1e0b00b0023b45bea15amr3116757pjb.25.1680623543826; Tue, 04 Apr 2023 08:52:23 -0700 (PDT) Received: from stoup.. ([2602:ae:1541:f901:1d41:7730:d7dd:6f41]) by smtp.gmail.com with ESMTPSA id nl5-20020a17090b384500b00233ccd04a15sm11562013pjb.24.2023.04.04.08.52.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 08:52:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Weiwei Li , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= , Junqiang Wang Subject: [PULL 2/4] accel/tcg: Fix overwrite problems of tcg_cflags Date: Tue, 4 Apr 2023 08:52:18 -0700 Message-Id: <20230404155220.1572650-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230404155220.1572650-1-richard.henderson@linaro.org> References: <20230404155220.1572650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Weiwei Li CPUs often set CF_PCREL in tcg_cflags before qemu_init_vcpu(), in which tcg_cflags will be overwrited by tcg_cpu_init_cflags(). Fixes: 4be790263ffc ("accel/tcg: Replace `TARGET_TB_PCREL` with `CF_PCREL`") Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Message-Id: <20230331150609.114401-6-liweiwei@iscas.ac.cn> Signed-off-by: Richard Henderson --- accel/tcg/tcg-accel-ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index af35e0d092..58c8e64096 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -59,7 +59,7 @@ void tcg_cpu_init_cflags(CPUState *cpu, bool parallel) cflags |= parallel ? CF_PARALLEL : 0; cflags |= icount_enabled() ? CF_USE_ICOUNT : 0; - cpu->tcg_cflags = cflags; + cpu->tcg_cflags |= cflags; } void tcg_cpus_destroy(CPUState *cpu) From patchwork Tue Apr 4 15:52:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 670046 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp2520494wrt; Tue, 4 Apr 2023 08:52:37 -0700 (PDT) X-Google-Smtp-Source: AKy350ZOKfl7ktalxgeJx9aeMQ4gB9c56C4Ipu52hKbMarbK2dvS1w3imw5cZElytVidyPMhxfUu X-Received: by 2002:a05:622a:1999:b0:3d6:43fc:2a52 with SMTP id u25-20020a05622a199900b003d643fc2a52mr4426434qtc.42.1680623556881; Tue, 04 Apr 2023 08:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680623556; cv=none; d=google.com; s=arc-20160816; b=JVfGsfH5uMZABJQo87bTXqjtCsgPCaOU5b5qHNSV/rj/4pZEK/0vH86ah32YXoqvel L+zizvTN1Ag5AaDZo6jY9w6rJ34NeKTflTX6F1CsHQcRYRDjmSBij8BOqEQ9Y8DpAP3F cqd5Uexh6/Mon5qkWnu8IQ4U+bgefPRixYV8ZXZk0vu2SkuDvnPgK/zNLIHtfppigU24 F/ABP6VMYUeoKdT1FpAEwK4sUrskGJs/LAUETMsAWd/5E1NTi6F9nbhq93//EB7ShsE+ dCeAwnWgNNFHS3sFd3Q0Qj2FhSGpFDWgT2MbOG7OvKj/OCccNVPzcQrAr5WEpkLy1lEw 1p8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9R9GD6a5x0X5fiS0AURv/OzVq7uoVBoB3Uzt4Bd3ql4=; b=eaOXrYabfm//OnNlm6diuVfBtUGdRfsEICh2Armq6HcJ6LPNzQc7kdiiAWeXOatYlE HHw4/M5fWAkgbznIKdUPkAuPvdiiRwo3NaVvSFMG6prGpxry6ze9EAgOZBdPePhVDnWO PRDqQevTBfMHQpXYhVOv7z4Brmwe0R5eoBrMDQMW0FQzgYaAOjwUSKJmdjvL6+BwNkE+ sX3/lt4WPATUWUwT2xXHLYhzYVXt7C8U4w6lM0VtnZFYNJvlRj0gXqjI6z0LCPDQkAYO D1s3Gl3/y2YBPWjYoCZVXqOEoEQSZ220bVUXAoxTiC1cSYcarcqZz8CgNZqyLoi1yd2v jBWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vaFmB4pI; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w24-20020a05620a0e9800b0071ba5a5d06esi8028598qkm.451.2023.04.04.08.52.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Apr 2023 08:52:36 -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; dkim=pass header.i=@linaro.org header.s=google header.b=vaFmB4pI; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pjixS-00074q-Fz; Tue, 04 Apr 2023 11:52:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pjixP-0006y0-L7 for qemu-devel@nongnu.org; Tue, 04 Apr 2023 11:52:28 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pjixO-0004vC-1V for qemu-devel@nongnu.org; Tue, 04 Apr 2023 11:52:27 -0400 Received: by mail-pj1-x102f.google.com with SMTP id fy10-20020a17090b020a00b0023b4bcf0727so34438782pjb.0 for ; Tue, 04 Apr 2023 08:52:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680623544; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9R9GD6a5x0X5fiS0AURv/OzVq7uoVBoB3Uzt4Bd3ql4=; b=vaFmB4pI4RYzmPInFTyXNrF+lN3ZDl5LPHXVm8Kw6qJ8Jc+O4tkio0h/1Sq5alpkAD Kv7qohpQiOirSR38gsoh+5+1seWeTtdqUhO7Y3AWiABn7s2p1uFKG0XIbaOkCoVd7h7Z taR99dmyTIwfSd5hFoRHjfT+tHvO7iGzzBgWz+3eLgnVQd+/4Dj4YLMzO2uNXGH8bxoD TUHpc2psVUosnjYGE+Y76srWxptMgaFA84ryPaElBzP86tPdEhGxhQfgXAt6HuBpvTta hVEtMKHHpbg69bINzBwJWh8Bkq/kVscsITEHZSxRI8EEbUo17rumkaPeCh12acCt0Z8L bJCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680623544; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9R9GD6a5x0X5fiS0AURv/OzVq7uoVBoB3Uzt4Bd3ql4=; b=TC+OkdZZDE3vN7q1HeseSQOE1Auf2Owtm8wgy4IM0Xtfb2OqP4LGJAnkX6d/snAYce iyKjlYJ0Qf/ty38YrAZHljrtgJsW7/TTOkvKRpMAApa28fWExKxJ8tez4K+gkDqe/8u9 aW0jOBjxWqlGx/ozIDmGEGBrxOHpGJFow3AY8SBhb78CXTwiQSNh4Ec3iE5UCMut5p6X ZKAJhoQPN5x+/vBFhS/nUOw3ZrYDj2uMdUZGFsOZd8FSrAC8zNJWZtwIvYvXehDwQHVW GiPPL2ZIimPcqfXEV3UJCughIi5bLvg3m7z/B/oOy/3KrNOcK0lU9kMF8CDLSAaVsaTB vWaQ== X-Gm-Message-State: AAQBX9fQ5tl073fTYvdCnVPvqYzu7zOXhLwIFT1mOSc4HeNBUPfQ1DzU fXTBuXwyQHc0C0suJzS565U6Wq/JAoufWSU9MyU= X-Received: by 2002:a17:90b:4d0e:b0:23f:7464:ae55 with SMTP id mw14-20020a17090b4d0e00b0023f7464ae55mr3483187pjb.0.1680623544547; Tue, 04 Apr 2023 08:52:24 -0700 (PDT) Received: from stoup.. ([2602:ae:1541:f901:1d41:7730:d7dd:6f41]) by smtp.gmail.com with ESMTPSA id nl5-20020a17090b384500b00233ccd04a15sm11562013pjb.24.2023.04.04.08.52.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 08:52:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Weiwei Li Subject: [PULL 3/4] accel/tcg: Fix jump cache set in cpu_exec_loop Date: Tue, 4 Apr 2023 08:52:19 -0700 Message-Id: <20230404155220.1572650-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230404155220.1572650-1-richard.henderson@linaro.org> References: <20230404155220.1572650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Assign pc and use store_release to assign tb. Fixes: 2dd5b7a1b91 ("accel/tcg: Move jmp-cache `CF_PCREL` checks to caller") Reported-by: Weiwei Li Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index c815f2dbfd..8370c92c05 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -257,7 +257,7 @@ static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc, if (cflags & CF_PCREL) { /* Use acquire to ensure current load of pc from jc. */ - tb = qatomic_load_acquire(&jc->array[hash].tb); + tb = qatomic_load_acquire(&jc->array[hash].tb); if (likely(tb && jc->array[hash].pc == pc && @@ -272,7 +272,7 @@ static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc, return NULL; } jc->array[hash].pc = pc; - /* Use store_release on tb to ensure pc is written first. */ + /* Ensure pc is written first. */ qatomic_store_release(&jc->array[hash].tb, tb); } else { /* Use rcu_read to ensure current load of pc from *tb. */ @@ -971,18 +971,27 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc) tb = tb_lookup(cpu, pc, cs_base, flags, cflags); if (tb == NULL) { + CPUJumpCache *jc; uint32_t h; mmap_lock(); tb = tb_gen_code(cpu, pc, cs_base, flags, cflags); mmap_unlock(); + /* * We add the TB in the virtual pc hash table * for the fast lookup */ h = tb_jmp_cache_hash_func(pc); - /* Use the pc value already stored in tb->pc. */ - qatomic_set(&cpu->tb_jmp_cache->array[h].tb, tb); + jc = cpu->tb_jmp_cache; + if (cflags & CF_PCREL) { + jc->array[h].pc = pc; + /* Ensure pc is written first. */ + qatomic_store_release(&jc->array[h].tb, tb); + } else { + /* Use the pc value already stored in tb->pc. */ + qatomic_set(&jc->array[h].tb, tb); + } } #ifndef CONFIG_USER_ONLY From patchwork Tue Apr 4 15:52:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 670048 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp2520700wrt; Tue, 4 Apr 2023 08:53:06 -0700 (PDT) X-Google-Smtp-Source: AKy350aeDScyAzBn82AsTfLAUqYh0DQnnSvljDMgjYQffy7YdWoQbZyjgA7qoVRs6MX4/+C1Rct2 X-Received: by 2002:ac8:57cc:0:b0:3e2:4280:bc56 with SMTP id w12-20020ac857cc000000b003e24280bc56mr3453348qta.41.1680623586194; Tue, 04 Apr 2023 08:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680623586; cv=none; d=google.com; s=arc-20160816; b=q8ceov1OjH/Z3vVfFJJqUsfXa7mgrAL0u8fFTatQSPhspg5lzDz2e+QWPOFJRSwqAh YGwXzyHszCfy8G7szSewJGn29vxtRO19j3GtBL8SE/ilXdYK5bylSgxDbIBsDsx88XCo VNXRc8PThpA9YIG0jcnf3yCHbBpj5k2R5Ccn+hHYGRzwXGE1S1PMr5iu4m3XaMDgZaXU o07HL4c6fzw9T8gvker2Pdm0fJfBb/Dirg8ORA40ud7X1fULE+so5zKhqu42xoeUMq/n 5Uy2RTZlPgdPUws0KwIaZFnGDyG8n3RGzXaxd8CuSgYH2/8rg1uGZvg3C9DTBQW/PSfb 0dNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1FfqWjRKCkyAB/lxL8k5+KsN14fs9T5Mf//4IwBSq1A=; b=X/xfOq924Mi6LxqdWM3HepMRlnjp+ya8hvOzKi/GA7Shw6Zr1gSxC77v/WH2mymgxG lPOaBd+FpWebr2X9CxCx6g4zZp5mPNhn9LtlqXZqC8BN/1duOGQbWzOD+/Z5ofcPBGVR I8T0HDqMOimIr+901MCWdna8t+zpOPmJYRp5t5mA/yKyoeApK6OEW0SkMsLX5ibPFaH6 mmA6dzI4fqGV4Zi4748NuGCnefhY3bFtK8uSKPF/ZrIpxfl0eFC2u4eKDdRQi3CadtT3 qelerpjaomLzArduqFBG7TVTTykO4zI82jA2mLKga1GGSb5BhCMkPq314i6gih5OoRaZ fBMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MEneH7qF; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w21-20020a05622a135500b003deeefeda66si8301400qtk.535.2023.04.04.08.53.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Apr 2023 08:53: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; dkim=pass header.i=@linaro.org header.s=google header.b=MEneH7qF; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pjixT-00078C-8q; Tue, 04 Apr 2023 11:52:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pjixQ-0006zT-UX for qemu-devel@nongnu.org; Tue, 04 Apr 2023 11:52:29 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pjixO-0004vL-LU for qemu-devel@nongnu.org; Tue, 04 Apr 2023 11:52:28 -0400 Received: by mail-pl1-x631.google.com with SMTP id le6so31691549plb.12 for ; Tue, 04 Apr 2023 08:52:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680623545; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1FfqWjRKCkyAB/lxL8k5+KsN14fs9T5Mf//4IwBSq1A=; b=MEneH7qFHc1kNUK51ifWTR7Uz6F65lBO4c/xrKj9r4D+sauYJB1tjOIl6lAJYc80qg UY4n/OVKceMfwzjPVDKlAvyB+ja8lZtctpRA+VZP7BKruaDj65XvtUaNZOaAIAtGjRyL f/oBUgRy86oa2kRuD/iC8nlSRY6KAMMbdSORXgEALgTYiDNc+aUJ3ThwoqtEpQ8l+h7g 9VJYZDxLJVwM9SnDnBgDB5PWCruRTYriBWCCFHtBKnx0o0mFWfqb7MZRcdqUSnzDHr/Z kupt5PH+cS2yQjLekh0x6sxt+w8cB6drcthyeX8rO5pDcMFegrByObhMZvrN7zK2l5up FGcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680623545; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1FfqWjRKCkyAB/lxL8k5+KsN14fs9T5Mf//4IwBSq1A=; b=lFY4VdRDTDoBGYnJpy0ddB7NN5um2EQYvL33Nch8ZMBTdJPbImFRBxFSbhs63Hxr/v udU+ARHShpw1j3pRcVvnFCmLaPAQPtgv1Bru+KmhzdO8q3lFw+28/S9Khw/6SMhT0vFV 6G6ogOWQmpZ8l+L1HhJMG2omvoI7ZTCOtbaVSoMpxgYRcU51W3HnaTjA7t+dQIlgfRqC 6o53XKqh8E1kFlbf9JfHOpMo7plSHmXD24pTsebK1bQaAxixjXRnQyJKJaJEylzX4xZR SZDfXXrE+ftJKnpsZZIWhUz4VlkxGMK7zc5TYLKdeTlkC5ioUiBGR6z6dRqk/jNB0czF IIwA== X-Gm-Message-State: AAQBX9c07bzUuMNBgCB6dyy+Fi0BMCJZOPNCRs0JIHn6tZBSXxQNlTAL nk3JdrcGPARFsUEM04GimHTJgSJV07X3mF0K/5A= X-Received: by 2002:a17:90a:bc85:b0:237:752f:1af0 with SMTP id x5-20020a17090abc8500b00237752f1af0mr3380674pjr.29.1680623545340; Tue, 04 Apr 2023 08:52:25 -0700 (PDT) Received: from stoup.. ([2602:ae:1541:f901:1d41:7730:d7dd:6f41]) by smtp.gmail.com with ESMTPSA id nl5-20020a17090b384500b00233ccd04a15sm11562013pjb.24.2023.04.04.08.52.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 08:52:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 4/4] tcg/sparc64: Disable direct linking for goto_tb Date: Tue, 4 Apr 2023 08:52:20 -0700 Message-Id: <20230404155220.1572650-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230404155220.1572650-1-richard.henderson@linaro.org> References: <20230404155220.1572650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Something is wrong with this code, and also wrong with gdb on the sparc systems to which I have access, so I cannot debug it either. Disable for now, so the release is not broken. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/sparc64/tcg-target.c.inc | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc index ccc4144f7c..694f2b9dd4 100644 --- a/tcg/sparc64/tcg-target.c.inc +++ b/tcg/sparc64/tcg-target.c.inc @@ -1445,12 +1445,12 @@ static void tcg_out_goto_tb(TCGContext *s, int which) { ptrdiff_t off = tcg_tbrel_diff(s, (void *)get_jmp_target_addr(s, which)); - /* Direct branch will be patched by tb_target_set_jmp_target. */ + /* Load link and indirect branch. */ set_jmp_insn_offset(s, which); - tcg_out32(s, CALL); - /* delay slot */ - tcg_debug_assert(check_fit_ptr(off, 13)); tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TB, TCG_REG_TB, off); + tcg_out_arithi(s, TCG_REG_G0, TCG_REG_TB, 0, JMPL); + /* delay slot */ + tcg_out_nop(s); set_jmp_reset_offset(s, which); /* @@ -1469,28 +1469,6 @@ static void tcg_out_goto_tb(TCGContext *s, int which) void tb_target_set_jmp_target(const TranslationBlock *tb, int n, uintptr_t jmp_rx, uintptr_t jmp_rw) { - uintptr_t addr = tb->jmp_target_addr[n]; - intptr_t br_disp = (intptr_t)(addr - jmp_rx) >> 2; - tcg_insn_unit insn; - - br_disp >>= 2; - if (check_fit_ptr(br_disp, 19)) { - /* ba,pt %icc, addr */ - insn = deposit32(INSN_OP(0) | INSN_OP2(1) | INSN_COND(COND_A) - | BPCC_ICC | BPCC_PT, 0, 19, br_disp); - } else if (check_fit_ptr(br_disp, 22)) { - /* ba addr */ - insn = deposit32(INSN_OP(0) | INSN_OP2(2) | INSN_COND(COND_A), - 0, 22, br_disp); - } else { - /* The code_gen_buffer can't be larger than 2GB. */ - tcg_debug_assert(check_fit_ptr(br_disp, 30)); - /* call addr */ - insn = deposit32(CALL, 0, 30, br_disp); - } - - qatomic_set((uint32_t *)jmp_rw, insn); - flush_idcache_range(jmp_rx, jmp_rw, 4); } static void tcg_out_op(TCGContext *s, TCGOpcode opc,