From patchwork Wed Mar 20 00:32:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 781346 Delivered-To: patch@linaro.org Received: by 2002:adf:cf01:0:b0:33e:7753:30bd with SMTP id o1csp65386wrj; Tue, 19 Mar 2024 17:33:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVJyE9pLmq8heyCm662vhjrjEB5zvgU3pG616PS4es+Ho3CKouOA0BueFbOUHKjvHGgiFn+T3ccjmNTcxAXF/Fp X-Google-Smtp-Source: AGHT+IH7UeeVnhJNsSKNPL7bm96wm127QqRgSanxS6r+izvNx/dq1qTcFP7Hi+Q9Yos1t0rUfM00 X-Received: by 2002:a05:6830:344a:b0:6e6:8ef9:f2b9 with SMTP id b10-20020a056830344a00b006e68ef9f2b9mr646738otu.13.1710894811289; Tue, 19 Mar 2024 17:33:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710894811; cv=none; d=google.com; s=arc-20160816; b=uxOdXHeFyS83SLLR2Qi948lWXcD7JTupVEKBMVbDhleJTmtEu4e3/sKwtA9Bb8wAfu FBpN7ePSZRQU1PZVwl97YG2vjgk0knnNt1qZjUNXtNG32fufAxEk5oRxPqgWt1HD5dxC zs7uQ0LjPCpItXDVOGpUl7BP/Gowh+L4HOPlT6DGY1UUOaAtRPEWmeyQ8yuFOMEX2hM9 Y+Jg1/JBeeyA4YgWTp+vdv0DOAPPkCZ+AdGFtjqmSWhwpEiYuwTPy99ym3Z4fxUVmYLx cKtiOjGNRbEPDa3z73X54h/YKm+Q1SkpeuAknlUEg/5tfxoTuE4GgBuENYSbV9RavV5N iZAQ== 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=mTE2FKSZqlvO2R4dKYXHZtvyEeZnXSdobAEuMGCaYVg=; fh=VrHP4sfoKA8I1LkS7u+zyL5sfQ9auI1Z6YYiaQiPlIc=; b=zFUfTaBVkVU/ybGybcy/NzdpHbbxHiJ4YFKmKOmMiABvpJyScH/o49yzNBuwSqZjQx Ku0t5UUdguBNQdzH+WQvdpYoEU+7k0NfOwJVgDNksYRF/G99gf0jEERCemPwr4YSlBwk tOXwnfuufM6wGEYsrWgzmoGCdCx3lvK7QifjK7mEOrWrki/OFbEIi6kqk5/CVUZCR2ur bCMzmhTXVR2UBOhE6AG+Y0xfH+J7r1aNOCB/1aehZ7yq9aUn0nkZFLUV5doUv3c5DWEd 5LSdXrM4qwdKdzVNHrGYwe24VzklGO+MRTy6j60AxkdNkaT7I6RBm+jcNbpGA4IqjtoR kCpg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RyAZXhS5; 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 j4-20020a37ef04000000b00789f16ff95bsi7540601qkk.157.2024.03.19.17.33.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Mar 2024 17:33:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RyAZXhS5; 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 1rmjsm-00006h-79; Tue, 19 Mar 2024 20:32:40 -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 1rmjsk-00006F-F6 for qemu-devel@nongnu.org; Tue, 19 Mar 2024 20:32:38 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rmjsi-0005Xu-WF for qemu-devel@nongnu.org; Tue, 19 Mar 2024 20:32:38 -0400 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-5ca29c131ebso3987028a12.0 for ; Tue, 19 Mar 2024 17:32:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710894756; x=1711499556; darn=nongnu.org; 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=mTE2FKSZqlvO2R4dKYXHZtvyEeZnXSdobAEuMGCaYVg=; b=RyAZXhS59DKberbZor594y5tpuFrc5vkgRh7drDtREM9KiRjUrvflxk/hGyAnbStm+ o6gIK4KxsNsgVNVLdGgoPVIcWUiZxp99CXzRzQwyl3+NVhDTw/zqRBQZUju6iaahR+nG 1wCsRusLdMF1uZfrf3tLQRx+A/E4bLYqXTMo73tuIiRxUAD4AhPFrCcxyKPfi3+g/xjR mbL1WcTHoAfbKv4qEgWf4Nv3ZfvKeGiHbr0XOtNIFt5XAnKLbdycZoYzTSIIx063ICSi 7dPNGTtxShn+qn9f/rVdTIjRvvuuDZ4dX+dTOKTc7A2nNrsmpiCBieAuFj429lTusQeP qTuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710894756; x=1711499556; 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=mTE2FKSZqlvO2R4dKYXHZtvyEeZnXSdobAEuMGCaYVg=; b=gtJJkLAVcWbgJb+tvu4hZpVFAvZseGbhXZsrDtOnNHVnf1yFeHuwwZX2d9QRnBrMId Yusp84jmp2OLbFYiS5PzWPFaoihNqoIGsFznJoXUfSYDP6I4LzPkdwtPrpanV1gVR/rb cvWFG1M/Efs+f7l/1pS6G8uqClWUA4LRGXT6ghLl5PhrndLvPsipDuzxJjQe2TSPL8Is qgA7PBS3Egc6MiDP+eCzzGgcq9YypkuEnlAivyXuoQqDdJhTvSWH7OVruMSXH1IxLZzo ebFshsYZN/C+N8BOmPZhgd8sRVZxApTNbh/y9ox7sHlkeeDDcfzU6IJUL+M3LbXV4Zt7 lYgA== X-Gm-Message-State: AOJu0YydOMWsin+K3aB5nTmPy6NvNeTQKhoxPH/YbD61iWJZw4NnVoZ8 4yJoakbmvFFgDncT8BRKrpjotySQyESdlwL0C0elmFQB3voxEJjyZP9wu09QV3swQ0mXubXGKxe n X-Received: by 2002:a05:6a20:748f:b0:1a3:6397:e253 with SMTP id p15-20020a056a20748f00b001a36397e253mr666510pzd.28.1710894755679; Tue, 19 Mar 2024 17:32:35 -0700 (PDT) Received: from stoup.. (173-197-098-125.biz.spectrum.com. [173.197.98.125]) by smtp.gmail.com with ESMTPSA id d19-20020a63d653000000b005d553239b16sm8475645pgj.20.2024.03.19.17.32.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 17:32:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Sven Schnelle Subject: [PULL 7/9] target/hppa: exit tb on flush cache instructions Date: Tue, 19 Mar 2024 14:32:21 -1000 Message-Id: <20240320003223.554145-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240320003223.554145-1-richard.henderson@linaro.org> References: <20240320003223.554145-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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, T_SCC_BODY_TEXT_LINE=-0.01 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: Sven Schnelle When the guest modifies the tb it is currently executing from, it executes a fic instruction. Exit the tb on such instruction, otherwise we might execute stale code. Signed-off-by: Sven Schnelle Message-Id: <20240319161921.487080-5-svens@stackframe.org> Signed-off-by: Richard Henderson --- target/hppa/insns.decode | 6 +++--- target/hppa/translate.c | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/target/hppa/insns.decode b/target/hppa/insns.decode index 5412ff9836..f58455dfdb 100644 --- a/target/hppa/insns.decode +++ b/target/hppa/insns.decode @@ -144,9 +144,9 @@ getshadowregs 1111 1111 1111 1101 1110 1010 1101 0010 nop 000001 ----- ----- -- 11001010 0 ----- # fdc, disp nop_addrx 000001 ..... ..... -- 01001010 . ----- @addrx # fdc, index nop_addrx 000001 ..... ..... -- 01001011 . ----- @addrx # fdce -nop_addrx 000001 ..... ..... --- 0001010 . ----- @addrx # fic 0x0a -nop_addrx 000001 ..... ..... -- 01001111 . 00000 @addrx # fic 0x4f -nop_addrx 000001 ..... ..... --- 0001011 . ----- @addrx # fice +fic 000001 ..... ..... --- 0001010 . ----- @addrx # fic 0x0a +fic 000001 ..... ..... -- 01001111 . 00000 @addrx # fic 0x4f +fic 000001 ..... ..... --- 0001011 . ----- @addrx # fice nop_addrx 000001 ..... ..... -- 01001110 . 00000 @addrx # pdc probe 000001 b:5 ri:5 sp:2 imm:1 100011 write:1 0 t:5 diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 29ef061baf..107d7f1a85 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2343,6 +2343,13 @@ static bool trans_nop_addrx(DisasContext *ctx, arg_ldst *a) return true; } +static bool trans_fic(DisasContext *ctx, arg_ldst *a) +{ + /* End TB for flush instruction cache, so we pick up new insns. */ + ctx->base.is_jmp = DISAS_IAQ_N_STALE; + return trans_nop_addrx(ctx, a); +} + static bool trans_probe(DisasContext *ctx, arg_probe *a) { TCGv_i64 dest, ofs;