From patchwork Fri Jun 23 13:17:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1799004 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=a2gYNyeA; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qnd8t1x0vz20Wk for ; Fri, 23 Jun 2023 23:18:22 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgfC-0004UN-1D; Fri, 23 Jun 2023 09:17:22 -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 1qCgfA-0004Qn-Iq for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCgf9-0005Z9-50 for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687526238; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NjZaffAPekSpjEfjZNu7ZflGZlFUHtqN1AICwh62mv0=; b=a2gYNyeAqPxh2jD3+r3Tlqre1P2R/2blSIs1DfP3qzlwMF1OVhEUEFasNESenQl5Ylab2E QXRTWVcJtVz52bK8JmK9Snp69wMq1SdIRhNgQdtgL6lssCY3bPUPXUOAhXGlCobNovI4QO Ay5eRJdy2a3YGk5yM83lys18DX1w4bc= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-vH6sr8qrOmmx03hHs2ad8A-1; Fri, 23 Jun 2023 09:17:16 -0400 X-MC-Unique: vH6sr8qrOmmx03hHs2ad8A-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9715654aba1so84120166b.0 for ; Fri, 23 Jun 2023 06:17:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687526235; x=1690118235; 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=NjZaffAPekSpjEfjZNu7ZflGZlFUHtqN1AICwh62mv0=; b=gChy9MEtYmX3u5WraMzx7FJmBRaYYf1TF8St/3iBHfqeWlZsVtcus+miCsylmLmBA8 or+iBVL57o9LmGCl/LdEDyK61yl48XDETFUfgjsEG5hziMqb6/rb7lwO4Wh89AkcYYda 35WEOVl4qUEkKiicaLzIUREhd9mgxanNRbvgWlSuCsBxTMr4UOYgUHSloFxrAGvbyORL GUa1ZXIWY29HqtrH5bvAgStLSDWoG9Vkt/d9D8qLb7+xQFH2WfYTRcV9vimRVmub2RkQ X+0e9fPFiY1dHgdY05sLvJcG+8Oxa4sZHgTiOEaOPe9qeNKiy9gaeF2sgmN4usmwlKuR w9FA== X-Gm-Message-State: AC+VfDzsr+Mpp7tYVOQnxj1JPl+F0pjqxn+4m7JqhaGcFlb0WRlTwFhn B1N6e8rqgN2FaEwkh53it4Hke1NALhocLt2B8aEc1BRdPQLC/cj/TPNnux+fYo82cHV5nSvPrGH dyRwH8NNt6gCQ14DhRqU5ssp3GOb0NrKETxEmWsgNH9ErzIAjaKDtfIQo2nNXpQ7Mj8xfcpdwIv 4= X-Received: by 2002:a17:907:7ba0:b0:989:4b:e69e with SMTP id ne32-20020a1709077ba000b00989004be69emr11146522ejc.4.1687526235227; Fri, 23 Jun 2023 06:17:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6kqTbPvUOBt5qe49hRYIF4WnBf7Y+ppBA57SRyKHfmh13bocEVogG07ZCoG3WF2IpqsJG2CA== X-Received: by 2002:a17:907:7ba0:b0:989:4b:e69e with SMTP id ne32-20020a1709077ba000b00989004be69emr11146505ejc.4.1687526234907; Fri, 23 Jun 2023 06:17:14 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id by19-20020a170906a2d300b00982bf866f9esm5969051ejb.66.2023.06.23.06.17.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 06:17:14 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH v3 01/11] target/i386: fix INVD vmexit Date: Fri, 23 Jun 2023 15:17:01 +0200 Message-ID: <20230623131711.96775-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230623131711.96775-1-pbonzini@redhat.com> References: <20230623131711.96775-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Due to a typo or perhaps a brain fart, the INVD vmexit was never generated. Fix it (but not that fixing just the typo would break both INVD and WBINVD, due to a case of two wrongs making a right). Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 08c4cab73f1..0de068d4b79 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -6119,7 +6119,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) case 0x108: /* invd */ case 0x109: /* wbinvd */ if (check_cpl0(s)) { - gen_svm_check_intercept(s, (b & 2) ? SVM_EXIT_INVD : SVM_EXIT_WBINVD); + gen_svm_check_intercept(s, (b & 1) ? SVM_EXIT_WBINVD : SVM_EXIT_INVD); /* nothing to do */ } break; From patchwork Fri Jun 23 13:17:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1799000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=S00QsNah; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qnd8Z4Ty4z20Wk for ; Fri, 23 Jun 2023 23:18:05 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgfJ-0004Wu-0g; Fri, 23 Jun 2023 09:17:29 -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 1qCgfH-0004We-R3 for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCgfD-0005aG-Ck for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687526242; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M480NKZDd+FJKbtXpXl/j5rkv8yel0iAbn92O5C8mB0=; b=S00QsNahDT5VQvyubXg7DolU9kfamtWyQdjyKOLGZW5PEFjdvygAIGegd7L4OL/Zk87uL5 UxIyuD4GPCzlq+TS+PslYqciGb9+uW61KGAS5AK8iD7po0cBeY9ocxpGns5BTZAEmOkmtE HJLu7sZlCaLvAoQvA8JGE/KLYLy9A2Y= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-167-FBw3wtotMpSRnqUY0zv4kQ-1; Fri, 23 Jun 2023 09:17:18 -0400 X-MC-Unique: FBw3wtotMpSRnqUY0zv4kQ-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-514b3b99882so404184a12.2 for ; Fri, 23 Jun 2023 06:17:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687526237; x=1690118237; 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=M480NKZDd+FJKbtXpXl/j5rkv8yel0iAbn92O5C8mB0=; b=jNBNw6r4oMNwfXHx2hIWXXlOaj07aK4Gkl0BUoKUGSunPLGr0qhOJjd3HF0OhA8gYR 210bGH91UFgC2oHeAIuT+Ra9n8TXKmyxVBvxPelukWUGl4dz4vtoUeYAztPSS4blXVjz z2yphsD1luv+t5yv9me0qiiDYbpDTiuPFTjKJnIgLHWqe1ED0/JR1T7YL+r/o4Q03j50 +ZzpuT/GBHahgIGs0CitJ7Hz8TamOmh46Npg8y9RBCs/RLI3U2k0wbBt+cPedsEZm4PY UFtTDZo86XdeGUtDSnCUBGb7yMHTpxkoUZW6fSrfoLiUYWm4aqwB4mmxtGtM/BjimKYM AXog== X-Gm-Message-State: AC+VfDwyyMxex8R3BasyDefL9GuQJCsDV4cSbvKQWQJSH/ERQNPkpET8 LPbf90W2Z/Fzl1mduwG+0mfek/5xHZBI0uhdGfd8w4wAxXQ7/P3ReY3YcKWRoypU3b91SoWBX8/ hOsO4idQOrPrZ8LckQd9msz4U19CflJ8VoZitMRCV/WjOtjjXCg5c9FCXtHW0SEPY/bCTyLZPJr g= X-Received: by 2002:a05:6402:6d8:b0:514:9e2c:90c6 with SMTP id n24-20020a05640206d800b005149e2c90c6mr14588501edy.38.1687526237043; Fri, 23 Jun 2023 06:17:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4/y20V4VssR1wkil+vclqOwP82Ctu1bTsLbLRmX3oJi7G5UuZe6bmTPTFptmva/X8B+0Xyeg== X-Received: by 2002:a05:6402:6d8:b0:514:9e2c:90c6 with SMTP id n24-20020a05640206d800b005149e2c90c6mr14588489edy.38.1687526236791; Fri, 23 Jun 2023 06:17:16 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id d16-20020aa7d5d0000000b0051a358a76c9sm5261710eds.72.2023.06.23.06.17.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 06:17:16 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH v3 02/11] target/i386: TCG supports 3DNow! prefetch(w) Date: Fri, 23 Jun 2023 15:17:02 +0200 Message-ID: <20230623131711.96775-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230623131711.96775-1-pbonzini@redhat.com> References: <20230623131711.96775-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The AMD prefetch(w) instructions have not been deprecated together with the rest of 3DNow!, and in fact are even supported by newer Intel processor. Mark them as supported by TCG, as it supports all of 3DNow!. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 1242bd541a5..ff3dcd02dcb 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -647,7 +647,8 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1, CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT | CPUID_EXT2_PDPE1GB | \ TCG_EXT2_X86_64_FEATURES) #define TCG_EXT3_FEATURES (CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM | \ - CPUID_EXT3_CR8LEG | CPUID_EXT3_ABM | CPUID_EXT3_SSE4A) + CPUID_EXT3_CR8LEG | CPUID_EXT3_ABM | CPUID_EXT3_SSE4A | \ + CPUID_EXT3_3DNOWPREFETCH) #define TCG_EXT4_FEATURES 0 #define TCG_SVM_FEATURES (CPUID_SVM_NPT | CPUID_SVM_VGIF | \ CPUID_SVM_SVME_ADDR_CHK) From patchwork Fri Jun 23 13:17:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1799007 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CcP6bAxy; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qnd9q4HZ8z20Wk for ; Fri, 23 Jun 2023 23:19:11 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgfK-0004Xf-MV; Fri, 23 Jun 2023 09:17: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 1qCgfJ-0004X2-1x for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCgfF-0005aS-SR for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687526245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0W8NdMue2w0PHMCwCzmpD+VGR+2VHcU3d8NE23hGmkY=; b=CcP6bAxygtuUYQ8X4rVVL/LmTwJ5P7kb1HLNsiml6B/58XwlxIVdjcH3LoMGZ80gaEwHXQ Beo4FMyhA5kpKVshBGYHFMIOCl0EGQrK6ADMBIqoaJpO+A1P7poo4IlTh9RDgtbqoOBwm4 HONwjSnqM9lEK2BFijX+aihkPrjEgOs= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-145-0n2qrj_WOcCuamJ-Nb0LJw-1; Fri, 23 Jun 2023 09:17:20 -0400 X-MC-Unique: 0n2qrj_WOcCuamJ-Nb0LJw-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-987accb96dbso42086766b.2 for ; Fri, 23 Jun 2023 06:17:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687526238; x=1690118238; 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=0W8NdMue2w0PHMCwCzmpD+VGR+2VHcU3d8NE23hGmkY=; b=aiTN/fJ7KTmHAFF/0EvDW2MNCsQpb8HTYm/rQ2rZ9B4x6ikePwzr87xhCeEtlUiwtR vntoj+UME7WCNec3t5dBoskpUYJOADTUTLdbSEAvDEU4bwfmPlu8NN6QOKRLfFJxfuXC /k0FxA32yqiSseDeH0WWjUfbR/ZBoo5Deq+OuyNMOfg9uXPLveSXndvtZuuU1I+ye0gx O6KVC+6WAY9m7wULxYio+OXr5X23y8tI7yeS1+95KpWccxKNQm7Uz0yCIkdz9gxbR4HF KDxSxx5Jx99ParXCl+WmoUygBrSiipQ3o4cJ8N5zngPQIXSNGEdJepCsKwaG+sGW6MK/ p+Dg== X-Gm-Message-State: AC+VfDznjHfX1hB72KpWePFGIg1pk4kdmBvTBguY0Vj947JiBpP7vjdM pITWIyJa2gwYLVT8eqYF7UNoPyQdBaJtfpxsn1LpPUBZlrccXiNNIU4YWHz51hXlgHesHEjGxuF 99HFRjBs9kJRGFGW6EEPjH3phdQeTHLJBPoSV1mVkIuFjzsq8JGiouJMl6xzBuXEUminW7Eckh7 I= X-Received: by 2002:a17:907:a04:b0:988:8fce:17ba with SMTP id bb4-20020a1709070a0400b009888fce17bamr10382288ejc.31.1687526238528; Fri, 23 Jun 2023 06:17:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7EWOtDaLMIM8ZIVvs87zUEKopIZSr9OGqFvc/Q3DBkkvyVaeKVgYKlFhe+6Y51IrOfogRZKQ== X-Received: by 2002:a17:907:a04:b0:988:8fce:17ba with SMTP id bb4-20020a1709070a0400b009888fce17bamr10382279ejc.31.1687526238260; Fri, 23 Jun 2023 06:17:18 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id g10-20020a170906348a00b00988d47b731fsm5897032ejb.88.2023.06.23.06.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 06:17:17 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH v3 03/11] target/i386: TCG supports RDSEED Date: Fri, 23 Jun 2023 15:17:03 +0200 Message-ID: <20230623131711.96775-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230623131711.96775-1-pbonzini@redhat.com> References: <20230623131711.96775-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org TCG implements RDSEED, and in fact uses qcrypto_random_bytes which is secure enough to match hardware behavior. Expose it to guests. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index ff3dcd02dcb..fc4246223d4 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -657,11 +657,10 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1, CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ADX | \ CPUID_7_0_EBX_PCOMMIT | CPUID_7_0_EBX_CLFLUSHOPT | \ CPUID_7_0_EBX_CLWB | CPUID_7_0_EBX_MPX | CPUID_7_0_EBX_FSGSBASE | \ - CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_AVX2) + CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_RDSEED) /* missing: CPUID_7_0_EBX_HLE - CPUID_7_0_EBX_INVPCID, CPUID_7_0_EBX_RTM, - CPUID_7_0_EBX_RDSEED */ + CPUID_7_0_EBX_INVPCID, CPUID_7_0_EBX_RTM */ #define TCG_7_0_ECX_FEATURES (CPUID_7_0_ECX_UMIP | CPUID_7_0_ECX_PKU | \ /* CPUID_7_0_ECX_OSPKE is dynamic */ \ CPUID_7_0_ECX_LA57 | CPUID_7_0_ECX_PKS | CPUID_7_0_ECX_VAES) From patchwork Fri Jun 23 13:17:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1799009 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fsg+Rb+o; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QndB64PBDz20Xp for ; Fri, 23 Jun 2023 23:19:26 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgfL-0004Xk-02; Fri, 23 Jun 2023 09:17: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 1qCgfI-0004Wm-EA for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCgfF-0005aP-Gz for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687526245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5DXiNsuxJ9qVbt80PCL9CHIXh4r/PuClI93uiH00w3U=; b=fsg+Rb+ol/SDG9dktIBX+EvANGYduRfs7RyaG8nn6IvfNsqZkq9upO8hmMuEwaYpamiDW1 xEsHCe65IhMzRwADMU4cWZKfzlyDjfxHE4fWQMT89ldnGHscR0bk0QUw79kw5GjyMA+sNg RcQG3bs8/SwcqqLfvH99ctCaP+8SdJQ= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-322-tWiV_5W6MBm67b4WAhu4Ag-1; Fri, 23 Jun 2023 09:17:22 -0400 X-MC-Unique: tWiV_5W6MBm67b4WAhu4Ag-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2b4577e34fbso6573291fa.3 for ; Fri, 23 Jun 2023 06:17:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687526240; x=1690118240; 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=5DXiNsuxJ9qVbt80PCL9CHIXh4r/PuClI93uiH00w3U=; b=dHGCEmr5zHW8tUrAh/I3NYj6sAxaIAn/Arr6wv87DqUMP/5SPrWWGNf9Gf9IZ67Jeb VLy8Wy9VuxutuW18miZ7Ng/cxLvj+eM7RJsOZ9PXw9W4tlbu6t1TLm4xCMRWt8PChyCu TlPkoUbVoaHAqpXDeXYtAtXnmeKP2YOftmhg0qNvqPznt2UNGpYVX3otnDyS9Skg8RXq 6qeklX04LfU1gTc76vSHWpJl8Vs79/XgPrZxr20cz/pP5Ox47HWKI5p/sy7uvc3Lx7sI u22FnldR/RfaKh16rRvn5pOgWW26LgIYl6aYNmZFAJjj05kqY9t7K607GQ7nO1y47SJg lMLg== X-Gm-Message-State: AC+VfDxAHOnBKTnCRcaHAISLWLFk7av9X2xVeNsN6TzHCgqAYIaYYtUI 8/KTNSm/VuExDz6lgOJp/HyXjUXuFxq1ycMm+w21Je4ell76oSs/4rcp2MMY4u53qO5sQbJ/t7X GAj7wt8pPpqPSEYZPiLIXTe7Zc0uNgtiuJZHSqVLpwjEBNF9cDwm0kyno1x41gdzeqycDiYzqpZ M= X-Received: by 2002:a2e:b60f:0:b0:2b5:8bc3:95c9 with SMTP id r15-20020a2eb60f000000b002b58bc395c9mr4766595ljn.31.1687526240533; Fri, 23 Jun 2023 06:17:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5v2bLSHNklNH67oZ5mWcHVwgHRKfNm+Yj0qXZR7HBXV3gPBpTjpXlsqB8UN4q0OLaPA5HjPA== X-Received: by 2002:a2e:b60f:0:b0:2b5:8bc3:95c9 with SMTP id r15-20020a2eb60f000000b002b58bc395c9mr4766581ljn.31.1687526240158; Fri, 23 Jun 2023 06:17:20 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id l9-20020aa7c309000000b005187a57fba1sm5251824edq.77.2023.06.23.06.17.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 06:17:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH v3 04/11] target/i386: do not accept RDSEED if CPUID bit absent Date: Fri, 23 Jun 2023 15:17:04 +0200 Message-ID: <20230623131711.96775-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230623131711.96775-1-pbonzini@redhat.com> References: <20230623131711.96775-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Suggested-by: Richard Henderson Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 0de068d4b79..4ef45bbd71e 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -3925,12 +3925,20 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) break; case 7: /* RDSEED */ + if (mod != 3 || + (s->prefix & (PREFIX_LOCK | PREFIX_REPZ | PREFIX_REPNZ)) || + !(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_RDSEED)) { + goto illegal_op; + } + goto do_rdrand; + case 6: /* RDRAND */ if (mod != 3 || (s->prefix & (PREFIX_LOCK | PREFIX_REPZ | PREFIX_REPNZ)) || !(s->cpuid_ext_features & CPUID_EXT_RDRAND)) { goto illegal_op; } + do_rdrand: translator_io_start(&s->base); gen_helper_rdrand(s->T0, cpu_env); rm = (modrm & 7) | REX_B(s); From patchwork Fri Jun 23 13:17:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1799006 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=J2ENcutY; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qnd9p2Y4Cz20Wk for ; Fri, 23 Jun 2023 23:19:10 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgfK-0004Xe-JD; Fri, 23 Jun 2023 09:17: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 1qCgfJ-0004X7-4l for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCgfH-0005ad-7i for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687526246; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H6LzM46kJa48T3+aRvGvtOXkekp7mWniYMCf+e1S9DU=; b=J2ENcutYTuGd6MUDeamokl8fWk+Z/IVj07el26UmNCQ8bhr9VnrWLkJFG/1ICArQw4qcyN eKNT94znS96UWACcQzQPr60BGaxdrhHpNAgEHl9WhPjaKqoeHKGquouQ+xJ0GOoDSrqpTi WZ1eQ3my8gqeaPOcAcoXaGiU2FxK2lk= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-444-9Vs4n8WwPTOOOrvzC8-ukg-1; Fri, 23 Jun 2023 09:17:24 -0400 X-MC-Unique: 9Vs4n8WwPTOOOrvzC8-ukg-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2b475f626b6so5637011fa.1 for ; Fri, 23 Jun 2023 06:17:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687526242; x=1690118242; 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=H6LzM46kJa48T3+aRvGvtOXkekp7mWniYMCf+e1S9DU=; b=AohP7M5yFAYHybSV35kethr6AWKYWu1ov1G+PQ3bKGyE0lIgWTo5WruB3gK+1DhDg8 eWHhKop8tZOmGzTGYHDzWKIwHvjK/HCR20F09rYmBO2/u8ALd8jU8CAkNg6173+5KItT cKiaKnBvJII7784NtrWuD2fh2Q4uekdDPwfAdpzBQtnD1aHE0VRqHjSmNvZ5CNurUrpy CrSvIeheTNeqK9WjSLdkUNZzrwPbuRusCu2bs9sGHD9wHqev+dWAq+pxjhuewAa38asF 6ivUuBfpslrRpDjtSfM1gtbXBAjTYCWUtisj8WG221duib6021u2crWBg0fP6y6BUanf OOSw== X-Gm-Message-State: AC+VfDyrDWsylpcQC178E/04US+hzWqdLvZB9V7pEsjnVmu9oSCGZp1P PmQMXMFMXr9urgeeFjxjIuMbcBxqNdLzYTL0tgduaQ6smvUhSLByfxytk5rzkXLN4t2YP8cLozi FLj4WWO3yuEgLELNMbSNYxctut2yrTSy86mrIlhU6CUc1D2KlCJcwCBKcZRmcBbHkiO6XjTONrI s= X-Received: by 2002:a2e:7209:0:b0:2b4:5a0b:9297 with SMTP id n9-20020a2e7209000000b002b45a0b9297mr15765340ljc.29.1687526242076; Fri, 23 Jun 2023 06:17:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7QmfMqCrn4RQ6ExsTXdygv0M8DYoZoSCbzfZuNKW0PsMB0Do4i2qA2/Fr23Qch5GbjyZbHHA== X-Received: by 2002:a2e:7209:0:b0:2b4:5a0b:9297 with SMTP id n9-20020a2e7209000000b002b45a0b9297mr15765322ljc.29.1687526241719; Fri, 23 Jun 2023 06:17:21 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id d23-20020a170906c21700b0098296b1fdd0sm6057342ejz.133.2023.06.23.06.17.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 06:17:21 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH v3 05/11] target/i386: TCG supports XSAVEERPTR Date: Fri, 23 Jun 2023 15:17:05 +0200 Message-ID: <20230623131711.96775-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230623131711.96775-1-pbonzini@redhat.com> References: <20230623131711.96775-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org XSAVEERPTR is actually a fix for an errata; TCG does not have the issue. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index fc4246223d4..bce0cb73e85 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -678,6 +678,8 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1, #define TCG_SGX_12_0_EBX_FEATURES 0 #define TCG_SGX_12_1_EAX_FEATURES 0 +#define TCG_8000_0008_EBX CPUID_8000_0008_EBX_XSAVEERPTR + FeatureWordInfo feature_word_info[FEATURE_WORDS] = { [FEAT_1_EDX] = { .type = CPUID_FEATURE_WORD, @@ -939,7 +941,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { "amd-psfd", NULL, NULL, NULL, }, .cpuid = { .eax = 0x80000008, .reg = R_EBX, }, - .tcg_features = 0, + .tcg_features = TCG_8000_0008_EBX, .unmigratable_flags = 0, }, [FEAT_8000_0021_EAX] = { From patchwork Fri Jun 23 13:17:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1799010 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ToHJ7iKh; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QndBF6lckz20Wk for ; Fri, 23 Jun 2023 23:19:33 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgfK-0004Xd-9u; Fri, 23 Jun 2023 09:17: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 1qCgfJ-0004XI-6o for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCgfH-0005ag-8l for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687526246; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6EIU5XOd3nbA8G7SlRkIFwdHfD63tFeDL6PWodWJlqM=; b=ToHJ7iKhjfAr7M+etgCAKne3Vh3+Yt3GofW26rSLX98Y9b+IN6DqukF9pJdYOGzNwqqPdE wtXzYoe42fJOh0oBwum9D7z8H/GuA0PKZa/ExYZjBuaPo+kXD9CfuWS2NcVoQaoXvwlkVb DP5bKpdCRxr4oKuSUjby996lDh9iu9g= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-20-wCXDx1O-OPCYoufBfZ3KjQ-1; Fri, 23 Jun 2023 09:17:25 -0400 X-MC-Unique: wCXDx1O-OPCYoufBfZ3KjQ-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-94a355cf318so45558966b.2 for ; Fri, 23 Jun 2023 06:17:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687526243; x=1690118243; 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=6EIU5XOd3nbA8G7SlRkIFwdHfD63tFeDL6PWodWJlqM=; b=Z+XTgxLjelQmPA7ZTnpLMYT7h8WRtNwfiFW5m8qwMzbZtsvOWc6nkxF+3yMdOBS1P/ 83pofsx+QJQaOz5g5tfE42mc3FEPBYm9eVt3nZr0OVEbd9z7BNpbVcR5ZItKCWftKKvQ TnKZOitVxq6+OzAdRAQA/hzHHeLmVwbhoY/q802T2ZBorCjfU9pmsgA8cwLaSCvnZJat oLJZsxs0IY5MlGsp+mEOIwyQkkw71IG6qOaspymjwol5oE3bu2JBEXsMZx9OQXFx1GH/ 32C1czSH1BbyGp5l6tjkycpzKgKE0S8szfT3UbEDjSn6RGa4Cqb0MyguXuFbPTxU4ybF Jnhg== X-Gm-Message-State: AC+VfDy14600U9vgY/u6V7XjJ1LuOm97PfEG/E0HHIxkqbB0LekGT2H5 uNFhWJMXvlmExEnh4z8jfmWkAkt5aoygDQ5xNdF99/J0tVv4vIRNAmvMtGV2Z1XPajlT4GruszH /8dso+mM3zxhce2wVu2g2afShDMxrJ3TL54qjm7pWiK0DwSWh50LlNM4ezGSet9Wcl0nF07dSAf c= X-Received: by 2002:a17:907:268a:b0:987:7e6a:d239 with SMTP id bn10-20020a170907268a00b009877e6ad239mr16145044ejc.35.1687526243606; Fri, 23 Jun 2023 06:17:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4D/yxQRsbZ8SC5c2KjRODvn74CfiGrRBpd84q87GpGEX5LYgOEDHXWxPvGrNVUFvfSB2DvHg== X-Received: by 2002:a17:907:268a:b0:987:7e6a:d239 with SMTP id bn10-20020a170907268a00b009877e6ad239mr16145029ejc.35.1687526243300; Fri, 23 Jun 2023 06:17:23 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id y12-20020a17090614cc00b0098951bb4dc3sm4958453ejc.184.2023.06.23.06.17.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 06:17:22 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH v3 06/11] target/i386: TCG supports WBNOINVD Date: Fri, 23 Jun 2023 15:17:06 +0200 Message-ID: <20230623131711.96775-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230623131711.96775-1-pbonzini@redhat.com> References: <20230623131711.96775-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org WBNOINVD is the same as INVD or WBINVD as far as TCG is concerned, since there is no cache in TCG and therefore no invalidation side effect in WBNOINVD. With respect to SVM emulation, processors that do not support WBNOINVD will ignore the prefix and treat it as WBINVD, while those that support it will generate exactly the same vmexit. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 3 ++- target/i386/tcg/translate.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index bce0cb73e85..695e01582bf 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -678,7 +678,8 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1, #define TCG_SGX_12_0_EBX_FEATURES 0 #define TCG_SGX_12_1_EAX_FEATURES 0 -#define TCG_8000_0008_EBX CPUID_8000_0008_EBX_XSAVEERPTR +#define TCG_8000_0008_EBX (CPUID_8000_0008_EBX_XSAVEERPTR | \ + CPUID_8000_0008_EBX_WBNOINVD) FeatureWordInfo feature_word_info[FEATURE_WORDS] = { [FEAT_1_EDX] = { diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 4ef45bbd71e..b2e2dccb84f 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -6125,7 +6125,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) break; case 0x108: /* invd */ - case 0x109: /* wbinvd */ + case 0x109: /* wbinvd; wbnoinvd with REPZ prefix */ if (check_cpl0(s)) { gen_svm_check_intercept(s, (b & 1) ? SVM_EXIT_WBINVD : SVM_EXIT_INVD); /* nothing to do */ From patchwork Fri Jun 23 13:17:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1799011 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ysr+Hlh3; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QndBK0nTsz20Wk for ; Fri, 23 Jun 2023 23:19:37 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgfM-0004YQ-EH; Fri, 23 Jun 2023 09:17:32 -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 1qCgfK-0004Xg-PV for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCgfJ-0005bC-8h for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687526248; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tJgCEvRIJfsZ4PHdwAsMys/JtM2LhLA5MowluJx/lzU=; b=Ysr+Hlh3VJGqtZwqk54e9TFI0fwZa0a14OTWW2nP3TbRjEMzj6d+NfeoSj98afm2PreD5w j6nMprCnxELZ3yQErH/n2/ZVRcdopxAtZaBIq2mWbjuq3NeraEBPS6VeLYae2odq/QOe+q 5zqPhH1c0cKCo4pBQbJAoFh6oNyP9FA= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-0nghi0HtPdWdihoyRR6Tpg-1; Fri, 23 Jun 2023 09:17:26 -0400 X-MC-Unique: 0nghi0HtPdWdihoyRR6Tpg-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-978a991c3f5so46811266b.0 for ; Fri, 23 Jun 2023 06:17:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687526245; x=1690118245; 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=tJgCEvRIJfsZ4PHdwAsMys/JtM2LhLA5MowluJx/lzU=; b=XjJBt7EXkhor1boH6odADSOQJz+AzqciTuKLBthEiPRe8cML4lDaSZYMtscKpJts1E UHudsPwaIHGQ0e07o/0FqbB7+hXCp1+EaiBQb3sNKvXbA867ANJ7eOKjjc1apVWFcFFC P/oAf9KJOVX80qoNwYDjzv5wEjEzKYaSidWtlPOVsNLHQoeYd61WQhk81EgaWDOhVCRD k56rVDNxRX8NFnI2Ozv3bR+yHppCZuzTOm5UjqxKd7zgtudCPaVRKVd5miAvnURPlh/6 Swgpgb0SugBjaNDej9Nh3cGQS69968Q4HhdU79NNGk94p+h6kCx6ltvMUlTpdvBZ2ksH Qgqg== X-Gm-Message-State: AC+VfDx0ZMpfQNhtT3LOlkue1KJNnw3aFs/ZhGJIeYa1KrbQ+WTy4KV5 iDHT1ODHp07iARDvc3Ija4E7dXz8RYf2hXrRklF3K1z7aE0Kbaeo2WvJmNiBE4f/LN7lqXTqXn3 Tq35qO0JZerBui8uJRhnfpHOdPyrDnJdCHJxiXsNYVC1jzsZv6VQfTXvpQT0UTYYpH1ulbxHmdU Q= X-Received: by 2002:a17:907:3f18:b0:97d:ee91:df83 with SMTP id hq24-20020a1709073f1800b0097dee91df83mr22058705ejc.61.1687526245014; Fri, 23 Jun 2023 06:17:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5jLXQRmIcHmeLlaaXL6VfTZbo7dm/ZLSNOJzMMZ+Vb2JtUMQjXZgEt6gy9NppRBEvnzo3iEw== X-Received: by 2002:a17:907:3f18:b0:97d:ee91:df83 with SMTP id hq24-20020a1709073f1800b0097dee91df83mr22058692ejc.61.1687526244765; Fri, 23 Jun 2023 06:17:24 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id h11-20020a1709063b4b00b0098d80adcc23sm835924ejf.113.2023.06.23.06.17.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 06:17:24 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH v3 07/11] target/i386: Intel only supports SYSCALL/SYSRET in long mode Date: Fri, 23 Jun 2023 15:17:07 +0200 Message-ID: <20230623131711.96775-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230623131711.96775-1-pbonzini@redhat.com> References: <20230623131711.96775-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 4 ++++ target/i386/tcg/translate.c | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 695e01582bf..978d24b5ec7 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6238,6 +6238,10 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, *ecx |= 1 << 1; /* CmpLegacy bit */ } } + if (tcg_enabled() && env->cpuid_vendor1 == CPUID_VENDOR_INTEL_1 && + !(env->hflags & HF_LMA_MASK)) { + *edx &= ~CPUID_EXT2_SYSCALL; + } break; case 0x80000002: case 0x80000003: diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index b2e2dccb84f..ed4016f554b 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -5692,7 +5692,10 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) break; #ifdef TARGET_X86_64 case 0x105: /* syscall */ - /* XXX: is it usable in real mode ? */ + /* For Intel SYSCALL is only valid in long mode */ + if (!LMA(s) && env->cpuid_vendor1 == CPUID_VENDOR_INTEL_1) { + goto illegal_op; + } gen_update_cc_op(s); gen_update_eip_cur(s); gen_helper_syscall(cpu_env, cur_insn_len_i32(s)); @@ -5702,6 +5705,10 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) gen_eob_worker(s, false, true); break; case 0x107: /* sysret */ + /* For Intel SYSRET is only valid in long mode */ + if (!LMA(s) && env->cpuid_vendor1 == CPUID_VENDOR_INTEL_1) { + goto illegal_op; + } if (!PE(s)) { gen_exception_gpf(s); } else { From patchwork Fri Jun 23 13:17:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1799001 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bL1mOBtk; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qnd8Z4hX9z20Xp for ; Fri, 23 Jun 2023 23:18:05 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgfN-0004Yx-J2; Fri, 23 Jun 2023 09:17:33 -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 1qCgfL-0004Y4-U4 for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCgfK-0005bl-Fc for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687526249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iajl0SbAzN6Vf70G/F/Se072OB8g0wD2P1jeIUlYfpA=; b=bL1mOBtkGo2OzBmnZ8x692Z2Ixf6KvLmthsMjIysPrGU7cjgih22bUaySEGipI0el6KZoR Ba2ihhR5IHS3KJUlNLs3pcVPSs9buWrGTCfuG/oOEDCnXYD+Dn7kxd11HNbmOxpidJsbbX Q3Tlrb+O6/V/GYf+Y1GlgStldr+Fu0U= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-584-kUZtbC6eOLCr8ej8iktDwg-1; Fri, 23 Jun 2023 09:17:28 -0400 X-MC-Unique: kUZtbC6eOLCr8ej8iktDwg-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2b45bf52675so6502991fa.3 for ; Fri, 23 Jun 2023 06:17:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687526247; x=1690118247; 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=iajl0SbAzN6Vf70G/F/Se072OB8g0wD2P1jeIUlYfpA=; b=jKV4laIOrfkkw8J+nvr13uXtMH4tCPXdz5zDfZXIiIuJIK+SQdIZbw8O1iD+Ij9O5l SzcE8UI70UqZ0+o6oAyhU1lo1a7gRBW5zaT5h5V/zU/xcHiY5Y19J2WpImkSCGRrzfo9 sPKoV4YFoPGfH++JbF30djLQGbLfHTt9gUA4XCH0VJ1V4qrEnV5tPk8dq5qQdrN8HLfN 8O3gjDyTi1lcfKcftuoCeJmsRXye9O02/YIN/WZMy5Ma4cYQH4kHJsDGPxc2Q5Pf9Yj7 u9aE6HALs5CiOnDMoIfBl4t6U0IpV63z+irSgHGvSy4zunvHVHFQasOhYVdbC9F8MDGj y4/w== X-Gm-Message-State: AC+VfDwmkoZgqKRmgkf9kv2wUHvmZ7Oj9jGrfL8bAvxdCpZaJa+pyC1/ V2s72xCRqf8cJGJq5+G1uRY/TQXbPP+wWGzTBw/ra9ZF0qbev0P52P9Z0u5I75gDY9r5r+C9ff8 jXVEO79DzZVM3RI8FfPqjNyDT8EnCEVkxQkOgMlBh9dym1E7aYMClza3501diNOHfKR/px5+QaL k= X-Received: by 2002:a2e:a175:0:b0:2b1:fdcc:14fb with SMTP id u21-20020a2ea175000000b002b1fdcc14fbmr15335144ljl.43.1687526246819; Fri, 23 Jun 2023 06:17:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ66OMDxerQCH9QSVhgp3wwTGdp0oJXw5TPNjLHqLO6va6SDFt1rWhe/KvzVL6JNFlo+yiObiA== X-Received: by 2002:a2e:a175:0:b0:2b1:fdcc:14fb with SMTP id u21-20020a2ea175000000b002b1fdcc14fbmr15335127ljl.43.1687526246323; Fri, 23 Jun 2023 06:17:26 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id q13-20020a1709064ccd00b00982a077599fsm5917638ejt.110.2023.06.23.06.17.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 06:17:25 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH v3 08/11] target/i386: AMD only supports SYSENTER/SYSEXIT in 32-bit mode Date: Fri, 23 Jun 2023 15:17:08 +0200 Message-ID: <20230623131711.96775-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230623131711.96775-1-pbonzini@redhat.com> References: <20230623131711.96775-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Paolo Bonzini Acked-by: Richard Henderson --- target/i386/tcg/translate.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index ed4016f554b..a20b5af71e7 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -5669,9 +5669,10 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) s->base.is_jmp = DISAS_NORETURN; break; case 0x134: /* sysenter */ - /* For Intel SYSENTER is valid on 64-bit */ - if (CODE64(s) && env->cpuid_vendor1 != CPUID_VENDOR_INTEL_1) + /* For AMD SYSENTER is not valid in long mode */ + if (LMA(s) && env->cpuid_vendor1 != CPUID_VENDOR_INTEL_1) { goto illegal_op; + } if (!PE(s)) { gen_exception_gpf(s); } else { @@ -5680,9 +5681,10 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) } break; case 0x135: /* sysexit */ - /* For Intel SYSEXIT is valid on 64-bit */ - if (CODE64(s) && env->cpuid_vendor1 != CPUID_VENDOR_INTEL_1) + /* For AMD SYSEXIT is not valid in long mode */ + if (LMA(s) && env->cpuid_vendor1 != CPUID_VENDOR_INTEL_1) { goto illegal_op; + } if (!PE(s)) { gen_exception_gpf(s); } else { From patchwork Fri Jun 23 13:17:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1799005 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HPyrOgX9; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qnd9Y0pCJz20Wk for ; Fri, 23 Jun 2023 23:18:57 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgfO-0004Zp-Ov; Fri, 23 Jun 2023 09:17: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 1qCgfN-0004Yw-BN for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCgfL-0005cA-Re for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687526251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pZvex8/ZXpvWNVXIq7fGZYNulJMqc+TOm3c+D70WX+I=; b=HPyrOgX9/aHwEl3ayLTPjsrNO+9sbuWOavNT+SgTgqUG+I3SpVjMIDC9WZ9wDI16GVso0z lhYU09HZ2A/4uYMKDtH7D2Hd1kaG/bwS19W1Q/nORaPhozIlvyx9CAztin+v784XbSTH0/ voHB+EXDawmqsUv4XzmCwOTdcQbrsfA= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-483-z5u38J1EOnezlqQKS94cOQ-1; Fri, 23 Jun 2023 09:17:29 -0400 X-MC-Unique: z5u38J1EOnezlqQKS94cOQ-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2b479d12b31so6651871fa.3 for ; Fri, 23 Jun 2023 06:17:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687526248; x=1690118248; 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=pZvex8/ZXpvWNVXIq7fGZYNulJMqc+TOm3c+D70WX+I=; b=ipULEAKL34/P9531B5HaNLySxEIpuD7BVcgiMwjSX/cuJYLp8n8LVskvTckVceHqwt dtMCTzoC3LVkTqYOLTEHqyHpfqg3fyWm+4aDjbybQwDejbQlSzV2jkUNYNM19KECxe3k o3j2nndXNmN4g2dSOPIEKiqGlWXd+Pw0vOqxcDE1/XaENWuLTiI4bTyn8/NCxTYG74p/ lJCe3czELmHsZkhrdhzDk7fuV4baR0hBsOUOEY8RYb7ck5Nb78Fbo9W924JDU7Z3nRhK EKQFtUeolVsUeE0aGQ4GYr3y+yhMWGZIhBXY3qIt4mYvSk47J5ftLcFCszIkZcA3dx6Q Kttw== X-Gm-Message-State: AC+VfDwl6aWLj3728YzO7fUpjpNIbK1B4T3+wFDDlPlWYFQdC2jytSl0 jp1WLU3ZxRShajaEXGdX0t7zFzh3ieBb4vbz1LUCwFmhwJ+W7f4VWMtxd2wCXjaw1e4v7W5eXes nIonfkmVFXvvgBDRgOYVo0XVrmKyv9FY3epQZfZPvX5ictpr4P0UWn1RaBwh9ux6OQV70ENyWzv w= X-Received: by 2002:a05:651c:1045:b0:2b5:8204:ec9b with SMTP id x5-20020a05651c104500b002b58204ec9bmr6710851ljm.43.1687526248018; Fri, 23 Jun 2023 06:17:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5OSQG4J0DMAeeY+fwro23IC3QPf/I6wwaiuX13nM105zOto32C7Ohb6u4ddQobBWTOOtcTQA== X-Received: by 2002:a05:651c:1045:b0:2b5:8204:ec9b with SMTP id x5-20020a05651c104500b002b58204ec9bmr6710843ljm.43.1687526247792; Fri, 23 Jun 2023 06:17:27 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id t18-20020aa7d712000000b0051827a12b47sm5180176edq.15.2023.06.23.06.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 06:17:27 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH v3 09/11] target/i386: sysret and sysexit are privileged Date: Fri, 23 Jun 2023 15:17:09 +0200 Message-ID: <20230623131711.96775-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230623131711.96775-1-pbonzini@redhat.com> References: <20230623131711.96775-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index a20b5af71e7..66800392bb9 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -5685,7 +5685,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) if (LMA(s) && env->cpuid_vendor1 != CPUID_VENDOR_INTEL_1) { goto illegal_op; } - if (!PE(s)) { + if (!PE(s) || CPL(s) != 0) { gen_exception_gpf(s); } else { gen_helper_sysexit(cpu_env, tcg_constant_i32(dflag - 1)); @@ -5711,7 +5711,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) if (!LMA(s) && env->cpuid_vendor1 == CPUID_VENDOR_INTEL_1) { goto illegal_op; } - if (!PE(s)) { + if (!PE(s) || CPL(s) != 0) { gen_exception_gpf(s); } else { gen_helper_sysret(cpu_env, tcg_constant_i32(dflag - 1)); From patchwork Fri Jun 23 13:17:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1799008 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SKdrdEGp; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QndB14hJQz20Wk for ; Fri, 23 Jun 2023 23:19:21 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgfQ-0004aY-CZ; Fri, 23 Jun 2023 09:17:36 -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 1qCgfO-0004Zr-OT for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCgfM-0005cQ-Tc for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687526252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z1TKWKdWTS3EIYTM+VUz4o7AGmp4YH25zCUbvYtLRVc=; b=SKdrdEGpaGsiTHT0PsfKnw0JQDyEzztW3m3YYAOeWSgwRGZ56xasg5RKtOSWJi6PfSZMzG Y4r6ExvAmamRYigKID2hH+ppcGM0I98hMFdgspW6jO7NhUB0nfvZWSlqoUGM8JZa6A6H1x 16Er7T3KH7oEHKI4B0G/qOjn9z4LOPI= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-655-XnhI3QNzOtylQ_1OS6DYdA-1; Fri, 23 Jun 2023 09:17:31 -0400 X-MC-Unique: XnhI3QNzOtylQ_1OS6DYdA-1 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-514a6909c35so400149a12.3 for ; Fri, 23 Jun 2023 06:17:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687526249; x=1690118249; 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=z1TKWKdWTS3EIYTM+VUz4o7AGmp4YH25zCUbvYtLRVc=; b=PhPADDcm+4q02YbQy/cV/wvH/IxvJmItlCfv47M0iigpdl6d8fStROGgnvipU68u4M yI9ZJgauDWevrPieuYha7/I8l6XtZeYLld1WpHdjkFV5I6nN7Oz9dUgiBIgwdGvNSUNI 4QuRUfBAgLyj+rnD/w9vxzn9qDFtU4oJSPBtlK5+j1KYjAsl3twgTDxYiggzhEtHJbcL eiXZQF2vHiCrOcgJ6zldakcBoMzOKt1lxjAdK+1Wx4h0jGxAl6luouK1p69fCTL8XKAH NfEBbTRg4UUsQKwnAJJe20BE/XnUQ2ooRPeZTDkh+kXU0rH4AZV+oWbXiw0lXNOswNh5 Nbyw== X-Gm-Message-State: AC+VfDyhaUIkulQBeavOPXxJQAmHgbkXUQmIsnB0S/6paIBmw6qBijoS Xvz9F4MrekKynZ+4tCTKJITVL+HkAJo3iIcDbsoAgG/5xf75oENtpp7W5LKQQ5yM4qWvNmLw0wc RmqQM+5uRn3KQZHRYX18CxOFEN0gXQQqabmtPpqjhTRH5SHVA2nW5Cmq2C0VuzcTQoynXlm54BU o= X-Received: by 2002:a17:907:1b17:b0:96f:1f79:c0a6 with SMTP id mp23-20020a1709071b1700b0096f1f79c0a6mr17660508ejc.70.1687526249560; Fri, 23 Jun 2023 06:17:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7QBT0vPaxPoEHWSH48Uo14C++CaXyMMUEk9iMPlxNEhU62BtOyq+wK8TCcu+p/KvQat35fVA== X-Received: by 2002:a17:907:1b17:b0:96f:1f79:c0a6 with SMTP id mp23-20020a1709071b1700b0096f1f79c0a6mr17660488ejc.70.1687526249226; Fri, 23 Jun 2023 06:17:29 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id me16-20020a170906aed000b0098669cc16b2sm5939079ejb.83.2023.06.23.06.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 06:17:28 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH v3 10/11] target/i386: implement RDPID in TCG Date: Fri, 23 Jun 2023 15:17:10 +0200 Message-ID: <20230623131711.96775-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230623131711.96775-1-pbonzini@redhat.com> References: <20230623131711.96775-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org RDPID corresponds to a RDMSR(TSC_AUX); however, it is unprivileged so for user-mode emulation we must provide the value that the kernel places in the MSR. For Linux, it is a combination of the current CPU and the current NUMA node, both of which can be retrieved with getcpu(2). Also try sched_getcpu(), which might be there on the BSDs. If there is no portable way to retrieve the current CPU id from userspace, return 0. RDTSCP is reimplemented as RDTSC + RDPID ECX; the differences in terms of serializability are not relevant to QEMU. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- meson.build | 2 ++ target/i386/cpu.c | 10 +++++++++- target/i386/helper.h | 2 +- target/i386/tcg/misc_helper.c | 21 +++++++++++++++------ target/i386/tcg/translate.c | 24 +++++++++++++++++++----- 5 files changed, 46 insertions(+), 13 deletions(-) diff --git a/meson.build b/meson.build index 6ef78ea278b..3e3d38badb0 100644 --- a/meson.build +++ b/meson.build @@ -2232,6 +2232,8 @@ config_host_data.set('CONFIG_CLOCK_ADJTIME', cc.has_function('clock_adjtime')) config_host_data.set('CONFIG_DUP3', cc.has_function('dup3')) config_host_data.set('CONFIG_FALLOCATE', cc.has_function('fallocate')) config_host_data.set('CONFIG_POSIX_FALLOCATE', cc.has_function('posix_fallocate')) +config_host_data.set('CONFIG_GETCPU', cc.has_function('getcpu', prefix: gnu_source_prefix)) +config_host_data.set('CONFIG_SCHED_GETCPU', cc.has_function('sched_getcpu', prefix: '#include ')) # Note that we need to specify prefix: here to avoid incorrectly # thinking that Windows has posix_memalign() config_host_data.set('CONFIG_POSIX_MEMALIGN', cc.has_function('posix_memalign', prefix: '#include ')) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 978d24b5ec7..4d52e612ac7 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -661,9 +661,17 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1, /* missing: CPUID_7_0_EBX_HLE CPUID_7_0_EBX_INVPCID, CPUID_7_0_EBX_RTM */ + +#if defined CONFIG_SOFTMMU || defined CONFIG_LINUX +#define TCG_7_0_ECX_RDPID CPUID_7_0_ECX_RDPID +#else +#define TCG_7_0_ECX_RDPID 0 +#endif #define TCG_7_0_ECX_FEATURES (CPUID_7_0_ECX_UMIP | CPUID_7_0_ECX_PKU | \ /* CPUID_7_0_ECX_OSPKE is dynamic */ \ - CPUID_7_0_ECX_LA57 | CPUID_7_0_ECX_PKS | CPUID_7_0_ECX_VAES) + CPUID_7_0_ECX_LA57 | CPUID_7_0_ECX_PKS | CPUID_7_0_ECX_VAES | \ + TCG_7_0_ECX_RDPID) + #define TCG_7_0_EDX_FEATURES CPUID_7_0_EDX_FSRM #define TCG_7_1_EAX_FEATURES (CPUID_7_1_EAX_FZRM | CPUID_7_1_EAX_FSRS | \ CPUID_7_1_EAX_FSRC) diff --git a/target/i386/helper.h b/target/i386/helper.h index 48609c210b1..c93c1d6c8f5 100644 --- a/target/i386/helper.h +++ b/target/i386/helper.h @@ -69,8 +69,8 @@ DEF_HELPER_2(into, void, env, int) DEF_HELPER_FLAGS_1(single_step, TCG_CALL_NO_WG, noreturn, env) DEF_HELPER_1(rechecking_single_step, void, env) DEF_HELPER_1(cpuid, void, env) +DEF_HELPER_FLAGS_1(rdpid, TCG_CALL_NO_WG, tl, env) DEF_HELPER_1(rdtsc, void, env) -DEF_HELPER_1(rdtscp, void, env) DEF_HELPER_FLAGS_1(rdpmc, TCG_CALL_NO_WG, noreturn, env) #ifndef CONFIG_USER_ONLY diff --git a/target/i386/tcg/misc_helper.c b/target/i386/tcg/misc_helper.c index 5f7a3061ca5..868f36ab7f5 100644 --- a/target/i386/tcg/misc_helper.c +++ b/target/i386/tcg/misc_helper.c @@ -75,12 +75,6 @@ void helper_rdtsc(CPUX86State *env) env->regs[R_EDX] = (uint32_t)(val >> 32); } -void helper_rdtscp(CPUX86State *env) -{ - helper_rdtsc(env); - env->regs[R_ECX] = (uint32_t)(env->tsc_aux); -} - G_NORETURN void helper_rdpmc(CPUX86State *env) { if (((env->cr[4] & CR4_PCE_MASK) == 0 ) && @@ -137,3 +131,18 @@ void helper_wrpkru(CPUX86State *env, uint32_t ecx, uint64_t val) env->pkru = val; tlb_flush(cs); } + +target_ulong HELPER(rdpid)(CPUX86State *env) +{ +#if defined CONFIG_SOFTMMU + return env->tsc_aux; +#elif defined CONFIG_LINUX && defined CONFIG_GETCPU + unsigned cpu, node; + getcpu(&cpu, &node); + return (node << 12) | (cpu & 0xfff); +#elif defined CONFIG_SCHED_GETCPU + return sched_getcpu(); +#else + return 0; +#endif +} diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 66800392bb9..a6c24241338 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -3924,13 +3924,25 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) gen_cmpxchg8b(s, env, modrm); break; - case 7: /* RDSEED */ + case 7: /* RDSEED, RDPID with f3 prefix */ if (mod != 3 || - (s->prefix & (PREFIX_LOCK | PREFIX_REPZ | PREFIX_REPNZ)) || - !(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_RDSEED)) { + (s->prefix & (PREFIX_LOCK | PREFIX_REPNZ))) { goto illegal_op; } - goto do_rdrand; + if (s->prefix & PREFIX_REPZ) { + if (!(s->cpuid_ext_features & CPUID_7_0_ECX_RDPID)) { + goto illegal_op; + } + gen_helper_rdpid(s->T0, cpu_env); + rm = (modrm & 7) | REX_B(s); + gen_op_mov_reg_v(s, dflag, rm, s->T0); + break; + } else { + if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_RDSEED)) { + goto illegal_op; + } + goto do_rdrand; + } case 6: /* RDRAND */ if (mod != 3 || @@ -6125,7 +6137,9 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) gen_update_cc_op(s); gen_update_eip_cur(s); translator_io_start(&s->base); - gen_helper_rdtscp(cpu_env); + gen_helper_rdtsc(cpu_env); + gen_helper_rdpid(s->T0, cpu_env); + gen_op_mov_reg_v(s, dflag, R_ECX, s->T0); break; default: From patchwork Fri Jun 23 13:17:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1799003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=D96wBcPq; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qnd8j4FFjz20Wk for ; Fri, 23 Jun 2023 23:18:13 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgfT-0004ar-1h; Fri, 23 Jun 2023 09:17:39 -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 1qCgfR-0004aa-C5 for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCgfP-0005cq-Ec for qemu-devel@nongnu.org; Fri, 23 Jun 2023 09:17:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687526254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LMOwH0aObN7XtN7vdF9lFgenKbujdWtyVueTxJna5Bg=; b=D96wBcPqkOliLz8rKLDPZNIsYwH1IXmsVCTONQSYetSKMpKZECbzcJ+fC9AKWOXnl5ARHk B5KMFHwo4jP/T603NaIuOLpw3xUHMmXYRamOUUeBxjxqjXDCpHwsbFvZio3TWrcidzaYHl KaxPWtUxJ7r3z4BL/Sgvobhe9cZsHfY= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-665-jcsULCI1N8SotoUdbpzu8g-1; Fri, 23 Jun 2023 09:17:32 -0400 X-MC-Unique: jcsULCI1N8SotoUdbpzu8g-1 Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-50bf847b267so369419a12.3 for ; Fri, 23 Jun 2023 06:17:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687526251; x=1690118251; 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=LMOwH0aObN7XtN7vdF9lFgenKbujdWtyVueTxJna5Bg=; b=Rvk7H+3ULwthW3Ey6B98DhsSva9svdGP/5W4MYZqS8/JZXlcpqGAF3nwpaHMevCfXm XPKuHgg+kUfjna4X5UnR3oHr0+RejeQrQ2CFHnR+SguTuRTOteVy6JR2neOvgU+R+7BZ 7041BokTI4VHfjs1ACIQiSLHRikrTFLOVRsHobGbA+WrfwBdt7f1uX1szxOi0uWkIRgh WaVd9EzT70/80fKuUXACtDhuYOwU2raTtYCQ8kNpS5ppLsA+KrnR1JTZE6lL/7hzQiQJ OMFn/ITl2w2y5udiqZvfOn/ADnUTN/bT9fZn5CT5kJIKWsbjBdfk41fcK6gwm6p3aBkr 0Cbg== X-Gm-Message-State: AC+VfDz+nYude0UtrBYvMSPeYbKXGnftL7xwB6fEDQrgArbgfPoY+e37 NDh1e+iKLafrSWsaXmacu1Ujb+AXX+U5VCn5QGABW+XcQ8CIumku8i9qEtTbXrTPvzquvtVs54B sxK0PZbOzOiMszwLJVWzJr4fuZckGSufuII6mqanSV3Xaa7teIuE9h4Q4kdabQcqoT/2yRSG41F g= X-Received: by 2002:a50:fc07:0:b0:51a:60be:7d5a with SMTP id i7-20020a50fc07000000b0051a60be7d5amr8474576edr.14.1687526251125; Fri, 23 Jun 2023 06:17:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7S7tfAfozRMSEq/cRulNkPVWmnA1u8zuY1y46qL84Lf5swQhdSv9TF0oie+r53UkorwsLyig== X-Received: by 2002:a50:fc07:0:b0:51a:60be:7d5a with SMTP id i7-20020a50fc07000000b0051a60be7d5amr8474561edr.14.1687526250814; Fri, 23 Jun 2023 06:17:30 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id t24-20020aa7d4d8000000b0051a4a1abdbbsm5206767edr.49.2023.06.23.06.17.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 06:17:30 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH v3 11/11] target/i386: implement SYSCALL/SYSRET in 32-bit emulators Date: Fri, 23 Jun 2023 15:17:11 +0200 Message-ID: <20230623131711.96775-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230623131711.96775-1-pbonzini@redhat.com> References: <20230623131711.96775-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org AMD supports both 32-bit and 64-bit SYSCALL/SYSRET, but the TCG only exposes it for 64-bit targets. For system emulation just reuse the helper; for user-mode emulation the ABI is the same as "int $80". The BSDs does not support any fast system call mechanism in 32-bit mode so add to bsd-user the same stub that FreeBSD has for 64-bit compatibility mode. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- bsd-user/i386/target_arch_cpu.h | 4 ++++ linux-user/i386/cpu_loop.c | 13 +++++++++---- target/i386/cpu.c | 4 ++-- target/i386/helper.h | 2 -- target/i386/tcg/seg_helper.c | 7 +++++-- target/i386/tcg/sysemu/seg_helper.c | 7 ++++--- target/i386/tcg/translate.c | 2 -- target/i386/tcg/user/seg_helper.c | 2 -- 8 files changed, 24 insertions(+), 17 deletions(-) diff --git a/bsd-user/i386/target_arch_cpu.h b/bsd-user/i386/target_arch_cpu.h index d792dc720f9..9bf2c4244b7 100644 --- a/bsd-user/i386/target_arch_cpu.h +++ b/bsd-user/i386/target_arch_cpu.h @@ -164,6 +164,10 @@ static inline void target_cpu_loop(CPUX86State *env) } break; + case EXCP_SYSCALL: + /* doesn't do anything */ + break; + case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ break; diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index 2d0918a93ff..3283f08cd9c 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -211,6 +211,9 @@ void cpu_loop(CPUX86State *env) switch(trapnr) { case 0x80: +#ifndef TARGET_X86_64 + case EXCP_SYSCALL: +#endif /* linux syscall from int $0x80 */ ret = do_syscall(env, env->regs[R_EAX], @@ -227,9 +230,13 @@ void cpu_loop(CPUX86State *env) env->regs[R_EAX] = ret; } break; -#ifndef TARGET_ABI32 +#ifdef TARGET_X86_64 case EXCP_SYSCALL: - /* linux syscall from syscall instruction */ + /* + * linux syscall from syscall instruction. Note that x32 also + * uses the SYSCALL instruction and the 64-bit syscall table, + * so this uses TARGET_X86_64 not TARGET_ABI32. + */ ret = do_syscall(env, env->regs[R_EAX], env->regs[R_EDI], @@ -245,8 +252,6 @@ void cpu_loop(CPUX86State *env) env->regs[R_EAX] = ret; } break; -#endif -#ifdef TARGET_X86_64 case EXCP_VSYSCALL: emulate_vsyscall(env); break; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 4d52e612ac7..c0fb6b3ad92 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -637,7 +637,7 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1, CPUID_EXT_X2APIC, CPUID_EXT_TSC_DEADLINE_TIMER */ #ifdef TARGET_X86_64 -#define TCG_EXT2_X86_64_FEATURES (CPUID_EXT2_SYSCALL | CPUID_EXT2_LM) +#define TCG_EXT2_X86_64_FEATURES CPUID_EXT2_LM #else #define TCG_EXT2_X86_64_FEATURES 0 #endif @@ -645,7 +645,7 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1, #define TCG_EXT2_FEATURES ((TCG_FEATURES & CPUID_EXT2_AMD_ALIASES) | \ CPUID_EXT2_NX | CPUID_EXT2_MMXEXT | CPUID_EXT2_RDTSCP | \ CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT | CPUID_EXT2_PDPE1GB | \ - TCG_EXT2_X86_64_FEATURES) + CPUID_EXT2_SYSCALL | TCG_EXT2_X86_64_FEATURES) #define TCG_EXT3_FEATURES (CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM | \ CPUID_EXT3_CR8LEG | CPUID_EXT3_ABM | CPUID_EXT3_SSE4A | \ CPUID_EXT3_3DNOWPREFETCH) diff --git a/target/i386/helper.h b/target/i386/helper.h index c93c1d6c8f5..ac2b04abd63 100644 --- a/target/i386/helper.h +++ b/target/i386/helper.h @@ -51,10 +51,8 @@ DEF_HELPER_FLAGS_2(get_dr, TCG_CALL_NO_WG, tl, env, int) DEF_HELPER_1(sysenter, void, env) DEF_HELPER_2(sysexit, void, env, int) -#ifdef TARGET_X86_64 DEF_HELPER_2(syscall, void, env, int) DEF_HELPER_2(sysret, void, env, int) -#endif DEF_HELPER_FLAGS_2(pause, TCG_CALL_NO_WG, noreturn, env, int) DEF_HELPER_FLAGS_3(raise_interrupt, TCG_CALL_NO_WG, noreturn, env, int, int) DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_WG, noreturn, env, int) diff --git a/target/i386/tcg/seg_helper.c b/target/i386/tcg/seg_helper.c index 03b58e94a2d..e8d19c65fdc 100644 --- a/target/i386/tcg/seg_helper.c +++ b/target/i386/tcg/seg_helper.c @@ -977,6 +977,7 @@ static void do_interrupt64(CPUX86State *env, int intno, int is_int, e2); env->eip = offset; } +#endif /* TARGET_X86_64 */ void helper_sysret(CPUX86State *env, int dflag) { @@ -990,6 +991,7 @@ void helper_sysret(CPUX86State *env, int dflag) raise_exception_err_ra(env, EXCP0D_GPF, 0, GETPC()); } selector = (env->star >> 48) & 0xffff; +#ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { cpu_load_eflags(env, (uint32_t)(env->regs[11]), TF_MASK | AC_MASK | ID_MASK | IF_MASK | IOPL_MASK | VM_MASK | RF_MASK | @@ -1015,7 +1017,9 @@ void helper_sysret(CPUX86State *env, int dflag) DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_W_MASK | DESC_A_MASK); - } else { + } else +#endif + { env->eflags |= IF_MASK; cpu_x86_load_seg_cache(env, R_CS, selector | 3, 0, 0xffffffff, @@ -1030,7 +1034,6 @@ void helper_sysret(CPUX86State *env, int dflag) DESC_W_MASK | DESC_A_MASK); } } -#endif /* TARGET_X86_64 */ /* real mode interrupt */ static void do_interrupt_real(CPUX86State *env, int intno, int is_int, diff --git a/target/i386/tcg/sysemu/seg_helper.c b/target/i386/tcg/sysemu/seg_helper.c index 2c9bd007adb..1cb5a0db45c 100644 --- a/target/i386/tcg/sysemu/seg_helper.c +++ b/target/i386/tcg/sysemu/seg_helper.c @@ -26,7 +26,6 @@ #include "tcg/helper-tcg.h" #include "../seg_helper.h" -#ifdef TARGET_X86_64 void helper_syscall(CPUX86State *env, int next_eip_addend) { int selector; @@ -35,6 +34,7 @@ void helper_syscall(CPUX86State *env, int next_eip_addend) raise_exception_err_ra(env, EXCP06_ILLOP, 0, GETPC()); } selector = (env->star >> 32) & 0xffff; +#ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { int code64; @@ -61,7 +61,9 @@ void helper_syscall(CPUX86State *env, int next_eip_addend) } else { env->eip = env->cstar; } - } else { + } else +#endif + { env->regs[R_ECX] = (uint32_t)(env->eip + next_eip_addend); env->eflags &= ~(IF_MASK | RF_MASK | VM_MASK); @@ -78,7 +80,6 @@ void helper_syscall(CPUX86State *env, int next_eip_addend) env->eip = (uint32_t)env->star; } } -#endif /* TARGET_X86_64 */ void handle_even_inj(CPUX86State *env, int intno, int is_int, int error_code, int is_hw, int rm) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index a6c24241338..28cb3fb7f4b 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -5704,7 +5704,6 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) s->base.is_jmp = DISAS_EOB_ONLY; } break; -#ifdef TARGET_X86_64 case 0x105: /* syscall */ /* For Intel SYSCALL is only valid in long mode */ if (!LMA(s) && env->cpuid_vendor1 == CPUID_VENDOR_INTEL_1) { @@ -5738,7 +5737,6 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) gen_eob_worker(s, false, true); } break; -#endif case 0x1a2: /* cpuid */ gen_update_cc_op(s); gen_update_eip_cur(s); diff --git a/target/i386/tcg/user/seg_helper.c b/target/i386/tcg/user/seg_helper.c index 67481b0aa8e..c45f2ac2ba6 100644 --- a/target/i386/tcg/user/seg_helper.c +++ b/target/i386/tcg/user/seg_helper.c @@ -26,7 +26,6 @@ #include "tcg/helper-tcg.h" #include "tcg/seg_helper.h" -#ifdef TARGET_X86_64 void helper_syscall(CPUX86State *env, int next_eip_addend) { CPUState *cs = env_cpu(env); @@ -36,7 +35,6 @@ void helper_syscall(CPUX86State *env, int next_eip_addend) env->exception_next_eip = env->eip + next_eip_addend; cpu_loop_exit(cs); } -#endif /* TARGET_X86_64 */ /* * fake user mode interrupt. is_int is TRUE if coming from the int