From patchwork Wed May 19 18:30:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 442480 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1590520jac; Wed, 19 May 2021 11:46:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFZf5El3i3+A3nbLuPVRf7tsYOotZYKfMKWVkPGg0IHXr83eSfo2u3tQzJY2vHojQpHzV4 X-Received: by 2002:a25:ca92:: with SMTP id a140mr1480600ybg.273.1621450000294; Wed, 19 May 2021 11:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621450000; cv=none; d=google.com; s=arc-20160816; b=AD6wk2FyTZimJ8PBn/OwLqjS+ZgfzwxHF2poM3kD/g4Zz2H282DMnog1D3kqmImwU2 0SGT4Lb54o/oJlkJMClY4fkX0rd71V2UyBiudkQWB70jaCmLNlDC+ZC03jfuMxrgd9FL 81fZIPTQ+2fkk3bMuiTYhjNpoU26kpDTaPiRdNz9rfBKooyPSD+PAX/MtCAMjcuaL2sP B+VcYLGJ7NdXRylFCSgFN+OCgU7CvIXc6KrAK0LiL/7ouQLW3CFwo+8/BkfUN+M8IEUt 0pSw95nWgyxccVh4cP0q+jje2NytLw0A7Kd7/wBHFKla+dsE6CKBOeVDP8Rnem6sjNCc sFrg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=1DqtU0WV8QcSF4+X7m6wigiX0PReSyvreleY4X8ijYI=; b=bNsp50hSQ6bcc9LbAmr1aLhbK5INJGp96aOT6GeTIlhhP7nvrio7yKaa4gfiu5xl2U Ze2pK3vP8DJgu7AuKs/cgTx3Ycox0/nhQfHD1CHtsDXJ/gnS2SXRmBB6FHJyE+Kl2pBn fGiC4zY6zmyuduIDbEPNEGLE9maqxLMbauNWSQif1qQVdrXP45T2JdGxCn20xg12vajm PHE2T4pGAK4ZQdvK9cwogQRxM1GQwybSd1zRrpXsoB43nnPGQtaVAHVA58+THX9s3drh 0cNoICzcKO6I9iesEoI3KwqooPdJHUtLowpKmaJwYaP1gQ8pChPZx09suVFcdQdqQKPO yQVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WWxnrjOY; 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 r142si224612ybc.170.2021.05.19.11.46.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 May 2021 11:46:40 -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=WWxnrjOY; 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]:47336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljRDL-0007IF-Lu for patch@linaro.org; Wed, 19 May 2021 14:46:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljQyn-0004LL-Ir for qemu-devel@nongnu.org; Wed, 19 May 2021 14:31:37 -0400 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]:34695) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljQyZ-0005mP-VI for qemu-devel@nongnu.org; Wed, 19 May 2021 14:31:37 -0400 Received: by mail-ot1-x333.google.com with SMTP id u25-20020a0568302319b02902ac3d54c25eso12656902ote.1 for ; Wed, 19 May 2021 11:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1DqtU0WV8QcSF4+X7m6wigiX0PReSyvreleY4X8ijYI=; b=WWxnrjOYRyMGRp7PhTvkVpu3miWRLibTfUgyUV/rhQT+M8wEdZ497h7RoZ8xLo5DQu 3hqlKE5fDn0r/ZnlplfgvkdPcudGWeb2CIqzT6zzsH8AvxdY5f2yAazWcj6Q2q7fSRGz U6Y50UCvXyU/hovCVnwZePZ/ZsBOW0M7BUzY0WO9x2P0mf8qQYPmlYhF6PqPvzQJsZrA fWfpKuJhjaNwaCrUXLvh6lmXp5viVA80H1oqDlYjcB1TvimSU2u4S0IbJys6Ntd1s3LK ymO895eWwaRgeBX+pEbOhoKVlEZqHuPWs+hGO4jqeLQef0t5kjPAXp4z1+T2BC8i3O7F JBWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1DqtU0WV8QcSF4+X7m6wigiX0PReSyvreleY4X8ijYI=; b=bniRptcmIHVhW38PelHgrF/Fj2z/UTa+kMDg54F3BR6hKKdbDko42lz9G/Cnabfz+g 8CQNvIiBnRtWmUamv/gCqY+UAo0FfjcBkatRatNkfcHkM9+uKaZ2eOFaVgG+NH7WwAc4 W85puVA2VgPCNgC/xM00EUP6+M+phmnIrP9+1t973ZWh6dDTzZ5IFRlMWioMZzecVUPz or41odxHOph75n/q2vqaex6a4HSUp+HqmY79YgMGWVFNpcdQHRVXZmfKdkd2hOkgIdgi S0tVqktqVvk2BGU6VEm5RyjlREZZnktAjsmHBgMvm2jWAoNW1Jt7cV45q8r1JE84gsuN p0+w== X-Gm-Message-State: AOAM533Ric4rrIn1wTRbJMKel/Bv7y3mGFLi+3FqyFfaOnrginUjhNtG Jt+It3eArxxvSHT2Eosur2DJQA47Cx6AyVdi X-Received: by 2002:a9d:5a7:: with SMTP id 36mr639756otd.321.1621449082775; Wed, 19 May 2021 11:31:22 -0700 (PDT) Received: from localhost.localdomain ([45.235.253.15]) by smtp.gmail.com with ESMTPSA id l9sm28428oou.43.2021.05.19.11.31.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 May 2021 11:31:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 31/50] target/i386: Assert !GUEST for user-only Date: Wed, 19 May 2021 13:30:31 -0500 Message-Id: <20210519183050.875453-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210519183050.875453-1-richard.henderson@linaro.org> References: <20210519183050.875453-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x333.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Paolo Bonzini Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For user-only, we do not need to check for VMM intercept. Signed-off-by: Richard Henderson Reviewed-by: Paolo Bonzini Message-Id: <20210514151342.384376-32-richard.henderson@linaro.org> --- target/i386/tcg/translate.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 235caa247b..200d205d7e 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -139,11 +139,13 @@ typedef struct DisasContext { #define CPL(S) 3 #define IOPL(S) 0 #define SVME(S) false +#define GUEST(S) false #else #define PE(S) (((S)->flags & HF_PE_MASK) != 0) #define CPL(S) ((S)->cpl) #define IOPL(S) ((S)->iopl) #define SVME(S) (((S)->flags & HF_SVME_MASK) != 0) +#define GUEST(S) (((S)->flags & HF_GUEST_MASK) != 0) #endif #if defined(CONFIG_USER_ONLY) && defined(TARGET_X86_64) #define VM86(S) false @@ -677,7 +679,7 @@ static void gen_check_io(DisasContext *s, MemOp ot, target_ulong cur_eip, tcg_abort(); } } - if(s->flags & HF_GUEST_MASK) { + if (GUEST(s)) { gen_update_cc_op(s); gen_jmp_im(s, cur_eip); svm_flags |= (1 << (4 + ot)); @@ -2417,8 +2419,9 @@ gen_svm_check_intercept_param(DisasContext *s, target_ulong pc_start, uint32_t type, uint64_t param) { /* no SVM activated; fast case */ - if (likely(!(s->flags & HF_GUEST_MASK))) + if (likely(!GUEST(s))) { return; + } gen_update_cc_op(s); gen_jmp_im(s, pc_start - s->cs_base); gen_helper_svm_check_intercept_param(cpu_env, tcg_const_i32(type), @@ -8517,6 +8520,7 @@ static void i386_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu) g_assert(LMA(dc) == ((flags & HF_LMA_MASK) != 0)); g_assert(ADDSEG(dc) == ((flags & HF_ADDSEG_MASK) != 0)); g_assert(SVME(dc) == ((flags & HF_SVME_MASK) != 0)); + g_assert(GUEST(dc) == ((flags & HF_GUEST_MASK) != 0)); dc->cc_op = CC_OP_DYNAMIC; dc->cc_op_dirty = false;