From patchwork Tue Aug 29 17:02:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 718233 Delivered-To: patch@linaro.org Received: by 2002:adf:d20a:0:b0:31d:da82:a3b4 with SMTP id j10csp91331wrh; Tue, 29 Aug 2023 10:03:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHlLu3/UnKHvIlggjhQXtgFEjk6WeUqcFyeemJsy04XLpAPJ6udC5G6L1uG5kYNNZS6LZhw X-Received: by 2002:a05:620a:12c3:b0:76f:338:27a2 with SMTP id e3-20020a05620a12c300b0076f033827a2mr10000405qkl.32.1693328599842; Tue, 29 Aug 2023 10:03:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693328599; cv=none; d=google.com; s=arc-20160816; b=Yeq29/D/l+IabzI+vYduG0E7y2DRo7b8UNJZkF7tIhJjD69TzxdXhm5buz4lN30MTz 4Ry7cVEcvrqQUdWz0eXV1ye+T3gm40QdTVPVYpn9a1SjiI0rwfOVcbH2E+xWd76bOrMb vtGV2g6TStUsr8lDIrOksINW4SdWcjxLe0yL02kYIqQv6H/cSchtQjgpEQnq6zmcWCBw rM6zx4AfHL1jzfBdA3oWiAWgUkF4PtgGWdxwYMA6noPR530XsLhqDocmu+VvipTz9al9 oqnmfya5u9LdzyDcTNYjm1u+VjaXwDhSYSHWowhAVqeXArBX3GSh7iK+hCKwd8mVAKoD R/bQ== 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=LGuoxVvMU6aem7Q6XdFNRJrRZCWqnrvT0uINgJVeIFY=; fh=eu2DY09p+eeddYDiV+DalJS3Vr0kxK5BujclYkgWvDw=; b=QnrxmU92gMsHZeEkHAnmV6nr411dlIcO/EX0lMM85aLS19lSWaYa/d6gOju01YPnp3 rUXYNyea0uaHcXqVCocvDpfj9MsBtIlYdMKoUGNyiAFWy0FX1G21PBTtXKrXp8OjzPZS VOaCgK8hP0YpVyqyvOUuP6l+DQO1If/0+0hllyYdNENv1PqTxO0kpVyRxHHVxk5ZWz5W ZAgPxpuSZQSmrercyrI4rp5wnuAfCnhi6RjmDlfg7Ew1PHDx8lQwWXNjhzIm0eIDKJIB Ncf76YyZ7axhzwDhdJ8Moh+PrULzHVKBy/zQG7IyX+CBBtlsqv2lgeIVoMzOMhI2eBgh 8fMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AMPFPl5a; 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 w7-20020a05622a134700b0041215aa1b15si5339058qtk.793.2023.08.29.10.03.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Aug 2023 10:03:19 -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=AMPFPl5a; 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 1qb27J-0002Zb-8S; Tue, 29 Aug 2023 13:03:01 -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 1qb278-0002Sx-2l for qemu-devel@nongnu.org; Tue, 29 Aug 2023 13:02:52 -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 1qb272-00051N-I1 for qemu-devel@nongnu.org; Tue, 29 Aug 2023 13:02:46 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1bdb7b0c8afso28366965ad.3 for ; Tue, 29 Aug 2023 10:02:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693328562; x=1693933362; 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=LGuoxVvMU6aem7Q6XdFNRJrRZCWqnrvT0uINgJVeIFY=; b=AMPFPl5aZoJvEyneJbMUO5oOVau75/4U7nXf+Z/UTSTYLn8WOBXz0/VsmI3YgpO7Hl pc5OEO5uyFbbruIJS9kQqCbVaMG5dSDMywG0W8SwhPezivuO1TLH2LWpFEs+2kigs3XG ABNxwLSm3omtqiISEUCzh3BGzz+uwH+MGqtNungd0YXNA2ebc3U5UzRrfTtGpWReif0h fEkS8ZGa3QawjS3VrvtDSxveqsDUDN5jhy4+kaFxUcUcHxrRlZ7MlSPUVISAVMK7X2WV qOnZW5ReHaISNs1cZOHlM3dHvWhs7f7Nm7pToubd1J0I1lutZvfNa/O124CJ9N7bsx/L ZClw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693328562; x=1693933362; 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=LGuoxVvMU6aem7Q6XdFNRJrRZCWqnrvT0uINgJVeIFY=; b=dNve8gWv4I1MCdq47xu3MadWjerKMUCvQ8uURIL4lsYvBUaOGFIgS9Yr1mnZBW4jaF S23zpzPoeVldIi6oDVrnnaFD1pWRxvP5aUDVhZcC9cBdiRJtdHgU1r37gRUvDG3AbyFg aP3bYxoee4Mw4qGVXAAqoVA6G9z3KC8Hk62R+W0gfzt24oWQG+jDdT9wJm+PRlIwLRlS XQ20k2M+7Bz1ndL//Prw4QwXl7iSlEiRokQP16s+Sd4LMb6UtoYSA5k/2iK3+XGV8h+b kvefIAgL4gXNfQKuMn4YRqsbfIMHFHOnna0VZFLO2IeyN78g1eU3+nKHVA9ahJZUutDp Cjgg== X-Gm-Message-State: AOJu0YycSKHVq6mpbXsDgtL4Y2p94QblPFMgnJJYqaY1pN+ceIDSMkgH 9MvVdZyUHi7KLAjnoxehjOdJkDvbRsuxZNDGL1k= X-Received: by 2002:a17:90a:cb02:b0:25e:d727:6fb4 with SMTP id z2-20020a17090acb0200b0025ed7276fb4mr23520014pjt.2.1693328562484; Tue, 29 Aug 2023 10:02:42 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id cv2-20020a17090afd0200b00267b7c5d232sm10989645pjb.48.2023.08.29.10.02.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Aug 2023 10:02:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 1/4] softmmu: Assert data in bounds in iotlb_to_section Date: Tue, 29 Aug 2023 10:02:37 -0700 Message-Id: <20230829170240.765996-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230829170240.765996-1-richard.henderson@linaro.org> References: <20230829170240.765996-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 Acked-by: Alex Bennée Suggested-by: Alex Bennée Signed-off-by: Richard Henderson --- softmmu/physmem.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/softmmu/physmem.c b/softmmu/physmem.c index 3df73542e1..7597dc1c39 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -2413,9 +2413,15 @@ MemoryRegionSection *iotlb_to_section(CPUState *cpu, int asidx = cpu_asidx_from_attrs(cpu, attrs); CPUAddressSpace *cpuas = &cpu->cpu_ases[asidx]; AddressSpaceDispatch *d = qatomic_rcu_read(&cpuas->memory_dispatch); - MemoryRegionSection *sections = d->map.sections; + int section_index = index & ~TARGET_PAGE_MASK; + MemoryRegionSection *ret; - return §ions[index & ~TARGET_PAGE_MASK]; + assert(section_index < d->map.sections_nb); + ret = d->map.sections + section_index; + assert(ret->mr); + assert(ret->mr->ops); + + return ret; } static void io_mem_init(void) From patchwork Tue Aug 29 17:02:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 718232 Delivered-To: patch@linaro.org Received: by 2002:adf:d20a:0:b0:31d:da82:a3b4 with SMTP id j10csp91315wrh; Tue, 29 Aug 2023 10:03:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHy7iQdHd0GM0TiTxXK7/+vTx/1bvfNDvOHHOTohPIsnlr8dbS19FsVwnJSiTp3pyAHB7EE X-Received: by 2002:a05:6870:42d0:b0:1c0:a784:cf7e with SMTP id z16-20020a05687042d000b001c0a784cf7emr17055605oah.51.1693328597790; Tue, 29 Aug 2023 10:03:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693328597; cv=none; d=google.com; s=arc-20160816; b=iwSllvsL+YEb/szBbbT4eflSBlJ05Z+XsV/2MyVNvSgg0WFrmHX1kSrrBEaxxU0lHz xdYJFWmyXm+r/NBAssSQLyBVl7Y5xsMiw6aVEueobi7BLMvfMvE6bZkLTiY+6ZBrgypq lo4O5Dbbnb9d9Qb57HPqUGz3NnOboBhKFTlY/rckR/fgeMMrEPJiSUBxtNykCVptzZs2 BGIY6N44H1SxvEg2HRYVoQ1LjG59+VXIqEeQrBjPpunmX4bGPj+3MMpibbym+4PfDBT4 HDSy/YYwNpn1Vzeqq3McEA6g3KmAnHS/RRaJFvncHVx04W5PcCnVo3BIP7F6EKXEfLPP tj7g== 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=fWjdOHprwcmj6rv2NjOsjHYB5i71/EZpwY5eum6Xvx8=; fh=eu2DY09p+eeddYDiV+DalJS3Vr0kxK5BujclYkgWvDw=; b=QsDKVs1vpkb87ERsAD10hbE9th9NVbGac0YqHFnQivJ2/t7tg7Ll15oy02oqIFW4Vs v3NrkJ+B+THiDFw3g+WR8LyfWe0BDhlzfnYOy3wiBnUUW7pc/nw/JUIMtCplvgLnRmdW 0cLZix286GvvS0lrxw0JmS2yL0BdY/XnK7ly9jOztOAu3jFgI0Ir1JJ1DrHSmCobH5Bl fKul3byoMDQY2z8F+xOLVOyO3Iq11mhCqBvwY9d4h2EUHZxNH2Gl1iBXRKRGAZ6IFz44 jF0q00RKMIr85vJpAkpYtcMJTz2H+aT24xwclIbIpxZqmkQqkGVd47bAXUWCUV/ejwZR aCGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mLdLTWTV; 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 om31-20020a0562143d9f00b0064f93383501si4173679qvb.52.2023.08.29.10.03.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Aug 2023 10:03:17 -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=mLdLTWTV; 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 1qb27J-0002Zi-7a; Tue, 29 Aug 2023 13:03:01 -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 1qb278-0002Sy-3R for qemu-devel@nongnu.org; Tue, 29 Aug 2023 13:02:52 -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 1qb273-00051l-0z for qemu-devel@nongnu.org; Tue, 29 Aug 2023 13:02:47 -0400 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-26d4e1ba2dbso2638070a91.1 for ; Tue, 29 Aug 2023 10:02:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693328563; x=1693933363; 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=fWjdOHprwcmj6rv2NjOsjHYB5i71/EZpwY5eum6Xvx8=; b=mLdLTWTVRb38qFnbXFDhp8W+DiVhbxemX2L+zdUU8UfWmTpola/h7DZ4VnJ4aNj/e3 pyCwlAwndHOQCAC07JVnJS10OZBg71z/WPiugkvCuwtNWcdVKi14y/kGs0o9Fx1/WUIm SueFsaeyS9ZLLqBN5kouqZBvypVDDE7VUxHhF9BSdIZMGZQnsQJIFZOZLVfVhRMNlu4D RO+/vU0JtfxFRnTezD9zliXmDWIAUMhscFja4nBj00jRbmf/NUB1JwVi9IyH1Y2O071h iXtPpAFcT2BZm7ZJ1SK/35hUBNXqXnqp0cvO2Vit2d+fTnXvyiDRHA/jcPe5lgMvOiSl r0yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693328563; x=1693933363; 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=fWjdOHprwcmj6rv2NjOsjHYB5i71/EZpwY5eum6Xvx8=; b=DFpSrjF8lv2AZQdiR+FIpOs7Okvwi67QmnaKBohmJi98w2krmfaxQk9IDe0QGVuIxB TJurt6oJVIWOebD9ChB0cReqrfu/LNfslswogApkmlJilfZ0jcS4yHf3BtEgYCieHLI9 5Dgn+mTL9dvJcwHOfyke9OjBuRTDFyQ8Jetyq6R0WosMqPrsFUTaqmCBzX82eNfC9Hpl ZS3TX8x4r34Qjr+82D8EzQDFqFY8GLv/sSJRbOTxThJACOaCF5x3TcAli1+rlYiIrWAO Z5XsIm3J/WA+Kjln36wasGX4JmZ4dcOs5LRm/bCr4EajO7sGlB/vvlmdffzBtXmbSHPy ILjQ== X-Gm-Message-State: AOJu0YySD5jg0EVUrd/rhqLQc6NL7Ond94OM4EzeZsCLq2tG/ecWCFh4 QwsWh0LgtPYPm3PqVd2dSsmzp3w4iYSS3K/C6DE= X-Received: by 2002:a17:90b:3753:b0:268:c5c7:f7f1 with SMTP id ne19-20020a17090b375300b00268c5c7f7f1mr21687533pjb.29.1693328563332; Tue, 29 Aug 2023 10:02:43 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id cv2-20020a17090afd0200b00267b7c5d232sm10989645pjb.48.2023.08.29.10.02.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Aug 2023 10:02:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 2/4] softmmu: Use async_run_on_cpu in tcg_commit Date: Tue, 29 Aug 2023 10:02:38 -0700 Message-Id: <20230829170240.765996-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230829170240.765996-1-richard.henderson@linaro.org> References: <20230829170240.765996-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 After system startup, run the update to memory_dispatch and the tlb_flush on the cpu. This eliminates a race, wherein a running cpu sees the memory_dispatch change but has not yet seen the tlb_flush. Since the update now happens on the cpu, we need not use qatomic_rcu_read to protect the read of memory_dispatch. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1826 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1834 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1846 Tested-by: Alex Bennée Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/exec/cpu-common.h | 1 - accel/tcg/cpu-exec-common.c | 30 ---------------------------- softmmu/physmem.c | 40 +++++++++++++++++++++++++++---------- 3 files changed, 29 insertions(+), 42 deletions(-) diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 87dc9a752c..41788c0bdd 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -133,7 +133,6 @@ static inline void cpu_physical_memory_write(hwaddr addr, { cpu_physical_memory_rw(addr, (void *)buf, len, true); } -void cpu_reloading_memory_map(void); void *cpu_physical_memory_map(hwaddr addr, hwaddr *plen, bool is_write); diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index 9a5fabf625..7e35d7f4b5 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -33,36 +33,6 @@ void cpu_loop_exit_noexc(CPUState *cpu) cpu_loop_exit(cpu); } -#if defined(CONFIG_SOFTMMU) -void cpu_reloading_memory_map(void) -{ - if (qemu_in_vcpu_thread() && current_cpu->running) { - /* The guest can in theory prolong the RCU critical section as long - * as it feels like. The major problem with this is that because it - * can do multiple reconfigurations of the memory map within the - * critical section, we could potentially accumulate an unbounded - * collection of memory data structures awaiting reclamation. - * - * Because the only thing we're currently protecting with RCU is the - * memory data structures, it's sufficient to break the critical section - * in this callback, which we know will get called every time the - * memory map is rearranged. - * - * (If we add anything else in the system that uses RCU to protect - * its data structures, we will need to implement some other mechanism - * to force TCG CPUs to exit the critical section, at which point this - * part of this callback might become unnecessary.) - * - * This pair matches cpu_exec's rcu_read_lock()/rcu_read_unlock(), which - * only protects cpu->as->dispatch. Since we know our caller is about - * to reload it, it's safe to split the critical section. - */ - rcu_read_unlock(); - rcu_read_lock(); - } -} -#endif - void cpu_loop_exit(CPUState *cpu) { /* Undo the setting in cpu_tb_exec. */ diff --git a/softmmu/physmem.c b/softmmu/physmem.c index 7597dc1c39..18277ddd67 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -680,8 +680,7 @@ address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr orig_addr, IOMMUTLBEntry iotlb; int iommu_idx; hwaddr addr = orig_addr; - AddressSpaceDispatch *d = - qatomic_rcu_read(&cpu->cpu_ases[asidx].memory_dispatch); + AddressSpaceDispatch *d = cpu->cpu_ases[asidx].memory_dispatch; for (;;) { section = address_space_translate_internal(d, addr, &addr, plen, false); @@ -2412,7 +2411,7 @@ MemoryRegionSection *iotlb_to_section(CPUState *cpu, { int asidx = cpu_asidx_from_attrs(cpu, attrs); CPUAddressSpace *cpuas = &cpu->cpu_ases[asidx]; - AddressSpaceDispatch *d = qatomic_rcu_read(&cpuas->memory_dispatch); + AddressSpaceDispatch *d = cpuas->memory_dispatch; int section_index = index & ~TARGET_PAGE_MASK; MemoryRegionSection *ret; @@ -2487,23 +2486,42 @@ static void tcg_log_global_after_sync(MemoryListener *listener) } } +static void tcg_commit_cpu(CPUState *cpu, run_on_cpu_data data) +{ + CPUAddressSpace *cpuas = data.host_ptr; + + cpuas->memory_dispatch = address_space_to_dispatch(cpuas->as); + tlb_flush(cpu); +} + static void tcg_commit(MemoryListener *listener) { CPUAddressSpace *cpuas; - AddressSpaceDispatch *d; + CPUState *cpu; assert(tcg_enabled()); /* since each CPU stores ram addresses in its TLB cache, we must reset the modified entries */ cpuas = container_of(listener, CPUAddressSpace, tcg_as_listener); - cpu_reloading_memory_map(); - /* The CPU and TLB are protected by the iothread lock. - * We reload the dispatch pointer now because cpu_reloading_memory_map() - * may have split the RCU critical section. + cpu = cpuas->cpu; + + /* + * Defer changes to as->memory_dispatch until the cpu is quiescent. + * Otherwise we race between (1) other cpu threads and (2) ongoing + * i/o for the current cpu thread, with data cached by mmu_lookup(). + * + * In addition, queueing the work function will kick the cpu back to + * the main loop, which will end the RCU critical section and reclaim + * the memory data structures. + * + * That said, the listener is also called during realize, before + * all of the tcg machinery for run-on is initialized: thus halt_cond. */ - d = address_space_to_dispatch(cpuas->as); - qatomic_rcu_set(&cpuas->memory_dispatch, d); - tlb_flush(cpuas->cpu); + if (cpu->halt_cond) { + async_run_on_cpu(cpu, tcg_commit_cpu, RUN_ON_CPU_HOST_PTR(cpuas)); + } else { + tcg_commit_cpu(cpu, RUN_ON_CPU_HOST_PTR(cpuas)); + } } static void memory_map_init(void) From patchwork Tue Aug 29 17:02:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 718234 Delivered-To: patch@linaro.org Received: by 2002:adf:d20a:0:b0:31d:da82:a3b4 with SMTP id j10csp91553wrh; Tue, 29 Aug 2023 10:03:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG5dVgV6FlLyWHnNfWW6tk6CkMlHqhI9/BaqV1GFLfgBGlRSD2akADV6FYaOqynO4pGtFKx X-Received: by 2002:ac8:7f41:0:b0:405:5ce9:6cf0 with SMTP id g1-20020ac87f41000000b004055ce96cf0mr32474996qtk.52.1693328618943; Tue, 29 Aug 2023 10:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693328618; cv=none; d=google.com; s=arc-20160816; b=gkA1Narv88MgvFcDb/C31ubX5f5e1Q4i1QTyqYvYGGQQrFqLECfaia5hSNL3nQnJIy R4mVfi6POyJJiQdvaQzUNriv0Rsc30aGT/UB5F1gK8gkJjdggXSKVMvavlHnN2YNZBWa xfzGyI40tVEvugoLgp0dq/RcRgZ3kudZUl7YJjIXxr9KPNxgp55RWZO6bDfUFhpbLNBS me39zYk4vF4kBdymavd2GbTgoC3IIWUP8dSRH9ukeSJWFWuvA+yy9/bGhB5k7lqWylyE K/vjllOO0m2ZI0jZHPGenBt5SsUdwsCLQ9wBPUKLG6wk9gDiMN5BjszLXYzZ8wCQRpcY c2sA== 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=ubwo0TEFtdkb/m6/OLcsmvm92SJ7iM0Jve66C5kvkAs=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=We2xGsEwiCzZE0xSc/nKJRUqcFC4qkwFfBfGK3l+wXGiKsQcVABlE35bt1PG+z9eLK 0ZWi1I9IWXskHibJIjif40/YnHnhTMy71MTXt+3cPSRDirdrGPKZoJ/xz4cKf/pEvDV3 3kALFm5Erk0DMrAgeanFqEFTzQXEs8rHYr0RNI9Ap/0Wy9Ho4qcKw0E01GN2iRGYtQPm zJke2QYsdqVtpQrF3XS37nzDVWIHZ/nQPzUjfIsQTrZe+Mn9tYAjRqFtB05Ix8g8aRF6 CibAIAAKqpKzydbGVy9WX/jRc6vE/3v2iIigUcGIFeIr4GJu06xh1E7LlaLaKX+w9+4W pXVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D0jHLErS; 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 e12-20020ac85dcc000000b0040fe32ab0b6si6364102qtx.286.2023.08.29.10.03.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Aug 2023 10:03:38 -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=D0jHLErS; 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 1qb27K-0002dS-Us; Tue, 29 Aug 2023 13:03:02 -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 1qb278-0002T0-4G for qemu-devel@nongnu.org; Tue, 29 Aug 2023 13:02:52 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qb273-00051r-KT for qemu-devel@nongnu.org; Tue, 29 Aug 2023 13:02:48 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-68a440a8a20so3985164b3a.3 for ; Tue, 29 Aug 2023 10:02:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693328564; x=1693933364; 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=ubwo0TEFtdkb/m6/OLcsmvm92SJ7iM0Jve66C5kvkAs=; b=D0jHLErSUKSOK/5+14eaeR1Ng8Tsp9HFtEd5jLGv8XGh+lhlUxZUpMTSR111pHOWgs +GfoUURNCGLE6yAm67WvXe7mHQdWg4PscdYwGcoe6r7x7ukM1ZPY+6Z/PUzZGrprwb8r wPS1Rhmn596CKb0jJck+rXONcOXHhgkkfhLKj6D5yI5RL196azPCYKkuZwM7iRI3NPb1 JX+yXB8KehqHIh4xZmFhoGkeQjhh1WkgdnygsFfjvPlrENZc5WrCShOWjX3U6x/GciyP 0jtsr8bTdAjpDrEXB5IrJyN5l95Xwypv5OZHsf6O4sQRRKuBuv9UA20gNGzGpnl4NJ3W aHzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693328564; x=1693933364; 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=ubwo0TEFtdkb/m6/OLcsmvm92SJ7iM0Jve66C5kvkAs=; b=N+lCysa3DnSmUMeM5DNP5Z1OUv7YgiKgLrwxnc7PsCho+rmWNHP3K80KDscu7g0rF8 NIMZO2YNTRvrwyuF/5Vps1bgNaCxRSLyBXVmC+2JNR3Kt5iJr4EbWkbreY17FQf5iuFk qBmNJDC1ehohnwTcDU/iXMA5I7v4iKtv+zpZHmUdBYr+ch9sHdTRfGO3fR+ie2wLTnve z1LKhJ3nJ7VyGsXAL+bvUow0swEUgNKGp1mkrDnWHNdF8qYgzSZiNkEXPDlUiphJY6nN 1pYExDP6AZU3lIvxfPoHAKZHlZ5+2zQcFqLcgWbZDKsjmG+BoHljjGRds1HvmrkakKmV 0B4g== X-Gm-Message-State: AOJu0Yz7ZmfPbMTeFfRv0CzZOo8cydwd3TFIP7xjRlWjb22VxoyZ7PeA h2ThwGj1v2i30cA093O3nZRyC1mMGBE5yfA/bqk= X-Received: by 2002:a17:90a:9ac:b0:268:60d9:92cc with SMTP id 41-20020a17090a09ac00b0026860d992ccmr27344337pjo.43.1693328564183; Tue, 29 Aug 2023 10:02:44 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id cv2-20020a17090afd0200b00267b7c5d232sm10989645pjb.48.2023.08.29.10.02.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Aug 2023 10:02:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 3/4] tcg: Remove vecop_list check from tcg_gen_not_vec Date: Tue, 29 Aug 2023 10:02:39 -0700 Message-Id: <20230829170240.765996-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230829170240.765996-1-richard.henderson@linaro.org> References: <20230829170240.765996-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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 The not pattern is always available via generic expansion. See debug block in tcg_can_emit_vecop_list. Fixes: 11978f6f58 ("tcg: Fix expansion of INDEX_op_not_vec") Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/tcg-op-vec.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index ad8ee08a7e..094298bb27 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -391,12 +391,11 @@ static bool do_op2(unsigned vece, TCGv_vec r, TCGv_vec a, TCGOpcode opc) void tcg_gen_not_vec(unsigned vece, TCGv_vec r, TCGv_vec a) { - const TCGOpcode *hold_list = tcg_swap_vecop_list(NULL); - - if (!TCG_TARGET_HAS_not_vec || !do_op2(vece, r, a, INDEX_op_not_vec)) { + if (TCG_TARGET_HAS_not_vec) { + vec_gen_op2(INDEX_op_not_vec, 0, r, a); + } else { tcg_gen_xor_vec(0, r, a, tcg_constant_vec_matching(r, 0, -1)); } - tcg_swap_vecop_list(hold_list); } void tcg_gen_neg_vec(unsigned vece, TCGv_vec r, TCGv_vec a) From patchwork Tue Aug 29 17:02:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 718235 Delivered-To: patch@linaro.org Received: by 2002:adf:d20a:0:b0:31d:da82:a3b4 with SMTP id j10csp91558wrh; Tue, 29 Aug 2023 10:03:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEjNyvj2jEqQxP1b3lOaSU1vyx9KyK3W1DGpCdf82kWE1MZXnJdWsrqelMlBlXjsTvQrPgq X-Received: by 2002:ac8:4b6e:0:b0:413:5e4d:bf46 with SMTP id g14-20020ac84b6e000000b004135e4dbf46mr354578qts.11.1693328619350; Tue, 29 Aug 2023 10:03:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693328619; cv=none; d=google.com; s=arc-20160816; b=wzEH+3ybbRzYAWTZCco/ArmiodY/XXcJaF2MSO3pWdOU9HVQgvD7LbYkAEEdQU8yFs YQU3FFfs8zDBHfOH1IWzg0nO/bv7NQTdQ6HO9UtLvrFwvriwEmhAEdqSwQzVOPnV6J3D NsJlcvsWiId0rW4mJGxYBQCqBE9asl2Ruz2AKzAepXHafzRZ2EyM9EaFM6kpt9oc/iCO 0aVEw8zWufcgNmjFj7/D1rvHAMLVPjSlh8wnc4rnHmcGa+LdzHGU2G7P1RfaDIHn/psR XjdGrpcjsrG7YLPopkCU08ynKrbYdmlheEx78gWXEJKm5Beq8Kynatp+YrfCajz5Yfk8 Dg0Q== 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:to:from :dkim-signature; bh=aHirIWaDFAatgvDo4fYP79xIs5dz8DP+SlTM+t8FRU4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=TfJ2PtmxcEduFHyxYnTzxhZAMYBH8L7VNAsl+zonQ5ZkuW/+Q2Tgo6RAriaqOvUBge //WAxn/MLCJ65ju8pEJSxbK8dx5j9fxgLWsArQizdeP+8uS8WhTgqE6/x4+F9HpLYTMt ARt47qMYMAcMnhP+Sw1cTsRcDtzznBkTlWIi1Xxjb8aaEeTnLIpvOOfh9BS7L9EwP0et g9zLptp3Zv7VhU06ebVekP95qmAj/umq3ztSdLS1+e7Z6Ebh9+A5ZRdVM0OtFsXNRfkr +fIH/fqSAzYcvY4+N0Lfq/NXQoHkOSL/oNpjMVnyfNH1dEJ33JznkowUQ+Kma9/URG0F 5dWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xo5IKTWH; 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 a10-20020a05622a02ca00b0041060a4ffb7si6468111qtx.404.2023.08.29.10.03.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Aug 2023 10:03:39 -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=Xo5IKTWH; 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 1qb27L-0002dw-4X; Tue, 29 Aug 2023 13:03:03 -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 1qb27B-0002Th-4C for qemu-devel@nongnu.org; Tue, 29 Aug 2023 13:02:53 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qb276-000525-N8 for qemu-devel@nongnu.org; Tue, 29 Aug 2023 13:02:51 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c0d5b16aacso27116625ad.1 for ; Tue, 29 Aug 2023 10:02:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693328565; x=1693933365; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=aHirIWaDFAatgvDo4fYP79xIs5dz8DP+SlTM+t8FRU4=; b=Xo5IKTWHbHm9Zjk6fGreRtx4nQnxS98zt/IIIRsYXhzS447PbsjGMa3JaRe1WSNiOu +KBxqwvPvbn292Gi2DDmcZG9dIqUVUbEyz9QWeZ4qpszS9b5YJ9Koq5DnbkbxplPPMsb F+NytoHLrLv5QA1QmAkDQmIfGtDJPhaPepDJlPY0EeIuJxF5dO//9OVl+zUlmA2cWBnf MjJGIbthVrf5tn35M894ojMPSLuEPiZOf7IyfJq6LPbCtZA06LBiUekyjdSvXykVF4on jZDmcFE1ra4ddeO3Anm0oDtwjBz+JpjWN1DR7dtoUGic2ijlgHAbRb2DoejDF/Ve71xr gEpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693328565; x=1693933365; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aHirIWaDFAatgvDo4fYP79xIs5dz8DP+SlTM+t8FRU4=; b=Tm3HSKGHut9Au5NEcGOBLvuJ1BKOBvdnC2plqhNEF0X6fd8uRrIIlwhYHzSKTO2vIx kIXRD204g7ztRTwP4A0dUq/1CR5MlwgDNvfZ3mPC7wIdY+09akMZq8vNM/0UfSMhtpQ5 CDRKXDdX/oLr8qEYXViXBECGKMBbza0gma4aOzwrLo/PFcxuCHUg7L+hWl9wfS1B+dbI kf8KHCDlbVsInY3gSqQJ750p+2q80JuztKXwNy12ndV5qX1bf+dkz0vlOzSHnhwzexOY PDeYSSCoUjwr4tAY7MfjeUji/33We1MiXvrAgNgehF3X85BbrraiDj77l+jKmNUAuQ+C pSgw== X-Gm-Message-State: AOJu0Yze7W9vZogkM5I2FX3szIWpjm/wyujC9HbVX0Qr/TQ/IXZ6NOIa Aqdzb5rbz8JBTa3BsH0h7OeEM76RMYBTPl/ag8k= X-Received: by 2002:a17:90a:ca16:b0:263:fc45:4091 with SMTP id x22-20020a17090aca1600b00263fc454091mr22281687pjt.15.1693328564937; Tue, 29 Aug 2023 10:02:44 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id cv2-20020a17090afd0200b00267b7c5d232sm10989645pjb.48.2023.08.29.10.02.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Aug 2023 10:02:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 4/4] tcg/sparc64: Disable TCG_TARGET_HAS_extr_i64_i32 Date: Tue, 29 Aug 2023 10:02:40 -0700 Message-Id: <20230829170240.765996-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230829170240.765996-1-richard.henderson@linaro.org> References: <20230829170240.765996-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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 Since a59a29312660 ("tcg/sparc64: Remove sparc32plus constraints") we no longer distinguish registers with 32 vs 64 bits. Therefore we can remove support for the backend-specific type change opcodes. Signed-off-by: Richard Henderson --- tcg/sparc64/tcg-target.h | 2 +- tcg/sparc64/tcg-target.c.inc | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/tcg/sparc64/tcg-target.h b/tcg/sparc64/tcg-target.h index 3d41c9659b..5cfc4b4679 100644 --- a/tcg/sparc64/tcg-target.h +++ b/tcg/sparc64/tcg-target.h @@ -115,7 +115,7 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_qemu_st8_i32 0 -#define TCG_TARGET_HAS_extr_i64_i32 1 +#define TCG_TARGET_HAS_extr_i64_i32 0 #define TCG_TARGET_HAS_div_i64 1 #define TCG_TARGET_HAS_rem_i64 0 #define TCG_TARGET_HAS_rot_i64 0 diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc index f2a346a1bd..81a08bb6c5 100644 --- a/tcg/sparc64/tcg-target.c.inc +++ b/tcg/sparc64/tcg-target.c.inc @@ -529,11 +529,6 @@ static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs) tcg_out_ext32u(s, rd, rs); } -static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg rd, TCGReg rs) -{ - tcg_out_mov(s, TCG_TYPE_I32, rd, rs); -} - static bool tcg_out_xchg(TCGContext *s, TCGType type, TCGReg r1, TCGReg r2) { return false; @@ -1444,9 +1439,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, case INDEX_op_divu_i64: c = ARITH_UDIVX; goto gen_arith; - case INDEX_op_extrh_i64_i32: - tcg_out_arithi(s, a0, a1, 32, SHIFT_SRLX); - break; case INDEX_op_brcond_i64: tcg_out_brcond_i64(s, a2, a0, a1, const_args[1], arg_label(args[3])); @@ -1501,7 +1493,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, case INDEX_op_ext32u_i64: case INDEX_op_ext_i32_i64: case INDEX_op_extu_i32_i64: - case INDEX_op_extrl_i64_i32: default: g_assert_not_reached(); } @@ -1533,8 +1524,6 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_ext32u_i64: case INDEX_op_ext_i32_i64: case INDEX_op_extu_i32_i64: - case INDEX_op_extrl_i64_i32: - case INDEX_op_extrh_i64_i32: case INDEX_op_qemu_ld_a32_i32: case INDEX_op_qemu_ld_a64_i32: case INDEX_op_qemu_ld_a32_i64: