From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778186; cv=none; d=zohomail.com; s=zohoarc; b=PtdbW6JA7Chah6dic33RtHeCfYhgqddYXVt7KvR9cDoDmuMDUxG2VtcPcoaoN0yZX5GHwvkPKrnPJIizsjt9cY6FDTdBHmDJYB4MxI4k6RwU8HrgXtjzwyvUsLJC/0YolRdlEdsmvgXO6+P8rjOOoCLrbj41E0aWUYp1v7owoXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778186; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wRAc6f7nKmkBx5cWgWSx5rm/aX7MA5Hq+gKL60VbYs8=; b=Sr9k9BZOVv6G/3g8gHDYsvR3yW2f8rcgFKVstUMR4tBMdhzUvOxb7tW2a4diEVhzcJcKWEBX1w18Xarp33uGcZKuCO8pPD4y0qOm6ICLQU7u9fgNFOZOhcQL2lBL1uZRLtqBxUHBF0c3ZIRuONJTE9xhvhufxubKnhzFI9OV+4Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778186068764.3496806235501; Mon, 26 Jun 2023 04:16:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBN-0002ui-Oe; Mon, 26 Jun 2023 07:14:57 -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 1qDkBL-0002tl-50 for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:14:55 -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 1qDkBJ-0000XB-7y for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:14:54 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-383-7YsDpl3EOOCAUPR4oviztg-1; Mon, 26 Jun 2023 07:14:50 -0400 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3fa7b245a75so14101575e9.0 for ; Mon, 26 Jun 2023 04:14:50 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id l21-20020a7bc455000000b003fa95c466a1sm2937195wmi.5.2023.06.26.04.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778091; 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=wRAc6f7nKmkBx5cWgWSx5rm/aX7MA5Hq+gKL60VbYs8=; b=IcQAE5Ox08DsmiN1JCn1pUSRK+ZH6HLHlxIYn5p63JZoTYf/Kcn/0bqXYdpKzeDklbWk7j z+XNPkbfrF4O18YGh3KT/k9Vl2c8DdWwkQsbJbEJlVPFovasOvuEOiNEK3KAGU0IhUzoWq N5mbQfx6J5wPKBTPYs/U8+nIZx1sBhE= X-MC-Unique: 7YsDpl3EOOCAUPR4oviztg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778088; x=1690370088; 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=wRAc6f7nKmkBx5cWgWSx5rm/aX7MA5Hq+gKL60VbYs8=; b=XJbg8Q4QUh2FvXzmrxJcRiYB7CWPhEDJk8HzGOkch/B43EuGnn+mVcBInhYFhvwLOI Bu9ladilSXP3QlZRmHxViwrEvIbNgTwjgbhdvo+tFlT77z0FWlXlhHW9wA57rk6I1wO1 xBSQgE3swhwozevcDdI4rBxKgY4LViIb8T8+9UEqxzIeVbC2Z/J9PaZaW0GCh4FTfNPu VfGen1yLTd9jOuGa04KwhpKUIMnPggnbw5DKuVqJGoqtPzqmYBVqPpDEXE01X8m/mPra VkCxqlHw+3SKSBCzpBsh+wv4zr7eF4BF/mVvElOJbFMyqcfylShfplXuei1kjQBOXhV6 xs2A== X-Gm-Message-State: AC+VfDyH3/2VVsZ67mC8t0yyIPdMPDu9yl57Trh5dCirVxn2srT/1KPp arqKH/epLe+P36wdRuXxTNgCjAff3ou82p9fCM+sL8VfiKN86TdAG/Bku1hRiyFoQUYeLW0+pz6 s0dnNxNHqaQwjkfoSlM2l+BiPW/TqcLmDZbQaJEbSHMYYuVxz6u7LW6TEYD4z38/spp1NOt6DMi s= X-Received: by 2002:a05:600c:10d1:b0:3f7:a20a:561d with SMTP id l17-20020a05600c10d100b003f7a20a561dmr27128677wmd.8.1687778088622; Mon, 26 Jun 2023 04:14:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6/QZzGNfz4wlk4+aVy1mQhS+9gAE3qsDvnz9NeLI0owx9NmxLfupAL7JjY51eMKrqsYuieqQ== X-Received: by 2002:a05:600c:10d1:b0:3f7:a20a:561d with SMTP id l17-20020a05600c10d100b003f7a20a561dmr27128655wmd.8.1687778088224; Mon, 26 Jun 2023 04:14:48 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 01/18] build: further refine build.ninja rules Date: Mon, 26 Jun 2023 13:14:28 +0200 Message-ID: <20230626111445.163573-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778186906100001 Content-Type: text/plain; charset="utf-8" In commit b0fcc6fc7fc1 ("build: rebuild build.ninja using "meson setup --reconfigure"", 2023-05-19) I changed the build.ninja rule in the Makefile to use "meson setup" so that the Makefile would pick up a changed path to the meson binary. However, there was a reason why build.ninja was rebuilt using $(NINJA) itself. Namely, ninja has its own cache of file modification times, and if it does not know about the modification that was done outside its control, it will *also* try to regenerate build.ninja. This can be simply by running "make" on a fresh tree immediately after "configure"; that will trigger an unnecessary meson run. So, apply a refinement to the rule in order to cover both cases: - track the meson binary that was used (and that is embedded in build.ninja's reconfigure rules); to do this, write build.ninja.stamp right after executing meson successfully - if it changed, force usage of "$(MESON) setup --reconfigure" to update the path in the reconfigure rule - if it didn't change, use "$(NINJA) build.ninja" just like before commit b0fcc6fc7fc1. Reported-by: Mark Cave-Ayland Tested-by: Mark Cave-Ayland Signed-off-by: Paolo Bonzini --- Makefile | 17 +++++++++++++---- configure | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index b22bf6fba12..804a5681e0a 100644 --- a/Makefile +++ b/Makefile @@ -83,16 +83,17 @@ config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/scri= pts/meson-buildoptions.sh @if test -f meson-private/coredata.dat; then \ ./config.status --skip-meson; \ else \ - ./config.status && touch build.ninja.stamp; \ + ./config.status; \ fi =20 # 2. meson.stamp exists if meson has run at least once (so ninja reconfigu= re # works), but otherwise never needs to be updated + meson-private/coredata.dat: meson.stamp meson.stamp: config-host.mak @touch meson.stamp =20 -# 3. ensure generated build files are up-to-date +# 3. ensure meson-generated build files are up-to-date =20 ifneq ($(NINJA),) Makefile.ninja: build.ninja @@ -106,11 +107,19 @@ Makefile.ninja: build.ninja endif =20 ifneq ($(MESON),) -# A separate rule is needed for Makefile dependencies to avoid -n +# The path to meson always points to pyvenv/bin/meson, but the absolute +# paths could change. In that case, force a regeneration of build.ninja. +# Note that this invocation of $(NINJA), just like when Make rebuilds +# Makefiles, does not include -n. build.ninja: build.ninja.stamp $(build-files): build.ninja.stamp: meson.stamp $(build-files) - $(MESON) setup --reconfigure $(SRC_PATH) && touch $@ + @if test "$$(cat build.ninja.stamp)" =3D "$(MESON)" && test -n "$(NINJA)"= ; then \ + $(NINJA) build.ninja; \ + else \ + echo "$(MESON) setup --reconfigure $(SRC_PATH)"; \ + $(MESON) setup --reconfigure $(SRC_PATH); \ + fi && echo "$(MESON)" > $@ =20 Makefile.mtest: build.ninja scripts/mtest2make.py $(MESON) introspect --targets --tests --benchmarks | $(PYTHON) scripts/mt= est2make.py > $@ diff --git a/configure b/configure index 01a53576a7d..86363a7e508 100755 --- a/configure +++ b/configure @@ -1895,6 +1895,7 @@ if test "$skip_meson" =3D no; then if test "$?" -ne 0 ; then error_exit "meson setup failed" fi + echo "$meson" > build.ninja.stamp else if test -f meson-private/cmd_line.txt; then # Adjust old command line options that were removed --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778397; cv=none; d=zohomail.com; s=zohoarc; b=mq9s1lbsBe3GDDUEQTzJr0XWL8EEey7cfqjfK8zlo8ncAXFgClP+QlL0s99J7fVR9CT5SGNA9ddCkSU5JLPk+jx7NidZ3+s54uhUIo6K6Ebw1JmYARQ0Wqdm/Q2wQtZpRhoLKouZk1cN3+z/+SeezAE4qDI12g1p/7onKLjbGsY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778397; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SxFcgxnhKliDRkn36lhP8Pf5Rcfhb0VjyF7Bnb87z1w=; b=mmF4tGlYo34h+Zv/EbUviZpZlR5LnoerbhytWPQ7BwNxnlxQbS1z688jyzp1h0O+rzjAyEus4C0/P56EVOgoRUkArPGkMhcCpgjJEhcsGH5BAdGXXloCALUcc2HIJb2KhEi+y6OE4KwOZmGpBmUsz96P2gTG9o4XHBMZ85PVPJE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778397089358.34058019053464; Mon, 26 Jun 2023 04:19:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBO-0002uw-Qm; Mon, 26 Jun 2023 07:14:58 -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 1qDkBL-0002uA-Mk for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:14:56 -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 1qDkBK-0000XO-5O for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:14:55 -0400 Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-473-3xXaImKOOkCgPxd3HkVnFA-1; Mon, 26 Jun 2023 07:14:51 -0400 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-4fab61bb53bso1007684e87.0 for ; Mon, 26 Jun 2023 04:14:51 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id y12-20020a7bcd8c000000b003fa79af15c7sm10423536wmj.2.2023.06.26.04.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778093; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SxFcgxnhKliDRkn36lhP8Pf5Rcfhb0VjyF7Bnb87z1w=; b=aB9/wtxEYpC0heoVY1R2XEyAF/n+6aqOasbxTQ9qvMGAoML9llTpKZFjq/m/tZTU2ViDbt 3sUj0X9wMo5Ok2tda4vmYlwin8I9cqjjMXQcpePPoYkh/kilFhBTz05UX1AA3R7ptFyW2S jyzA+isF2PCa4D/Eqoxpvv0nNELSHnA= X-MC-Unique: 3xXaImKOOkCgPxd3HkVnFA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778090; x=1690370090; 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=SxFcgxnhKliDRkn36lhP8Pf5Rcfhb0VjyF7Bnb87z1w=; b=dP+gmuk1Htzs6rv3qoR7h1bbhUV19tL8qKBo4HWr36aS/T1kBaAUwPBU36Za9RHyhl 8OED9gCkiJx/q+bPF381y6pTI/hYJkJiEBNz5sUxxiflS/TCboGjRgiNC3DH5BoBWDSA 895w1FkGAI5H9ruM2xsx+c8SEfgJl0KqzCX06YNqJShihLaF+5bfEoMflyosQyIOv7GR l15OoRhiWsG9z12Z7bdLGdVqt2CdADUEMzcvTL/x0NjJ9fnDhFm0oPxMyJvLrbLflngf g3C2+N9/nZNlnnBSOOGa9nmwpq0qqcrRHd1NYc2RTXiDTnQ9U40XPS9O8Hz/ivnjvBhf dJNg== X-Gm-Message-State: AC+VfDyh8MmcvR3JnBGaMpNftVwU0YeTPgQ61qp5/OQ6slopgTmrL9rS Mnelzay8bEyRfT3+v5y73gTGgcN4zuXYjhlnTEBuw4/u7TQ2eFZcOEAx0JUcP0bDZye8obPYJob uXtEPk7B4cDddJREXZCwnKReAkvCt2oCiUjJiNTdFNT8NmD/Tn+qia/WMRsSA7sbt5DkIM2Facd g= X-Received: by 2002:a05:6512:3d94:b0:4f9:5d8d:ccb8 with SMTP id k20-20020a0565123d9400b004f95d8dccb8mr10374511lfv.17.1687778090029; Mon, 26 Jun 2023 04:14:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7LzYlFfQdBmAi16Voz02sz5QODt/SZuW/cj5CToKpRHCUc7VPue8ZsZuxE0KZsz6hmhtVzLg== X-Received: by 2002:a05:6512:3d94:b0:4f9:5d8d:ccb8 with SMTP id k20-20020a0565123d9400b004f95d8dccb8mr10374502lfv.17.1687778089741; Mon, 26 Jun 2023 04:14:49 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 02/18] hw/remote/proxy: Remove dubious 'event_notifier-posix.c' include Date: Mon, 26 Jun 2023 13:14:29 +0200 Message-ID: <20230626111445.163573-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778398688100007 From: Philippe Mathieu-Daud=C3=A9 event_notifier-posix.c is registered in meson's util_ss[] source set, which is built as libqemuutil.a.p library. Both tools and system emulation binaries are linked with qemuutil, so there is no point in including this source file. Introduced in commit bd36adb8df ("multi-process: create IOHUB object to handle irq"). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230606134913.93724-1-philmd@linaro.org> Signed-off-by: Paolo Bonzini --- hw/remote/proxy.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/remote/proxy.c b/hw/remote/proxy.c index 1c7786b52cf..2052d721e5c 100644 --- a/hw/remote/proxy.c +++ b/hw/remote/proxy.c @@ -22,7 +22,6 @@ #include "qom/object.h" #include "qemu/event_notifier.h" #include "sysemu/kvm.h" -#include "util/event_notifier-posix.c" =20 static void probe_pci_info(PCIDevice *dev, Error **errp); static void proxy_device_reset(DeviceState *dev); --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778119; cv=none; d=zohomail.com; s=zohoarc; b=bbpaOkEJj+G36O3yLELnlJZhnciGR6oRg9ox4M+fOQ6l+RYynM5rgLnZhdjjFp7ZpuSmRv02f7gr/Fl5DuTnmtDS5+OuaBYJWUjDDPIWA5R+xZ9/LWNhQtiC4RWM490f2OaiNSTPdk7CbI9NRJIiZMzOPIwoINi4JaDaPex6ldg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778119; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=N/S6qyTBc6TH7FdAe5KsHnG9S25rCXrSryg8HIOYMkQ=; b=eRJvPckCKDk01gYHDw/p9LSRuDc950EVQ5hfyoV6pV1ONgtGPCXlAieD79yY2+WXMX14anpxqzNbl6kzx0rIe8D+2QW/PL+/Ybc93AwMMdQiGlGGEsh44rVYLTr5OKxKRDc+abP1/NsJ9xIIHOFTHT//SDX+Tjpe9sGby34qn18= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778119044255.37243618009097; Mon, 26 Jun 2023 04:15:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBT-0002vD-QI; Mon, 26 Jun 2023 07:15:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDkBM-0002uK-Sw for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:14:57 -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 1qDkBL-0000Xb-6Q for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:14:56 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-147-AAydx8J9OBuuh9uAYytPPQ-1; Mon, 26 Jun 2023 07:14:53 -0400 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3fb40ec952bso630455e9.0 for ; Mon, 26 Jun 2023 04:14:53 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id u13-20020a5d514d000000b0030e56a9ff25sm7021409wrt.31.2023.06.26.04.14.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778094; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N/S6qyTBc6TH7FdAe5KsHnG9S25rCXrSryg8HIOYMkQ=; b=bnf83QadTw15f1UBib3ck+c51Ml8ydre9+jUZM+NprLsniLfpGWj/omeVskNVQL2gXrkeY qocUvgnYH5aoTDxoTNQ+Ta9PZEhKz4lUcU0Sf9O7zSy11sjUkSEnIgxYfIqxr6UBNNC2JM kYxRs3aULmIak2C/1n/Df4gJI/Z4/No= X-MC-Unique: AAydx8J9OBuuh9uAYytPPQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778091; x=1690370091; 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=N/S6qyTBc6TH7FdAe5KsHnG9S25rCXrSryg8HIOYMkQ=; b=eCMuSLMNrrW5FG2SpgnNnglhQhFNnIUUUgyTRmqFZ8G0EbfOK/EaClqGT430mVDQXL zHdSpR/2JLtUElhpp8Jl0iUrCuPH/ru3itHsQ12HDxyFbORHmhRv/KCXR+6Szkj2u/+Y AgcOlG5cZawxU09R77QuFJDFqhT7kGzVeOFvgVdbrwAYQJqYrLPkotUPmfgeRadB93ub o+JECJ90NgZmJ5aJuGsKUdhOcovBwjuce1lqmSU4LOf0RIWGSysyZf7J/T6vZNuLFSNr IveKOirEEF9S4JLa1gn0rBv1eTdn5zaA2jIeLAQ3nRPMqbETbJ59CcMCquBGGp1Mf+PP D1+w== X-Gm-Message-State: AC+VfDx5QcRBn7a/i+VSugihFj/oq3LvVorKYZjGqcbrTOFYjkV28Lj3 zws1vrweqo+jLKNnSbqmQoEXjgploDb7h3neOnHQnXWYc3IQq3EwdLqF066QyOtdo0wl4NBLm+e Vasl20uq/ugMw0KKbdShw6u1G1uAqoHX0xovPMSmbBausQgEvWN4pPwJbAnBBqvI9eZV8/a4xrC o= X-Received: by 2002:a05:600c:21a:b0:3fa:7810:8cbf with SMTP id 26-20020a05600c021a00b003fa78108cbfmr8900592wmi.3.1687778091554; Mon, 26 Jun 2023 04:14:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ59Crv9cAGxW/lBOraSPml83ypF2GtPx4a6sWc95hl9ZqN/u/R0mlerhtJTgtnAhkc7WliyFQ== X-Received: by 2002:a05:600c:21a:b0:3fa:7810:8cbf with SMTP id 26-20020a05600c021a00b003fa78108cbfmr8900582wmi.3.1687778091213; Mon, 26 Jun 2023 04:14:51 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Gavin Shan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Igor Mammedov Subject: [PULL 03/18] numa: Validate cluster and NUMA node boundary if required Date: Mon, 26 Jun 2023 13:14:30 +0200 Message-ID: <20230626111445.163573-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778120644100003 From: Gavin Shan For some architectures like ARM64, multiple CPUs in one cluster can be associated with different NUMA nodes, which is irregular configuration because we shouldn't have this in baremetal environment. The irregular configuration causes Linux guest to misbehave, as the following warning messages indicate. -smp 6,maxcpus=3D6,sockets=3D2,clusters=3D1,cores=3D3,threads=3D1 \ -numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram0 \ -numa node,nodeid=3D1,cpus=3D2-3,memdev=3Dram1 \ -numa node,nodeid=3D2,cpus=3D4-5,memdev=3Dram2 \ ------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at kernel/sched/topology.c:2271 build_sched_domain= s+0x284/0x910 Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-268.el9.aarch64 #1 pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) pc : build_sched_domains+0x284/0x910 lr : build_sched_domains+0x184/0x910 sp : ffff80000804bd50 x29: ffff80000804bd50 x28: 0000000000000002 x27: 0000000000000000 x26: ffff800009cf9a80 x25: 0000000000000000 x24: ffff800009cbf840 x23: ffff000080325000 x22: ffff0000005df800 x21: ffff80000a4ce508 x20: 0000000000000000 x19: ffff000080324440 x18: 0000000000000014 x17: 00000000388925c0 x16: 000000005386a066 x15: 000000009c10cc2e x14: 00000000000001c0 x13: 0000000000000001 x12: ffff00007fffb1a0 x11: ffff00007fffb180 x10: ffff80000a4ce508 x9 : 0000000000000041 x8 : ffff80000a4ce500 x7 : ffff80000a4cf920 x6 : 0000000000000001 x5 : 0000000000000001 x4 : 0000000000000007 x3 : 0000000000000002 x2 : 0000000000001000 x1 : ffff80000a4cf928 x0 : 0000000000000001 Call trace: build_sched_domains+0x284/0x910 sched_init_domains+0xac/0xe0 sched_init_smp+0x48/0xc8 kernel_init_freeable+0x140/0x1ac kernel_init+0x28/0x140 ret_from_fork+0x10/0x20 Improve the situation to warn when multiple CPUs in one cluster have been associated with different NUMA nodes. However, one NUMA node is allowed to be associated with different clusters. Signed-off-by: Gavin Shan Acked-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Igor Mammedov Message-Id: <20230509002739.18388-2-gshan@redhat.com> Signed-off-by: Paolo Bonzini --- hw/core/machine.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/hw/boards.h | 1 + 2 files changed, 43 insertions(+) diff --git a/hw/core/machine.c b/hw/core/machine.c index 1000406211f..46f8f9a2b04 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1262,6 +1262,45 @@ static void machine_numa_finish_cpu_init(MachineStat= e *machine) g_string_free(s, true); } =20 +static void validate_cpu_cluster_to_numa_boundary(MachineState *ms) +{ + MachineClass *mc =3D MACHINE_GET_CLASS(ms); + NumaState *state =3D ms->numa_state; + const CPUArchIdList *possible_cpus =3D mc->possible_cpu_arch_ids(ms); + const CPUArchId *cpus =3D possible_cpus->cpus; + int i, j; + + if (state->num_nodes <=3D 1 || possible_cpus->len <=3D 1) { + return; + } + + /* + * The Linux scheduling domain can't be parsed when the multiple CPUs + * in one cluster have been associated with different NUMA nodes. Howe= ver, + * it's fine to associate one NUMA node with CPUs in different cluster= s. + */ + for (i =3D 0; i < possible_cpus->len; i++) { + for (j =3D i + 1; j < possible_cpus->len; j++) { + if (cpus[i].props.has_socket_id && + cpus[i].props.has_cluster_id && + cpus[i].props.has_node_id && + cpus[j].props.has_socket_id && + cpus[j].props.has_cluster_id && + cpus[j].props.has_node_id && + cpus[i].props.socket_id =3D=3D cpus[j].props.socket_id && + cpus[i].props.cluster_id =3D=3D cpus[j].props.cluster_id && + cpus[i].props.node_id !=3D cpus[j].props.node_id) { + warn_report("CPU-%d and CPU-%d in socket-%" PRId64 "-clust= er-%" PRId64 + " have been associated with node-%" PRId64 " = and node-%" PRId64 + " respectively. It can cause OSes like Linux = to" + " misbehave", i, j, cpus[i].props.socket_id, + cpus[i].props.cluster_id, cpus[i].props.node_= id, + cpus[j].props.node_id); + } + } + } +} + MemoryRegion *machine_consume_memdev(MachineState *machine, HostMemoryBackend *backend) { @@ -1355,6 +1394,9 @@ void machine_run_board_init(MachineState *machine, co= nst char *mem_path, Error * numa_complete_configuration(machine); if (machine->numa_state->num_nodes) { machine_numa_finish_cpu_init(machine); + if (machine_class->cpu_cluster_has_numa_boundary) { + validate_cpu_cluster_to_numa_boundary(machine); + } } } =20 diff --git a/include/hw/boards.h b/include/hw/boards.h index a385010909d..6b267c21ce7 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -274,6 +274,7 @@ struct MachineClass { bool nvdimm_supported; bool numa_mem_supported; bool auto_enable_numa; + bool cpu_cluster_has_numa_boundary; SMPCompatProps smp_props; const char *default_ram_id; =20 --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778379; cv=none; d=zohomail.com; s=zohoarc; b=i1TAXpjc2OlXiEneiS8O6gHmQBJW1iDh8KfxMXuCQPIRsvGBgE5mO34lrQPrTlwOxOotADbVQ581GJ5sNquM0KQUXtyd8Y2oIcIkGecKHH1pcHPBRs/WDWO9GgypHuBM/i/UF5bqy74Lffc6axgWGaSae7mN+w3KdGKPF4Jk8ow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778379; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Kq1X8mGUPqT12w5Uk0eOYlWmUkW0klSacfknT377XKk=; b=DRbfX0eToAtT3CLClSbVhQXUZjKPiEQM/WuVeFfp3FMf0Aa4uuP7FFi5ZaJ7Iog/7szrqZpwSNCH4NU/lBAiwk/cLqK3J4l6X7KMlHRFihgPUy2h3HUB6uTHtdFVmlth+iO9CKN24hV0ArLbLCKtDeMpny3vnmk7HKkTt7ZGCnY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168777837954626.84892927347721; Mon, 26 Jun 2023 04:19:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBV-0002w7-DM; Mon, 26 Jun 2023 07:15:05 -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 1qDkBO-0002up-8Z for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:14:58 -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 1qDkBM-0000Y0-LP for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:14:57 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-138-_NYcpfN6MSq6C6elHCAdMQ-1; Mon, 26 Jun 2023 07:14:54 -0400 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-313f59eba37so189789f8f.2 for ; Mon, 26 Jun 2023 04:14:54 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id x2-20020a5d4442000000b003113ccbf388sm7033668wrr.13.2023.06.26.04.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778096; 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=Kq1X8mGUPqT12w5Uk0eOYlWmUkW0klSacfknT377XKk=; b=h0FPXRKmHNvRfPU/6/+vekpu9tsdpJ+W2mWiD58rQ7n6j3Po8GKAzMF3L1rHwuIwvJNeVI 1S0Zqm0BCgmrNibpYkf0ZNJvIRe9mo8wP046TAT1XPhYrfdv8u8TdiP/9UPZhTIEBhWGv1 Ldmow4Y/qGkTlYItYU1fMb5zrMb4bfc= X-MC-Unique: _NYcpfN6MSq6C6elHCAdMQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778093; x=1690370093; 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=Kq1X8mGUPqT12w5Uk0eOYlWmUkW0klSacfknT377XKk=; b=Kdi8dYQ9+8/dU55JpB/c0mwD/1l+XxMYrcIeDkmjkUvsgiJxbM1lHPWertuZSktKhl LHIogfHVy3pk9crTnOjSyCobccZg1HeNS7yQDvP7JY4wBLiK4MvoGihcxEB68o+P10mg mTWLijF20Yu3vIGOhjUCpppTw091KGokdKBaVCnl9/JmZZAkA2S+XbFZWvgaDKRobKZo dAlxzmqi7gAej0k2GP79ChyqpkjCqxr1Rz7jJf6zbRUSaf9CjNRAXBch3/CQadAemwCz ljVqrs87egE0GtJKYwZkrKizwBIRmhb2Pgc/MPcRZ/IxFkvDhmhAVS1KWhav6fMk/nGa HCFg== X-Gm-Message-State: AC+VfDzPzVoWS1WmuP4cMBhMy6dqM72iGk24R2rlyL+WA9IKl+T0P7q1 XpdSlMXEQ+/0GZLzTIaWA277q3JdYxd26mpp3kr+5f3/Nn7+h0xuwtr1m0sRVqRD+qV16EDV9dK fJOiq3P+vMz0qToyvE5GlkPpKwELbv3A/1S5P/lnmISxmxBSxF24ummRa5WBN1cG0Pzw9CODapQ w= X-Received: by 2002:a5d:5410:0:b0:313:ef24:6fe6 with SMTP id g16-20020a5d5410000000b00313ef246fe6mr2162918wrv.1.1687778093101; Mon, 26 Jun 2023 04:14:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5I9UX8rIepdNCEYUcD6IP+MeKwDmG44MEwLRqTuzZS5hc5pyEIwzPeHYIEg+mShPs3i2W9GQ== X-Received: by 2002:a5d:5410:0:b0:313:ef24:6fe6 with SMTP id g16-20020a5d5410000000b00313ef246fe6mr2162904wrv.1.1687778092757; Mon, 26 Jun 2023 04:14:52 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Gavin Shan , Igor Mammedov Subject: [PULL 04/18] hw/arm: Validate cluster and NUMA node boundary Date: Mon, 26 Jun 2023 13:14:31 +0200 Message-ID: <20230626111445.163573-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778380237100009 Content-Type: text/plain; charset="utf-8" From: Gavin Shan There are two ARM machines where NUMA is aware: 'virt' and 'sbsa-ref'. Both of them are required to follow cluster-NUMA-node boundary. To enable the validation to warn about the irregular configuration where multiple CPUs in one cluster have been associated with different NUMA nodes. Signed-off-by: Gavin Shan Acked-by: Igor Mammedov Message-Id: <20230509002739.18388-3-gshan@redhat.com> Signed-off-by: Paolo Bonzini --- hw/arm/sbsa-ref.c | 2 ++ hw/arm/virt.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 0639f97dd5f..b774d802918 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -910,6 +910,8 @@ static void sbsa_ref_class_init(ObjectClass *oc, void *= data) mc->possible_cpu_arch_ids =3D sbsa_ref_possible_cpu_arch_ids; mc->cpu_index_to_instance_props =3D sbsa_ref_cpu_index_to_props; mc->get_default_cpu_node_id =3D sbsa_ref_get_default_cpu_node_id; + /* platform instead of architectural choice */ + mc->cpu_cluster_has_numa_boundary =3D true; } =20 static const TypeInfo sbsa_ref_info =3D { diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 9b9f7d9c687..3937e304774 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -3033,6 +3033,8 @@ static void virt_machine_class_init(ObjectClass *oc, = void *data) mc->smp_props.clusters_supported =3D true; mc->auto_enable_numa_with_memhp =3D true; mc->auto_enable_numa_with_memdev =3D true; + /* platform instead of architectural choice */ + mc->cpu_cluster_has_numa_boundary =3D true; mc->default_ram_id =3D "mach-virt.ram"; mc->default_nic =3D "virtio-net-pci"; =20 --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778199; cv=none; d=zohomail.com; s=zohoarc; b=F9IhfNfWt17RLsfpi1P3mTPR4ygOESJzROn+479DOhVjb317FUI6ph2H64H1C+QbAYreI7VrGAru1Vo4qYwdKs62bRFDFOMz0oxg9NmcWk+0KK0FPvo2RC12x2VKrAuJ/lL27fEDJXKvoPALmSz4O4kqEKNMcuuGwNhRmHIecRk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778199; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0854vsu3mSnDVm0bautGjrbU7bk2cLvYsDwU8lwzi1I=; b=Gg5GcUC/r7misGwQvgyzXB5bzdGDVkfQM+ODdOCKKB4EMxgp9FieD+Jwb7FrgejRIu3Ii0nRiNKOFjYBRFh6apy/fNlhhi+0lYaccm7Ep9GCovYlapvUruFm+EthPrkJAe9eChUasJz86n4RBiEPfbn1+DBHGAvi0D2cK9+92ew= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778199802511.12924387913836; Mon, 26 Jun 2023 04:16:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBY-0002xd-Tt; Mon, 26 Jun 2023 07:15:08 -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 1qDkBP-0002vE-NF for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:03 -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 1qDkBO-0000YI-3w for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:14:59 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-391-SkstPZgQOSyCtlebB-c4fw-1; Mon, 26 Jun 2023 07:14:56 -0400 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3fa8f8fb7b3so26862415e9.2 for ; Mon, 26 Jun 2023 04:14:56 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id l21-20020a7bc455000000b003fa95c466a1sm2937456wmi.5.2023.06.26.04.14.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:14:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778097; 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=0854vsu3mSnDVm0bautGjrbU7bk2cLvYsDwU8lwzi1I=; b=WiAKnv/wiGpZHmIW6oDTNhuFdtBG4jYOcIR3mxkEQpPkpmnSvkSrTIBUgg/SIsYbEqsOYX kZSFF6YVlQjmp4Mz8LBWl68/AwCFvEhxXMXucFfRIDyHpk+0jbH/KqXeaI4QCGToZDd8fu VE1lZ58DxVPE/48e1/AD106DvCIBNYM= X-MC-Unique: SkstPZgQOSyCtlebB-c4fw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778094; x=1690370094; 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=0854vsu3mSnDVm0bautGjrbU7bk2cLvYsDwU8lwzi1I=; b=jy3vbBzwGKHA+v7KYyW0cRixNa+aVyr6fsW2iz2inghDjO2gaqk/deem11cGAxRV1Y nuzRoG+4klGAPM8s4W8lOA/Ou/K6qUwIk4kE0o+BxrDfYhgE7SvjctHUko5crbBsy07f z+5bZ36oLsclYlxCLEJL1MMOkorzO+FPILmCMaHpxg8BgqFRkOUvxfACGRPKSYC8sw+T XIl+uAppyQ/lOs1srWsDMyspO6bS2ua/+wGbNttAUGkUPjfaxjAx9mGwtTVwyqE963fu gzsn5LZgl3Tgo0oEliBTQMuiLaxFwio5goFjQO+YttYEdorkxpO08w4y+YXqSLw8eCsd H+nQ== X-Gm-Message-State: AC+VfDxnAj4V6zZSGcwxRypRFL5LKdpbjyYh1uvoKYFn7AqOo/FQQuo/ oMhVlbd+pPUrsU9Dv7EyfRUreU7XZWYDRyysC+o0S18SAQmwRHazOZOfEi6sRG7AytkB4lZpM/a QyiU9z5tcQUlYR2VhY3P/UUbYBYQsTzqy82Z2G+3tTTXkJ5DezUWoSHcW8kGwWopZ4xnfZt2Ywb A= X-Received: by 2002:a7b:c5d8:0:b0:3f1:789d:ad32 with SMTP id n24-20020a7bc5d8000000b003f1789dad32mr32214224wmk.11.1687778094542; Mon, 26 Jun 2023 04:14:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4PCdx0hPwheCmRf0RCSk4hejAX0fFIuzxL08y7wtOWsz7OOEyUlsbNa1cZIFhq74A1fnAn+w== X-Received: by 2002:a7b:c5d8:0:b0:3f1:789d:ad32 with SMTP id n24-20020a7bc5d8000000b003f1789dad32mr32214210wmk.11.1687778094313; Mon, 26 Jun 2023 04:14:54 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Gavin Shan , Daniel Henrique Barboza , Igor Mammedov , Alistair Francis Subject: [PULL 05/18] hw/riscv: Validate cluster and NUMA node boundary Date: Mon, 26 Jun 2023 13:14:32 +0200 Message-ID: <20230626111445.163573-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778201066100001 Content-Type: text/plain; charset="utf-8" From: Gavin Shan There are two RISCV machines where NUMA is aware: 'virt' and 'spike'. Both of them are required to follow cluster-NUMA-node boundary. To enable the validation to warn about the irregular configuration where multiple CPUs in one cluster has been associated with multiple NUMA nodes. Signed-off-by: Gavin Shan Reviewed-by: Daniel Henrique Barboza Acked-by: Igor Mammedov Acked-by: Alistair Francis Message-Id: <20230509002739.18388-4-gshan@redhat.com> Signed-off-by: Paolo Bonzini --- hw/riscv/spike.c | 2 ++ hw/riscv/virt.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c index 2c5546560aa..81f7e53aedd 100644 --- a/hw/riscv/spike.c +++ b/hw/riscv/spike.c @@ -354,6 +354,8 @@ static void spike_machine_class_init(ObjectClass *oc, v= oid *data) mc->cpu_index_to_instance_props =3D riscv_numa_cpu_index_to_props; mc->get_default_cpu_node_id =3D riscv_numa_get_default_cpu_node_id; mc->numa_mem_supported =3D true; + /* platform instead of architectural choice */ + mc->cpu_cluster_has_numa_boundary =3D true; mc->default_ram_id =3D "riscv.spike.ram"; object_class_property_add_str(oc, "signature", NULL, spike_set_signatu= re); object_class_property_set_description(oc, "signature", diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 95708d890e0..ed4c27487e4 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -1669,6 +1669,8 @@ static void virt_machine_class_init(ObjectClass *oc, = void *data) mc->cpu_index_to_instance_props =3D riscv_numa_cpu_index_to_props; mc->get_default_cpu_node_id =3D riscv_numa_get_default_cpu_node_id; mc->numa_mem_supported =3D true; + /* platform instead of architectural choice */ + mc->cpu_cluster_has_numa_boundary =3D true; mc->default_ram_id =3D "riscv_virt_board.ram"; assert(!mc->get_hotplug_handler); mc->get_hotplug_handler =3D virt_machine_get_hotplug_handler; --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778281; cv=none; d=zohomail.com; s=zohoarc; b=UTwUkHGdO+Mdv0+iYem9e6kyH59os9eO8NAJHz//NYUE9Pn1vuuSQgwtE3LHJFsgerT1jaUCtY7R68qWjCnUsJY3qdDThgnjVifghB4s1/K9/wsJvHGdVWrg+dTq6AHsHqR6/btuatfko0oiJTqspSuB3ibBgAjGoGIWg4bu8cg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778281; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2ZQj7BH0bNHPLOV6nQDyI8ds3wFsn9tVHsOJxglkA1Q=; b=QYjOvmT0+MDeJYpVldrr1o2sJEtbocSq/dFbMaJ6/e8ruSRiumnQej3X9zYoxqMYVjKmAC7F0cp7JqQhC9P3AtHER5V1xCIK1qmF++JH8LnnqSdhJxYR8to0mtJ5aKmjKMQBSHqNY+gJf0n1pLGPxfx1DUAuOMbJ1Cor/FFeSog= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778281365372.8950095186299; Mon, 26 Jun 2023 04:18:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBY-0002x4-4f; Mon, 26 Jun 2023 07:15:08 -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 1qDkBW-0002wm-Jv for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:06 -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 1qDkBP-0000YX-FW for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:05 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-117-YFvzpiKMOGS7fuo4f0WQGQ-1; Mon, 26 Jun 2023 07:14:57 -0400 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3fa714fa27aso18687175e9.2 for ; Mon, 26 Jun 2023 04:14:57 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id z3-20020a5d4d03000000b0030aec5e020fsm7032393wrt.86.2023.06.26.04.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778098; 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=2ZQj7BH0bNHPLOV6nQDyI8ds3wFsn9tVHsOJxglkA1Q=; b=h1AQW4DEP7FyzQyZewmJhZErUml4sxZcQdfgx67azaU/Uv+Y9qKvo/Din4Q01nx1QoJNxN dd4MdSKrX3qzCmy2HyPCnc4ffKvy8EJKU+Zj5q+CVAp6YotLnZab7c+UCB12J6/fhC2SAB KPZx6PeI+CYGdnQgKKGxiRBuycqpQNY= X-MC-Unique: YFvzpiKMOGS7fuo4f0WQGQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778096; x=1690370096; 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=2ZQj7BH0bNHPLOV6nQDyI8ds3wFsn9tVHsOJxglkA1Q=; b=OxyBODuCLIKMO+5XknouC8A7zaMSeNYFTuhn4a0XKvWa4PUinHr0OmPligGPIUk2LG l167CBjZ5jCFmbux0ZJF/tblgLYTp0ZImJmmTOugMKMR1KIRAY5Ty5xRTtBFz6h99+Pn 0Tg1pld+aPIs0iH9mu+9LnB/MhYfar/0iNuY4Z2aI1C/pBLjpoyYFi46EOi26ihnuamM HYGQuol1YuPKPAA1TBPYV+EHpSvARgCfNgXQdJ94UH9ZofVzVgPoDgJ3gb6hQitrj5tc /v2ldqvrE+c+/haoQVqFkOb5wLKUVD0UUuyR5gJ6gYarT3B9gv+RcWwCb4bypQU1P5Ve XNKg== X-Gm-Message-State: AC+VfDyX4EmcPMWygGgroXAxcvko6L9P6TmqXLtqBs+YBaURo3SiPbe9 5zzelmu9ELVm5kZ2h+SS7rLu+6cMLtlHgMFlvYKJ2FSI5Qo+bda37t0d/wb9eXKVLpitfW0sPkG njm+jd9rix+t+NszsMGu3q2Cm/+Ul7NM30mZqO8ssdSwaw/KOxOm/3MAjeuCr/XYoCC2Ve4WNnc M= X-Received: by 2002:a7b:c392:0:b0:3fa:8fb1:50fe with SMTP id s18-20020a7bc392000000b003fa8fb150femr2593390wmj.15.1687778096036; Mon, 26 Jun 2023 04:14:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4TidpIRvn310vMeZRKWvmGJ0MhuEQ2ARFZe5rT1NoWGq1vw0tlcgyejNgi6ZpWHm1o+VVAhQ== X-Received: by 2002:a7b:c392:0:b0:3fa:8fb1:50fe with SMTP id s18-20020a7bc392000000b003fa8fb150femr2593382wmj.15.1687778095812; Mon, 26 Jun 2023 04:14:55 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Marcelo Tosatti Subject: [PULL 06/18] kvm: reuse per-vcpu stats fd to avoid vcpu interruption Date: Mon, 26 Jun 2023 13:14:33 +0200 Message-ID: <20230626111445.163573-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778283664100009 Content-Type: text/plain; charset="utf-8" From: Marcelo Tosatti A regression has been detected in latency testing of KVM guests. More specifically, it was observed that the cyclictest numbers inside of an isolated vcpu (running on isolated pcpu) are: Where a maximum of 50us is acceptable. The implementation of KVM_GET_STATS_FD uses run_on_cpu to query per vcpu statistics, which interrupts the vcpu (and is unnecessary). To fix this, open the per vcpu stats fd on vcpu initialization, and read from that fd from QEMU's main thread. Signed-off-by: Marcelo Tosatti Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 30 +++++++++++++++--------------- include/hw/core/cpu.h | 1 + 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 7679f397aec..9aa898db142 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -450,6 +450,8 @@ int kvm_init_vcpu(CPUState *cpu, Error **errp) "kvm_init_vcpu: kvm_arch_init_vcpu failed (%lu)", kvm_arch_vcpu_id(cpu)); } + cpu->kvm_vcpu_stats_fd =3D kvm_vcpu_ioctl(cpu, KVM_GET_STATS_FD, NULL); + err: return ret; } @@ -4007,7 +4009,7 @@ static StatsDescriptors *find_stats_descriptors(Stats= Target target, int stats_fd =20 /* Read stats header */ kvm_stats_header =3D &descriptors->kvm_stats_header; - ret =3D read(stats_fd, kvm_stats_header, sizeof(*kvm_stats_header)); + ret =3D pread(stats_fd, kvm_stats_header, sizeof(*kvm_stats_header), 0= ); if (ret !=3D sizeof(*kvm_stats_header)) { error_setg(errp, "KVM stats: failed to read stats header: " "expected %zu actual %zu", @@ -4038,7 +4040,8 @@ static StatsDescriptors *find_stats_descriptors(Stats= Target target, int stats_fd } =20 static void query_stats(StatsResultList **result, StatsTarget target, - strList *names, int stats_fd, Error **errp) + strList *names, int stats_fd, CPUState *cpu, + Error **errp) { struct kvm_stats_desc *kvm_stats_desc; struct kvm_stats_header *kvm_stats_header; @@ -4096,7 +4099,7 @@ static void query_stats(StatsResultList **result, Sta= tsTarget target, break; case STATS_TARGET_VCPU: add_stats_entry(result, STATS_PROVIDER_KVM, - current_cpu->parent_obj.canonical_path, + cpu->parent_obj.canonical_path, stats_list); break; default: @@ -4133,10 +4136,9 @@ static void query_stats_schema(StatsSchemaList **res= ult, StatsTarget target, add_stats_schema(result, STATS_PROVIDER_KVM, target, stats_list); } =20 -static void query_stats_vcpu(CPUState *cpu, run_on_cpu_data data) +static void query_stats_vcpu(CPUState *cpu, StatsArgs *kvm_stats_args) { - StatsArgs *kvm_stats_args =3D (StatsArgs *) data.host_ptr; - int stats_fd =3D kvm_vcpu_ioctl(cpu, KVM_GET_STATS_FD, NULL); + int stats_fd =3D cpu->kvm_vcpu_stats_fd; Error *local_err =3D NULL; =20 if (stats_fd =3D=3D -1) { @@ -4145,14 +4147,13 @@ static void query_stats_vcpu(CPUState *cpu, run_on_= cpu_data data) return; } query_stats(kvm_stats_args->result.stats, STATS_TARGET_VCPU, - kvm_stats_args->names, stats_fd, kvm_stats_args->errp); - close(stats_fd); + kvm_stats_args->names, stats_fd, cpu, + kvm_stats_args->errp); } =20 -static void query_stats_schema_vcpu(CPUState *cpu, run_on_cpu_data data) +static void query_stats_schema_vcpu(CPUState *cpu, StatsArgs *kvm_stats_ar= gs) { - StatsArgs *kvm_stats_args =3D (StatsArgs *) data.host_ptr; - int stats_fd =3D kvm_vcpu_ioctl(cpu, KVM_GET_STATS_FD, NULL); + int stats_fd =3D cpu->kvm_vcpu_stats_fd; Error *local_err =3D NULL; =20 if (stats_fd =3D=3D -1) { @@ -4162,7 +4163,6 @@ static void query_stats_schema_vcpu(CPUState *cpu, ru= n_on_cpu_data data) } query_stats_schema(kvm_stats_args->result.schema, STATS_TARGET_VCPU, s= tats_fd, kvm_stats_args->errp); - close(stats_fd); } =20 static void query_stats_cb(StatsResultList **result, StatsTarget target, @@ -4180,7 +4180,7 @@ static void query_stats_cb(StatsResultList **result, = StatsTarget target, error_setg_errno(errp, errno, "KVM stats: ioctl failed"); return; } - query_stats(result, target, names, stats_fd, errp); + query_stats(result, target, names, stats_fd, NULL, errp); close(stats_fd); break; } @@ -4194,7 +4194,7 @@ static void query_stats_cb(StatsResultList **result, = StatsTarget target, if (!apply_str_list_filter(cpu->parent_obj.canonical_path, tar= gets)) { continue; } - run_on_cpu(cpu, query_stats_vcpu, RUN_ON_CPU_HOST_PTR(&stats_a= rgs)); + query_stats_vcpu(cpu, &stats_args); } break; } @@ -4220,6 +4220,6 @@ void query_stats_schemas_cb(StatsSchemaList **result,= Error **errp) if (first_cpu) { stats_args.result.schema =3D result; stats_args.errp =3D errp; - run_on_cpu(first_cpu, query_stats_schema_vcpu, RUN_ON_CPU_HOST_PTR= (&stats_args)); + query_stats_schema_vcpu(first_cpu, &stats_args); } } diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 4871ad85f07..3b765beb9b1 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -402,6 +402,7 @@ struct CPUState { struct kvm_dirty_gfn *kvm_dirty_gfns; uint32_t kvm_fetch_index; uint64_t dirty_pages; + int kvm_vcpu_stats_fd; =20 /* Use by accel-block: CPU is executing an ioctl() */ QemuLockCnt in_ioctl_lock; --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778134; cv=none; d=zohomail.com; s=zohoarc; b=ei3Z/MZkhGKix/z/eXumNWWVcqwUhLd3H9IY6TBK1vZDFGRfW0QwVGmukkAl2aEEXsaqz/PM1GjVZOrtH9LG251mI3RcVv/E/rHrXKn0Ep8TMTSSXsEP7SJrmzAyRFFA9Y3FkbfLEw01yWsMS0ydR42VRiXraclGXg40G02DjvA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778134; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NjZaffAPekSpjEfjZNu7ZflGZlFUHtqN1AICwh62mv0=; b=HCxsXa+JPlE2nc9UI/rHW3sF4phpVigYixtXkO+mCrBLVlHCpY1a9OGfg0oJmR0LqbChu8GTa6IExwxQ+Sn1BLoC1/0lGnboMTRmLm20mIRVDH2EM4Lbtqn7R8cbF59dKpA4JNAmxLihuzzAxhHZMQoZ8kh+1oEg/H8NPHfZ9ds= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778134979579.200965535584; Mon, 26 Jun 2023 04:15:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBY-0002x3-3v; Mon, 26 Jun 2023 07:15:08 -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 1qDkBW-0002wn-Ke for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:06 -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 1qDkBU-0000Yw-24 for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:05 -0400 Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-153-Tj8Z1JDONcOm0P4ow2QbuA-1; Mon, 26 Jun 2023 07:14:59 -0400 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-4f3932e595dso2444342e87.1 for ; Mon, 26 Jun 2023 04:14:59 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id u14-20020a5d468e000000b00312780bedc3sm7090774wrq.56.2023.06.26.04.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778101; 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=CsHddD+/nbJiXqvN7SIWIXEGIhKufyBIywcn2BRjd7kRKtXNVX6X9qc8go4U803WEcV/8y 4UKKiHjjtjAo2AfZYXLV/YoZ6t9NJ/mw8hGPMkNt5j0wLWgCgILfDpthexn9pcQ/F2CtZa nc/uejDGr4nbK8Rdp+4+K4qNKbBZkLA= X-MC-Unique: Tj8Z1JDONcOm0P4ow2QbuA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778097; x=1690370097; 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=MMrD+XGC8rvdgkqiverSj7Pvf+r62+4EvN/oFFy46bbnmCP3weGba27i7wEJAkvXda 4zGB/o4O3Hh581pgI2M3Kp/1Y4HZ9hMBq0clamCnZsJlknnxHUPFbTzrs6u9oqq2NNIV PJwTEihPjgpm/fQf+TeLHClh1JJzio55V585hTDVD2/9c0jtmsHsZ9mKIb/CeBQJmE13 +J1sg5Yem5aRb+P8hxcJWypswSzIAMy31RPTnao7OSqjPA2tE/m8ac46iQpKDJQQXiLe IQWojrWXNpxB+KY5Qe1LO1FiS8Wnhz3gxc3cm1swsLbPnQG35x0AkoKgQLYgxPY0fNqs e82Q== X-Gm-Message-State: AC+VfDyUAAPoRKdK5lGCRieosnMvpDwvZB4GbP8GY6mM2EZarQUK6bbE diElgrGQ5ZtjjXOcYl+bqd8gm1mRxZAbs0jhm8lu1JX3dLZD++lIWpyt5JNgq6kDvDl7gczWUNe aX/htU8j5v0zmuGjDkgXJDPWwTP+mGUJiKW6SznO+iFN74AqM36Ha+pyC7pr1dtJUm/2Bhb4b+p I= X-Received: by 2002:ac2:465b:0:b0:4f8:692c:74cd with SMTP id s27-20020ac2465b000000b004f8692c74cdmr13676485lfo.22.1687778097785; Mon, 26 Jun 2023 04:14:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5na58EPtt9QS2R9hA3+acWvRsMZoqfC9yOcQ18eQCU+kixjFmyNOYYW86anNf7RYEiuQoITw== X-Received: by 2002:ac2:465b:0:b0:4f8:692c:74cd with SMTP id s27-20020ac2465b000000b004f8692c74cdmr13676468lfo.22.1687778097361; Mon, 26 Jun 2023 04:14:57 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 07/18] target/i386: fix INVD vmexit Date: Mon, 26 Jun 2023 13:14:34 +0200 Message-ID: <20230626111445.163573-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778136678100007 Content-Type: text/plain; charset="utf-8" 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_EXI= T_INVD); /* nothing to do */ } break; --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778378; cv=none; d=zohomail.com; s=zohoarc; b=f4PKRgvib4XwHfdcXCLor7e3U3faOCzgKYsa3LNAUgYM/BsciGeGnHznZCOYRBxcLkoxUsNi7JFz6Tj5JRxQ+pZ3cJEtvt2wUSVwHEY7kRIzrKMN6tnH8zDVuN5B71i3dWeIh1gZAopnQ55S5ChCQYo3N5m6jaTGB34N7UyxxqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778378; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M480NKZDd+FJKbtXpXl/j5rkv8yel0iAbn92O5C8mB0=; b=BoOJgiXtnzLkB9GhH0EK+1YL/cPYx9cMk6rANd68ZzEt3TTL0lr/0gDs7h/H1GdPvkw7XszgruOiWD5FY01/GJuuF+Swv0tTOlZeLEBH0Of0prxEEM6HUWYB07VYHqvrAToYljt9QnsPcvmVHTcXZ4WP0t1jgFk1fW+M59jFRqY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778378134840.9388320229642; Mon, 26 Jun 2023 04:19:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBc-0002zM-Su; Mon, 26 Jun 2023 07:15:13 -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 1qDkBY-0002xA-C7 for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:08 -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 1qDkBU-0000ZL-23 for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:06 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-265-khKdxonAN_G6bwbVaP_ewQ-1; Mon, 26 Jun 2023 07:15:00 -0400 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-30e4943ca7fso1184893f8f.3 for ; Mon, 26 Jun 2023 04:15:00 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id i13-20020a5d522d000000b003119633ecb5sm7100579wra.88.2023.06.26.04.14.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:14:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778102; 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=NqaW3LQtRGj9Ppm4Gc0z+zWSIVY6heer7EeAYENl1mwdv/xkv45+TEr+T9S4arSeu5AACe EAEsAvtzwSmCAbScCk988UHOsb2Hob8OHYdXWQ9ZX4FiMWSkoqUUeKAh1n2C3TxE25XCWS 0fuFl2gZz88GGsyHOtFa/dCugUN22wA= X-MC-Unique: khKdxonAN_G6bwbVaP_ewQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778099; x=1690370099; 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=Qrf6XygP5tnM/gWp8tJScDsIWuXEaHOLq3XbeDizCuNE2MWl01IfF3F2U9tvGzLL8t 60lbaCW5nbFnB5ckTSlmoWYmameHJuxdSVQFH54c+D83VUiba6VffIEnDhbsXGN6jisA iOdeID0FQtgEVxXMtnPCyzVUH4YpG1IHZ5Um83OGWiDAfcAtAKdPgktvh7oVtSFgX2Xd ONbE8H0L8B2AJOmpFZ7tK3x2vy8zandox66095xy2sDZgL2005UpUiWXJpwU29EGoPyJ 8JUDR5jqs0oEEd/utUAfVstocI3OYauOpeIQ8QjdMdWnoZ2oJ7bwJkHSE7lqDxBxT5ZQ 8u/w== X-Gm-Message-State: AC+VfDxHLl/nayFuYEwq35C7iGCLulD9Jc4TfnoqP8wG45p6OhkcB0rA AtGpaeqZOVstAmBsSaf9lBJz6nVXSQ2nxA6XuXFhuJf/iu64nCJ0arV2xs0/srmMJfidzvq01Q5 bqkeoXiQnMPWgCw2qq7ER/T575hahfa4PIVhWQplhRbjd26p5vHt3XFNBOF/N2rWEdKsc7H1lrb M= X-Received: by 2002:adf:ffce:0:b0:30f:b045:8b60 with SMTP id x14-20020adfffce000000b0030fb0458b60mr18551376wrs.69.1687778099466; Mon, 26 Jun 2023 04:14:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5F8E0D/C7fm/e/ceYTcyh72DlhtYw06wdIam0JVPFv/7xE43ns9LB158oQPvJMcDzX6o1/Aw== X-Received: by 2002:adf:ffce:0:b0:30f:b045:8b60 with SMTP id x14-20020adfffce000000b0030fb0458b60mr18551363wrs.69.1687778099195; Mon, 26 Jun 2023 04:14:59 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 08/18] target/i386: TCG supports 3DNow! prefetch(w) Date: Mon, 26 Jun 2023 13:14:35 +0200 Message-ID: <20230626111445.163573-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778379643100007 Content-Type: text/plain; charset="utf-8" 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 t= hem 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 vendo= r1, 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) --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778283; cv=none; d=zohomail.com; s=zohoarc; b=R22RMtGwQB3QO4UOQcJU/vBs6tliYzRq8xrgZgH6p0mvnmtagkb9zGMORpJOVMc2aO5F5nD5ldpV3MM4j2bNcFUowTtUzBVUPlLb7zRd2bMaz3x/i6JIBbCLWUZYnDKvKXlPkOjUBVKcAccyBsp60ZZ1NuCFbC2YSFBOiJ99xto= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778283; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0W8NdMue2w0PHMCwCzmpD+VGR+2VHcU3d8NE23hGmkY=; b=Dd7SBTgUQHvfS/mrjaHS6RMMzsAMS7Rqhkh46MyPZ6wpUGyhHDwVMslN0pFOGiiIqWD/re1yhTvbgAJpzfT/dD98Ttahafznm/hZoUWLDlVWdRcyqkSIXNAcJW/TL16uJlq1f0psOtxaUojBgQiQuFS1y10lU14NPETtU2qBDyI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778283120796.2782856094427; Mon, 26 Jun 2023 04:18:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBj-00034J-M0; Mon, 26 Jun 2023 07:15:19 -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 1qDkBY-0002xB-Ga for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:08 -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 1qDkBU-0000ZR-AN for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:06 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-389-Vg0qnGHoOluZUTd1Ho93sw-1; Mon, 26 Jun 2023 07:15:02 -0400 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3fb40d0623bso1078545e9.1 for ; Mon, 26 Jun 2023 04:15:02 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id y17-20020a1c4b11000000b003f90a604885sm7373639wma.34.2023.06.26.04.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778103; 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=N+8NoOkeOFIzvIBt84N7U0nBaxBjjLu5KRa/XC1t0t/ACmGEFhRx0vfiHJwiQTywdh+PWV kEbA//TRMK6rNhZAToSBm2tAj0hts2Zq9BZe1tpJxk0ASreT0mEfw75bOWkEAqb2FCGLTV pgu80PvDtsBNZGkhG+Zp3arD1f7iDJo= X-MC-Unique: Vg0qnGHoOluZUTd1Ho93sw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778101; x=1690370101; 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=RHFzuPUzCgaAKTCrYg7bfuIoOaV0rB16TpYgxgOp1Mu+DUQ3XGxk3mO9Pac9awgPlH BKyE7XtG3y3+uNUMltATiAKbIWflylZDc4G9vLGdAUwHgMLmQWbbK3Bo/a79qxn9elXf +tUNf3pmYapV4UD920hrB7fImOyfrqDtotOzT6ghjqXiWkEW2XVpKhVb4K1elvQROEIY i6jQqdZ8lP02vPPGrx/Y6EPZ2rr7vcmaPgaPwi8bFd3k/xyzx+gnfTbrXq13D2BPr+jL X2WYmBJhvLyvSst6gH05whFmg0DaU8h3TW7t6Nvs8fATj2lO2QOaT25QVX2MyBUGREca 8E8w== X-Gm-Message-State: AC+VfDy6ehR6VVbrB2dsyPXmce6OJcAgdjBE59Ju2OsW6Nhfx5ReZ9P1 QMwGdEHnBb7NEiyUs2QvGMH605tSVePmY+M03Bb1TzbwPQT1prT0+gFDOV7l1XdjjfPpFjgwmDs B74cIq+AMoEiSajSiUESUNmMeizBjltmJ91zpgQ7d00gszP9TAeK5YWKABmEWloQym1ln/qffrM Q= X-Received: by 2002:a1c:ed10:0:b0:3f7:e660:cdc5 with SMTP id l16-20020a1ced10000000b003f7e660cdc5mr25211542wmh.9.1687778100895; Mon, 26 Jun 2023 04:15:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7qMb//GePSK234b6jmqJny3RPXng8f8aKGZiJquZ2QmGrwljhE9T6OcFsO3rN/1EjNqnc+nQ== X-Received: by 2002:a1c:ed10:0:b0:3f7:e660:cdc5 with SMTP id l16-20020a1ced10000000b003f7e660cdc5mr25211529wmh.9.1687778100632; Mon, 26 Jun 2023 04:15:00 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 09/18] target/i386: TCG supports RDSEED Date: Mon, 26 Jun 2023 13:14:36 +0200 Message-ID: <20230626111445.163573-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778283456100007 Content-Type: text/plain; charset="utf-8" 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 ven= dor1, 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) --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778280; cv=none; d=zohomail.com; s=zohoarc; b=GzAzSihLpViqDwuDMMq50Mukv/4Gr0Us2QhEAi9nKSu0hQGiJAX6GcC7m7oQjtd8dA2qg8oLm0NnjPkwGTlINfrLX59PrDlaHBK6PsjtgcmLv36KCHVhh3yJ5Rd0YuvWa4FIuCad4mgazMVkvDB/h8WnWsC0bIpMS6l9Jd03fbs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778280; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/+pEuHC8o7MIoT+wKHzEIawfzSJZUmTJZ+8IUDyuCdo=; b=AhExvJ4xHxjQDM0TsHl6+aED5gyld0bBFHeQoV/MfqDI2TKLAkblInMhWz65aeR2ooWoIcb/r7mkSnp4v2SSTXs8bnMmXmcIBRJLl+2zBk48tXnR+0WIztsCPfCFhIDWwILgQSW5MCv5ouMonsjlWDmt5wde220kl2FtEj+v+aI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778280725630.5816218935825; Mon, 26 Jun 2023 04:18:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBl-00037L-8u; Mon, 26 Jun 2023 07:15:21 -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 1qDkBb-0002zf-Rk for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:12 -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 1qDkBX-0000Zo-Th for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:09 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-98-fUSPXegHNGS1Uyw9MKWyHA-1; Mon, 26 Jun 2023 07:15:03 -0400 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-31275d62506so1160945f8f.1 for ; Mon, 26 Jun 2023 04:15:03 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id d13-20020a5d4f8d000000b003063db8f45bsm7084271wru.23.2023.06.26.04.15.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778105; 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=/+pEuHC8o7MIoT+wKHzEIawfzSJZUmTJZ+8IUDyuCdo=; b=jTNV4JCDTveyX1B+qp2erp975Qe16ebzSTQGxmlzzpkyxF4QV8wdw20vcSHzxUcg+zbwI3 O2Y6UfzkbdejPsCqXUkg6vFRKcKCBCgUaKnSvBzh3mB/GqhOpcntJhk3Otdco7wMHiMn50 QL/+l6AWRFJSwMMuB3BIBksK8wdm/bs= X-MC-Unique: fUSPXegHNGS1Uyw9MKWyHA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778102; x=1690370102; 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=/+pEuHC8o7MIoT+wKHzEIawfzSJZUmTJZ+8IUDyuCdo=; b=Mdeysgt6WzT29tOaH3l5LBRrIVDNMQCB3AE6Kj7oLxsAjDkVIsMcPXAx1lJdiUFPEu IhxYGMn5QqOf3DXjmNyOni86FPabSYoqhSm/nRfZFGoKZcyMZMbXln+yNV8/ZZ0aOe8P HSuuoyeq7jzmVV+LSQE1t9jH4yKXUJHJ1wBr0PVXcpeQ0bFN8o2RBNO1NyU2waWkkm2U /aeeysL0YWLaLup5T3OyLQJY9Qe8+86Ye+Pswv6jyQPeJMkiRYFyWh67G6ZQIvv5r/Dn SOFxVIRK5YV5OR7ULeECVuS/xaI9fA+aEgDmUqAUQlkdPWHFGdx2rstW0HSlrlL1ulhg 9uOw== X-Gm-Message-State: AC+VfDz2hGaKOKmbOyh+trG2AIhszCcqoKFtRMrmowINfhhkbOJWOa6e w7rHCdhu+ms5u2dybtY5aiEh9sKEFztLy7MyoGIb2JsuqYAj55f8sAjPAyASr+pOnFzLrpdCt93 U7wZs7i9qoJOyvvxL4k0KwQOsoZmQXz7JVkzFKot5ViAwA350No5/DiML0kQxgm5mxdD8RWG7hD E= X-Received: by 2002:a05:6000:1962:b0:311:9a5:2d63 with SMTP id da2-20020a056000196200b0031109a52d63mr8513242wrb.42.1687778102232; Mon, 26 Jun 2023 04:15:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KFOH9NcNvddI73Ze3O9Q03vCyHLKNnaZWC4CQ0glXoNBuFZb7Plooys5KLWpPdEubFH+wtA== X-Received: by 2002:a05:6000:1962:b0:311:9a5:2d63 with SMTP id da2-20020a056000196200b0031109a52d63mr8513231wrb.42.1687778101958; Mon, 26 Jun 2023 04:15:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 10/18] target/i386: do not accept RDSEED if CPUID bit absent Date: Mon, 26 Jun 2023 13:14:37 +0200 Message-ID: <20230626111445.163573-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778281519100003 Content-Type: text/plain; charset="utf-8" Suggested-by: Richard Henderson Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- 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 *c= pu) break; =20 case 7: /* RDSEED */ + if (mod !=3D 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 !=3D 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 =3D (modrm & 7) | REX_B(s); --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778170; cv=none; d=zohomail.com; s=zohoarc; b=aTki3bp9XTCOtLqHb5/WQith+zutnoul7JM7l6JUef2t2XXLrtbi3cLwXtqLE7iTwhxDp4fgV7bR9FlJdtbBBCE8zhDy9HijCdWuf9tF1JTuGhN4tsQFK7ZDqP6sWrF2db/vwXODLd56lsURaR38w/YD9Qj0QMwlfYS5A4mFvF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778170; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=H6LzM46kJa48T3+aRvGvtOXkekp7mWniYMCf+e1S9DU=; b=CVyO5r62Q6nZQk2Z5Lidln+avTMmT92q2w89aSxN8xZjkf6c8RWS0S1DLn6emmZwGvT6lBd4vRE3fA6oYBYDnHYAVD2/+i/kcQK+2Y5+bIFM57JLNsZnB1GcytxT9KL5r6PoT60pBbOh82aYU1tbBnjI96jHfzBWYzmB/VGBo10= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778170570877.3490514283078; Mon, 26 Jun 2023 04:16:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBn-0003GE-MG; Mon, 26 Jun 2023 07:15:23 -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 1qDkBb-0002zd-RH for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:12 -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 1qDkBY-0000a8-20 for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:10 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-457-kpBSrkCvM2qgU3NQaSN4wg-1; Mon, 26 Jun 2023 07:15:05 -0400 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-3fa976b8b6fso4369505e9.3 for ; Mon, 26 Jun 2023 04:15:04 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id a25-20020a5d4579000000b003048477729asm7065945wrc.81.2023.06.26.04.15.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:15:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778106; 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=DY+1FF8+qLnayCo7qOGKxvr50osDFWfPYpo7KtKMHqnBUae7C6l3cxMjy8amqgt+ri8iGu b7varon4vgAxfZ0owOwJUDIbpWWDK70v+NwsZrAnoUsdoc6NXtQ5R41/rE7MLLQzFuFOcX Yu0mzsD2aWmmCVx8TTsl+My0MYund94= X-MC-Unique: kpBSrkCvM2qgU3NQaSN4wg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778103; x=1690370103; 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=Ah1+pdhlt3yC1zHhwPP3MAsMv1sBoyQVeDf4T8INYpbDBiZBbvlpp0FeflLpw0pnM9 iSc5IE+b24EvZebdyea6z4DHY4ClvtgvIFQTRZUgdFBYblzH2wXQnBw9O4f/SDO2YDpN SbzUsOMl/EGMP425b30692U2sKoBsB8SIzKCNtUMQ72qDGYqvel5YfkZHFUHTQK1HAzr 6spS6py+UJaw6ARhHtY+uBAdtjF0UBmVN7MEfkLtz1HrjI52JyN3sn6GeACqwJP8sWbn EoizvdZl9wdqzQukeMi04caZ/8inJ0DAfxDiSBgTb8uDWYT/k0up+LXuG1rEiUorIEal LD9w== X-Gm-Message-State: AC+VfDy9Nwr/SX2N13hJJtGZOJaSAehHRVGhmULMyXGn5SfBb0y/ZrvK Ho4tG1JVZJrJNqvrdWYN/kjAn3heWR5v0yNOMGcK75Nk8vA7bXcs5Gm6W5ysK3SIMwmA6vsYDRi ON2jQYq/szOoXDZuwHqMrQzCRizBa3nIkuzW11Ql3zXlG2HD6Ijb0g2HjPIQ7kr7W3NwzB9ByMu E= X-Received: by 2002:adf:ec0e:0:b0:309:44ed:ccff with SMTP id x14-20020adfec0e000000b0030944edccffmr24688035wrn.1.1687778103623; Mon, 26 Jun 2023 04:15:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4mdkqKDaPAP/mUJaxMGePIrZLtmyfFLuptzUipHEtcmM0XxWxRLWEK8s5PYIOYV13CzRPC5g== X-Received: by 2002:adf:ec0e:0:b0:309:44ed:ccff with SMTP id x14-20020adfec0e000000b0030944edccffmr24688025wrn.1.1687778103384; Mon, 26 Jun 2023 04:15:03 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 11/18] target/i386: TCG supports XSAVEERPTR Date: Mon, 26 Jun 2023 13:14:38 +0200 Message-ID: <20230626111445.163573-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778170853100001 Content-Type: text/plain; charset="utf-8" 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 vendo= r1, #define TCG_SGX_12_0_EBX_FEATURES 0 #define TCG_SGX_12_1_EAX_FEATURES 0 =20 +#define TCG_8000_0008_EBX CPUID_8000_0008_EBX_XSAVEERPTR + FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { [FEAT_1_EDX] =3D { .type =3D CPUID_FEATURE_WORD, @@ -939,7 +941,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { "amd-psfd", NULL, NULL, NULL, }, .cpuid =3D { .eax =3D 0x80000008, .reg =3D R_EBX, }, - .tcg_features =3D 0, + .tcg_features =3D TCG_8000_0008_EBX, .unmigratable_flags =3D 0, }, [FEAT_8000_0021_EAX] =3D { --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778133; cv=none; d=zohomail.com; s=zohoarc; b=i4RhKctSdWn8LEigJvAYIgRj4oCFN5nPYF3WDEwgbgOE2uSEGg7D8Z4S2tQB+NLf0AXK+NEJnDkNXkb53WcjC+AJEsLdWOANB0iTQ/Ghj2G7wk+UWEQbd7jZiSikj/jCpaOsqBk6LOTg5A0Uy0Na5zwhSRZyDgAs6b5CQwt7wNQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778133; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6EIU5XOd3nbA8G7SlRkIFwdHfD63tFeDL6PWodWJlqM=; b=dxOnZoCoqfhjBJqwwrcRubqKf+A9i62m9KjGDvvcyCwvgbJeLtubSetpjwdRhJ6KT8POeVEtpSQI5hunuv4ik6v3ah95npyN50SATaJStm+k8Y5d3amspOg2BiHpObgHnZ2BQP4DeNSsnt9qtaipv4OgrdqbYGMUQPPKiCzvJ+4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168777813385810.81868571373775; Mon, 26 Jun 2023 04:15:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBn-0003Ej-1W; Mon, 26 Jun 2023 07:15:23 -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 1qDkBl-00037H-2S for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:21 -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 1qDkBj-0000mA-0a for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:20 -0400 Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-47-PaM3cBY4ND64nr28BfQetw-1; Mon, 26 Jun 2023 07:15:07 -0400 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-4edc7406cbaso2135699e87.2 for ; Mon, 26 Jun 2023 04:15:06 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id h10-20020a5d504a000000b00313e8dc7facsm5254413wrt.116.2023.06.26.04.15.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:15:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778111; 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=ID5UlAae+8gymbh4rKp/XhezLWKCOG9rd/qEyQqRonerwGBeDeM19go/BFqQByIYc++QKd 3xslzW4FKZQO9BsZYyQ/WnX0c1QsGolBLGYeaYdIim8vL34l5LRCsxd81eNyScgW+ws94Z bC4IVdhToy1321RBDl8eyDdWwR7qWi4= X-MC-Unique: PaM3cBY4ND64nr28BfQetw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778105; x=1690370105; 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=chdT9BqskdEjwdgUgmSceRRxCHG6zL8YeJH0Qmx34PpqdqxSQI8gaIb+smdJ/4+M8o RXMzj4sNSXkeKXar5pTXkMlHa0LVq/PgBGP/YXnKbObr1QoLmypKgF2HN36qNQX1XooG SzqJi8jZG5HZp+7EU3ETEKIv9r4vv/Edh9HNdizHjq04ik8D/YCyQUZBN6bOSlaQpyre bBSXhWOYhkBat7zerKkZizgzdgC5N3hryg8XQDtHJ69RZuV+3iwXu0YyJwlD+OTunujj 8MveD2RZd+wa2RbFOs8VxXQWJ6Cg5fAY3J2P/2lrGmRl0qatlvMkJCUNeGKXJRst1UwP jRrw== X-Gm-Message-State: AC+VfDzp1MnVjgHOj453T+Cd5OwUsIDSU2lezHc+vL3EPTiQJU/2beKj dtpOW/1ZT35FgMYcCdtKDPAeYJUgnUq7ZAjxRHcp34EzAys3VHhhkJMIjAYEzir1uRs3e1EAG90 C1wyqU3gYlvKJu8VnU6odihwsWjAY+Att9pEEq5/3+cUXV/e6YvW9p+z2nDyl4mjqvCA8eEHesZ Q= X-Received: by 2002:a05:6512:31d1:b0:4fb:73b5:e1cf with SMTP id j17-20020a05651231d100b004fb73b5e1cfmr1822343lfe.64.1687778104931; Mon, 26 Jun 2023 04:15:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ62QlkbYq2vjpuPQSh34YyrORSsA4nsxpa9bnCnuKRBoQSPz42/vf21wdzmc+Q9uGw4TmQE0Q== X-Received: by 2002:a05:6512:31d1:b0:4fb:73b5:e1cf with SMTP id j17-20020a05651231d100b004fb73b5e1cfmr1822330lfe.64.1687778104703; Mon, 26 Jun 2023 04:15:04 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 12/18] target/i386: TCG supports WBNOINVD Date: Mon, 26 Jun 2023 13:14:39 +0200 Message-ID: <20230626111445.163573-13-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778134771100003 Content-Type: text/plain; charset="utf-8" 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 vendo= r1, #define TCG_SGX_12_0_EBX_FEATURES 0 #define TCG_SGX_12_1_EAX_FEATURES 0 =20 -#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) =20 FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { [FEAT_1_EDX] =3D { 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; =20 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_EXI= T_INVD); /* nothing to do */ --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778410; cv=none; d=zohomail.com; s=zohoarc; b=L9fbQ8jUeqvM9+LNGyeF9jhTTQHaw3rk2JVd5DBnIE6aSlUdNKmnSz50ka83x4Vup91fsE2CDsnSbSAF41BzK4RQJtkD3DUm85l6TjbaT7xYWhl10Z355YBYZwkhztBIdw56sJDr80DVPv52PRW+zAw+rhjR+QMahVIqZnGIk/U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778410; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tJgCEvRIJfsZ4PHdwAsMys/JtM2LhLA5MowluJx/lzU=; b=ioxXx5vveG7xDEdh+OqYJdgDjQL7nsjRoQiMC9fCizcoRW/V0LuBt32Lz+m2q5yPparPaifI529/bgxKfUam1FEP31o7h84c/Uk0v4L43JcfLvh5tAi2/LWLpal0dMmTxAR25X6sc39lu1VP2Az7uQh0IWPmFbMVmH3a/kZfkRs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778410764328.9261801157372; Mon, 26 Jun 2023 04:20:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBm-0003Cj-Fe; Mon, 26 Jun 2023 07:15: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 1qDkBj-00034Q-MB for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:19 -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 1qDkBb-0000lq-IY for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:19 -0400 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-362-PiE4wFQLN6yyhtkqvhk8BQ-1; Mon, 26 Jun 2023 07:15:08 -0400 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3111e2620ebso1723108f8f.3 for ; Mon, 26 Jun 2023 04:15:07 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id z13-20020adfe54d000000b00313ee3e50c7sm3811532wrm.97.2023.06.26.04.15.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:15:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778110; 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=N44+HnRq4DAtDlW9dbxudCSTaphe4CvmE1SWPfnF8rda0t/QyxmtOnEJK87Bfo1jLy+Pwz Wshor2W1YLZZTW1zPEXODztATe/4N+TAfBKftUHVgohEH/AxQmqy2eqmJ9xHsHLE6uvvWp HN/K26rOWahJ6OJEAzk/sEVVjbvsCvg= X-MC-Unique: PiE4wFQLN6yyhtkqvhk8BQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778106; x=1690370106; 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=Vwk/gv3kKbQUidS2yOpjRZjk+aIDUMP45TaBSbpMl3qXSe4bRWFmnCavF4FnpAzbTZ 6UTJZRAeqxlns/4KQ5+/jXYs1rZd/cR+BTM45gi7bEOqzebXx8bNk4mxtSP4IBNH/mcI 4+DiY8z7We92LnN6Tnhhmmd7DeqAjkSolKkdahVUlskIXWX/rIfc2qRKbNqxti1Vu4Gv s2FcvF+9zWhbIxCboExRpWdzfN607LP+5hDh3HY9ON+dIFryv8RDomrh/NpzvO1UL2Nr Zg5sD4Xn+lZvo0/0uaOy2XUA96i0b+Y8Fv7HXdF5ssIxQDXpkEIYpkq9VCLmmPRXQmAz BzsA== X-Gm-Message-State: AC+VfDxWugnMuD9rbkogaWRUGwHiSHD6uchRayaf/8oIlmEnEM2ZDMYO zPxY3giyPy/2z+C2KPsjWw2HgE6uOb9csCaGdLgF21a8cRteGD/ORoimTJKEQbW2At6gCv3R1zz MKcXH52ZWbU4Cirxh8nVQfc5YHvUtW6L216+WyDfH/qvoFQ2gZeQ7nJ42VM4Svq/aOwYjYaVSVI k= X-Received: by 2002:adf:d092:0:b0:30f:c7e4:d207 with SMTP id y18-20020adfd092000000b0030fc7e4d207mr19297024wrh.61.1687778106458; Mon, 26 Jun 2023 04:15:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6qOdT+nI6V0fEQg0VLH22pq1lAdqfkwzYit7wJxmudkjwSIXU0Sq72WR47C1cWdnUI59ZlsQ== X-Received: by 2002:adf:d092:0:b0:30f:c7e4:d207 with SMTP id y18-20020adfd092000000b0030fc7e4d207mr19297010wrh.61.1687778106155; Mon, 26 Jun 2023 04:15:06 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 13/18] target/i386: Intel only supports SYSCALL/SYSRET in long mode Date: Mon, 26 Jun 2023 13:14:40 +0200 Message-ID: <20230626111445.163573-14-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778412726100003 Content-Type: text/plain; charset="utf-8" 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 |=3D 1 << 1; /* CmpLegacy bit */ } } + if (tcg_enabled() && env->cpuid_vendor1 =3D=3D CPUID_VENDOR_INTEL_= 1 && + !(env->hflags & HF_LMA_MASK)) { + *edx &=3D ~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 *cp= u) 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 =3D=3D 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 *cp= u) 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 =3D=3D CPUID_VENDOR_INTEL_1) { + goto illegal_op; + } if (!PE(s)) { gen_exception_gpf(s); } else { --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778395; cv=none; d=zohomail.com; s=zohoarc; b=d/DmfpVivHk0qv1Epe0m8YUAOfC0TFB3+Mbf02IgPQV6IjtzRudGLFoU+ZeWf+CH5xwcdyU1M9ZFCNMyqw8zik2gfO955rO2a13I4PR4ndv71YtCp7SwkUx4F00qaXrmGTFBv+I7Gxl6kA/ljfdgPi2ZQjY7h7caUBTrLgCP5Mo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778395; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=b437COmzgCSpqdY33D96rpKkD+pKvcOW0IPyRHH0SKk=; b=SiA9YGHyV2KEV50yOIcBLWtOr2+SoDRiuznxh6LxHgnPFWo4+1RgNb5hnYbaqcASzWTLy4ZhwG93eQ+kKT2+e0aCj8dZhUZJYN4lSILOHi2e5B5q8ye513gB5Kg+UDSV8dlCNWUzTVvGrB9ECi2qO/PP2o7pRW0Xwv0RAcs2uEA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778395150676.1066941506648; Mon, 26 Jun 2023 04:19:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBn-0003GI-Mv; Mon, 26 Jun 2023 07:15:23 -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 1qDkBj-00034c-Nq for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:19 -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 1qDkBc-0000lu-FS for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:19 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-424-EFrO9KTmO0iioZe0SJv_1w-1; Mon, 26 Jun 2023 07:15:09 -0400 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-3fa06fc72f2so18769775e9.0 for ; Mon, 26 Jun 2023 04:15:09 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id p20-20020a1c7414000000b003fa973e6612sm2334412wmc.44.2023.06.26.04.15.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:15:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778110; 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=b437COmzgCSpqdY33D96rpKkD+pKvcOW0IPyRHH0SKk=; b=Rv8LzlK0CgBbvI2ZoNbx5tiLB+IPc33pirywbH9YSEfDe/YskzU5Y7WP67r0M+YlnYSRHl S4GCygoAdS4CuUle3iOMLcKxTSHSns6oEUJO2pdqhWj5FB3Nts61hYA60Z+WxPzfLTPEAa Z0cYH9xpxKFGpQkdc41kn0O2NyzBahU= X-MC-Unique: EFrO9KTmO0iioZe0SJv_1w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778108; x=1690370108; 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=b437COmzgCSpqdY33D96rpKkD+pKvcOW0IPyRHH0SKk=; b=MhEIn4nakDKJN0NV5TiZFvpciHGk60rmfsFAsHKomURm9YbqzHR9i7z4JSa5nPmYiM hAm+VYd3yEedl4Q1FmCmFCgwaQK+TvDLddV3cQorCGHfP/oQ1J7FJU3MYV5cKhPHb+h6 D9fbSCBS8Pt+44gKpxDYQM5Dtahha5haQz/RzIXcXN9EVAlvRyu/TdX+OHcs7MpEEY93 lSyxiVvKWG7D99y38v+opxA/lEDEYRgiEo3XgkLkgBp5MDuJlJVqrnjzV3vJu+bmxcly BGf88dTC96HM8mSM6e0Vfs6DvnN5+0OOK8mdTZ4MXW9HJy9aRFlsXgdARuBsdIVm1KIb gIxg== X-Gm-Message-State: AC+VfDyjdQWNC3WuGMtKoVIcewoPtuocR9iEkggjtYmIBLxWdpIaud+/ ospi5uZ+bHjx/dxU+z0gNyRMrG2FmGSiVh1fFcVXmw+cwo4j1NpM3xSXnHBjFNgvG3AUlG5D4V1 qpvniCTlO+WMf6xDdzLMPEuMkxO+Tk7qhf27N+m7OwHqUX6hxHPAoMEwY0mKhTjwVH5DcnrSLAI w= X-Received: by 2002:a05:600c:c4:b0:3fa:71db:56ff with SMTP id u4-20020a05600c00c400b003fa71db56ffmr9017535wmm.40.1687778108016; Mon, 26 Jun 2023 04:15:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4yb6EpsfdBS24XqYW7GXkefikbnfx8HQaKYqV5fYYPCgVz84GMt7VCueXpfNxteefoCbJY7A== X-Received: by 2002:a05:600c:c4:b0:3fa:71db:56ff with SMTP id u4-20020a05600c00c400b003fa71db56ffmr9017522wmm.40.1687778107765; Mon, 26 Jun 2023 04:15:07 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 14/18] target/i386: AMD only supports SYSENTER/SYSEXIT in 32-bit mode Date: Mon, 26 Jun 2023 13:14:41 +0200 Message-ID: <20230626111445.163573-15-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778396629100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- 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 *cp= u) s->base.is_jmp =3D DISAS_NORETURN; break; case 0x134: /* sysenter */ - /* For Intel SYSENTER is valid on 64-bit */ - if (CODE64(s) && env->cpuid_vendor1 !=3D CPUID_VENDOR_INTEL_1) + /* For AMD SYSENTER is not valid in long mode */ + if (LMA(s) && env->cpuid_vendor1 !=3D 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 *cp= u) } break; case 0x135: /* sysexit */ - /* For Intel SYSEXIT is valid on 64-bit */ - if (CODE64(s) && env->cpuid_vendor1 !=3D CPUID_VENDOR_INTEL_1) + /* For AMD SYSEXIT is not valid in long mode */ + if (LMA(s) && env->cpuid_vendor1 !=3D CPUID_VENDOR_INTEL_1) { goto illegal_op; + } if (!PE(s)) { gen_exception_gpf(s); } else { --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778298; cv=none; d=zohomail.com; s=zohoarc; b=E3rabyml40VIjVHnXzz4/Z/DvtE2seZlZV3vdCMElCnX7l9BognXmtf6fLbyOx+NeRCa/5aQF0ruEErW5X9/hsMKSTWb8w0zUb3w24+yhYAwD+V82MaFdTJDRz+OccW1wRJd5PEptK2jKQJzkcxbIlMfXpj2ts3koyupUJmK2R8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778298; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pZvex8/ZXpvWNVXIq7fGZYNulJMqc+TOm3c+D70WX+I=; b=ZBncxlf2IVmGHdj7bEiZzkmHZLWznqC//C8B1vc1TmzvP/x/c0cYn82n3v9QMsQ3YV9DLnkWwk05XRnOTn3sXkuzoFWujf4+KGndW/joCpHcAwSBnf1posAHtbrdTUiMM9Z3E+vXHv5NUTaxmPHiWIzyGoJzpIzYZg6lTv0K7Ys= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778298648374.9992229074154; Mon, 26 Jun 2023 04:18:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBu-0003Mn-Sl; Mon, 26 Jun 2023 07:15: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 1qDkBl-00037G-1s for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:21 -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 1qDkBi-0000mb-4c for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:20 -0400 Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-513-ngwb1t43MAGrZTaAEhV27Q-1; Mon, 26 Jun 2023 07:15:11 -0400 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-4f858280d89so2211196e87.2 for ; Mon, 26 Jun 2023 04:15:11 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id k1-20020a05600c0b4100b003fa82210e7asm7478456wmr.14.2023.06.26.04.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:15:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778112; 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=AeR0V8a5UsR5UtpECo5i7h54ARiHbkcQshtJYhTv4jOFU4t4xRXT9RF0gitAEX4sRo70vh qDht6FUaETDStTc3PxHljBKABVlGDikcCQE9bLxzShkKCSPZzDX4FjmbGGZLdBMGu9F47o fSi58GTnWO6mKftA3NcD10KHTsbQpSM= X-MC-Unique: ngwb1t43MAGrZTaAEhV27Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778109; x=1690370109; 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=Li6A1p6+jgrjh3Lb9gusMa9PS/WLo/owwmsYtF7znJVDLAivgfaobocCadK0cEWm6S exMd8RntLUGJdF8J3wl/bChvLB3NHE8BYBzqM7F/OlK9edmNYdq41HhCO2hBR5uD0UGO CC3NFRqbl95HEoBB2hWRYKH0Qs8fXjQD2z8M63XfRLHH5XFPAVXlU46kp9/nog8oqEWC DzUQRy2vCt6RUmCOMo6qOEle7oALP6zznN+4kINmS7MOtroMXVNIyjtQMxFqQQ8fcbBZ 4/WEWvLC9w+AgOe/s71MY5Qqe/7iI8KWvct+i9KISyYV48qssvtEGNrIoiV+nt9aolW/ 1uYA== X-Gm-Message-State: AC+VfDwvWWRtoVsm60eXsROBRzrW8zXQVLZbmzxDpvfMLn7ElJGEx57q f72u3aQZI04c4ncegWERjAPo2bz3a+hIGHw+Rfz3C0ksCrVJmVZsJ5V/be8znDj1HyBlmACNPl8 qxi14IZ79jJvDGhs6W0nM2P+5zmY/jvUTMye/O7WZ8eSXCok6kUPTt2a7koiLUlXQMA/I1cDxC2 U= X-Received: by 2002:a19:2d54:0:b0:4f8:5e5f:b368 with SMTP id t20-20020a192d54000000b004f85e5fb368mr14396041lft.21.1687778109420; Mon, 26 Jun 2023 04:15:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5B9CDfxucKhe7Xn9cRJ+NBReAfgxmbte88t6ZuhiTUqHEzFjCgnlviclhS8KPKxmHH0VlBeA== X-Received: by 2002:a19:2d54:0:b0:4f8:5e5f:b368 with SMTP id t20-20020a192d54000000b004f85e5fb368mr14396027lft.21.1687778109066; Mon, 26 Jun 2023 04:15:09 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 15/18] target/i386: sysret and sysexit are privileged Date: Mon, 26 Jun 2023 13:14:42 +0200 Message-ID: <20230626111445.163573-16-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778299503100001 Content-Type: text/plain; charset="utf-8" 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 !=3D CPUID_VENDOR_INTEL_1) { goto illegal_op; } - if (!PE(s)) { + if (!PE(s) || CPL(s) !=3D 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 =3D=3D CPUID_VENDOR_INTEL_1) { goto illegal_op; } - if (!PE(s)) { + if (!PE(s) || CPL(s) !=3D 0) { gen_exception_gpf(s); } else { gen_helper_sysret(cpu_env, tcg_constant_i32(dflag - 1)); --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778377; cv=none; d=zohomail.com; s=zohoarc; b=KpeIAXYM6+txbcwpCVjKKYjRyshAQ5fASiYjJ794MTX2LYb+r+kChifiSCc563OlABt/mbTfJ4DIUQINh0OhUJnDtwJalOTQq1+jaqV3urUs0hKfEi/NyMZO1qWf0c3hBkHcGzPp0SFXBsx4Le+0nUS7U5IyyXbNlkhbQQufwWo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778377; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=z1TKWKdWTS3EIYTM+VUz4o7AGmp4YH25zCUbvYtLRVc=; b=Tdk3lZGCSqwjhCstajPswRRizDY621TcmylpekusMIr6JEpdEECVMwMvxKVa/ezpEAuvmSL4B3qs9xM44ZD4ukuNPUlTb+uJi1kyUfMM7rlT377WxuNYQY+sKqS33U+OURhcSP7RMfBa+YE6j+UnB/Cxwe/S8vkkuL79qiKP/V0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778377813120.07639876855092; Mon, 26 Jun 2023 04:19:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBu-0003Mg-S9; Mon, 26 Jun 2023 07:15: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 1qDkBl-0003B7-J6 for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:21 -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 1qDkBi-0000mt-59 for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:21 -0400 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-452--v27ZA91Oj-qn-dabH96Yg-1; Mon, 26 Jun 2023 07:15:12 -0400 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-31290e36b6aso1724834f8f.2 for ; Mon, 26 Jun 2023 04:15:12 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id s6-20020a5d4ec6000000b0030ae849c70csm7070939wrv.37.2023.06.26.04.15.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:15:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778114; 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=UXCMYA3b1yme/AOSiH9c+1w/mEHtWiiQq6W93N/dNrRXJKvfIL9VcmapDMgYhnHGfWgJbs 2GAC9V4NX17xuVKI+jnY9MlONLLZ0tKlZIJILYT2djfyGVp8jRYcPAwQaxjK2Rl7gwrcjF RIuO4vHbMggxGjbVbXFVTf+C24fEgbk= X-MC-Unique: -v27ZA91Oj-qn-dabH96Yg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778111; x=1690370111; 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=VSeNVENrVfuGT6TYL/3acqwpOlyBUYVw3GDoljQVjklvf/qiOupFhg3WVI7cuIjwOQ mDNM3SyfpxJM8d7lhkIZc7QbPtxNuSNnwCFZ/9g/400y+BW6tawYgqLuLNBtlVD1v7ku EzeIloVx4mNj4eagS7Tw7Ts0Bfo/ffSW4JSFBLIkaHpO9ofz3S/lsAagS4tY6Zie1rmg irvnEzGyjJDoC1trpnDgaNeVeiTQIZrwS3dB1Sg3507bNYlkadsnyhL7pnxG3TQYlm8U PQsx23vN07mgkAuEJorwHCFW3DY+cCea6rzssM5A9oG9cW+gNF7BwrUhdTLCLVbx5lc7 06KA== X-Gm-Message-State: AC+VfDxPKpLbm14PVsHrghhxmMNGEf2X5D3GjDGj+BE840ke+FC2PyBI AxffZmGYGoXVVuAP8rfpyNWOFnevOsWzQ/P2p/c2e84iTRcHMAnq0uGgrWhhE9OPPBi5ZVI28Gg mtUVqZjo1aP7fExNiA9ZxxA3qEpcHrL8jmKjI47t3WiptSt9m8BJ5Vh0yYu6YxFCy5qfCywBVNy A= X-Received: by 2002:a05:6000:11cd:b0:313:eaac:f337 with SMTP id i13-20020a05600011cd00b00313eaacf337mr3588410wrx.53.1687778110937; Mon, 26 Jun 2023 04:15:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Zbkau2sWvWlO2UdqISGCuajKV95NHMaTYLe3X4CGKtn5VkzyKfLD1oa1XU7KIW/ijZ9e1vA== X-Received: by 2002:a05:6000:11cd:b0:313:eaac:f337 with SMTP id i13-20020a05600011cd00b00313eaacf337mr3588397wrx.53.1687778110659; Mon, 26 Jun 2023 04:15:10 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 16/18] target/i386: implement RDPID in TCG Date: Mon, 26 Jun 2023 13:14:43 +0200 Message-ID: <20230626111445.163573-17-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778378628100001 Content-Type: text/plain; charset="utf-8" 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_f= unction('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_fall= ocate')) +config_host_data.set('CONFIG_GETCPU', cc.has_function('getcpu', prefix: gn= u_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_memal= ign', 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 vend= or1, /* 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) =20 #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] =3D (uint32_t)(val >> 32); } =20 -void helper_rdtscp(CPUX86State *env) -{ - helper_rdtsc(env); - env->regs[R_ECX] =3D (uint32_t)(env->tsc_aux); -} - G_NORETURN void helper_rdpmc(CPUX86State *env) { if (((env->cr[4] & CR4_PCE_MASK) =3D=3D 0 ) && @@ -137,3 +131,18 @@ void helper_wrpkru(CPUX86State *env, uint32_t ecx, uin= t64_t val) env->pkru =3D 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 *c= pu) gen_cmpxchg8b(s, env, modrm); break; =20 - case 7: /* RDSEED */ + case 7: /* RDSEED, RDPID with f3 prefix */ if (mod !=3D 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 =3D (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; + } =20 case 6: /* RDRAND */ if (mod !=3D 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; =20 default: --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778392; cv=none; d=zohomail.com; s=zohoarc; b=OkBswmb+Hm9Z0XN39tssh22L6PCZ8adjeQ+gs3j5sHP3PXrrbmT86UY1FXzoYJBcHI1OjLdoLutgc8LOZvhVFxMvSVkW/VcYjdRj67UCusSuHhqTPv4iojqdxofxX63InBYLhmPkMuPhWdFOdV2zqKAgIuEEIS4NYqIDW7ApwPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778392; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jxo0t+jYTob4i3n0tl1tmTHGoKeu4dfrE81+plrkwh8=; b=A7D+O9RMEevEPELF+Qm7XAqt5qMPjtkX6jG8sSb7tI7mMiN6ketZtBbxdqnG23xR33E0y47wL4dBUw2e7AtahVuDycyiw2JCb83tUcSwCcCbhim+h8ZJQq2YEWFSBfHMMiwmtm7+VM39JMqZPFOS/QYy6G58qfMLs2VdH9JrByc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778392954814.8926693168245; Mon, 26 Jun 2023 04:19:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkBv-0003O5-9x; Mon, 26 Jun 2023 07:15: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 1qDkBl-0003BE-NT for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:21 -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 1qDkBi-0000nL-VJ for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:21 -0400 Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-468-xZ0_JD7LOmSQrHbMKAFO9Q-1; Mon, 26 Jun 2023 07:15:14 -0400 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-4f97512901eso1820806e87.3 for ; Mon, 26 Jun 2023 04:15:14 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id z10-20020a7bc7ca000000b003f8f8fc3c32sm7398551wmk.31.2023.06.26.04.15.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:15:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778117; 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=jxo0t+jYTob4i3n0tl1tmTHGoKeu4dfrE81+plrkwh8=; b=ftUujoCppxxbYfQlVMYltHA0xvo2NCQIq7n6JX1mMGsQov3CC+RbyLER6j5dHKQZuLF+ck rIDGnRv39O9QVVJ9PZq5VnYXQAQrivBulw5dJWuwXkSpf1FGZXQRSZWujcRBtVPdMpHWZD KjgFQi/mpXGX3bzmd/bnfnRuaSEqgDY= X-MC-Unique: xZ0_JD7LOmSQrHbMKAFO9Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778112; x=1690370112; 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=jxo0t+jYTob4i3n0tl1tmTHGoKeu4dfrE81+plrkwh8=; b=BtEybW/9GGtzebjieBDA4pE1hnk7/EFqxCvXSo9jZKWs27VlfY+F/wP/hN2uqMj49g hE3n0qm734RRA44L4GPL0WWWoZB5t9V751klbc0wzu0V345io571kAfWi/gGW8bforJT 57Wd1H/R8DP1dY8gRfh4wRBSWwUkY/0W27rfivABE+mrtMyyX2BSG9YiSJh/seJKnEmz n1gXd5KE7nLVJbg4nsHonBu67Kfn1tG8mLLMqexOqss1RvILncuWpKSxywOrVEmU4Zka 1oQhRKOoCPBPhNztxqrKB+fURWEKLXs6Qsp2gTbiUv2Xl0rjFLYMyL4NgVnWixJIMzwp mXdw== X-Gm-Message-State: AC+VfDxH3nYNVz4bl8cnvsd6P1PcF4PyCjYSU3ywMWrG80HdE2es/1Yg oM5sSfd3/FnlqGKEGz/xbsi9mNqWD7G0kUymswnjzbkR3Orm+R7+TeODsXw7A918eCN1kqCXKsl zKILxAhpkcNitw5dCiSTXS0dWyGw46JxIZZEG1v2ohxptZ28MpegQIkPI24aX7JTJiPhmhvUcIj 8= X-Received: by 2002:a05:6512:68:b0:4f7:4098:9905 with SMTP id i8-20020a056512006800b004f740989905mr15854719lfo.65.1687778112665; Mon, 26 Jun 2023 04:15:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4lkGslXHDTKxR6iFleJStwKdYKBgzRhLThSMnMYpCAsIwGiFsX1luCQDgKMr7ZioAvcS8MfA== X-Received: by 2002:a05:6512:68:b0:4f7:4098:9905 with SMTP id i8-20020a056512006800b004f740989905mr15854705lfo.65.1687778112250; Mon, 26 Jun 2023 04:15:12 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 17/18] target/i386: implement SYSCALL/SYSRET in 32-bit emulators Date: Mon, 26 Jun 2023 13:14:44 +0200 Message-ID: <20230626111445.163573-18-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778394159100003 Content-Type: text/plain; charset="utf-8" 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. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- bsd-user/i386/target_arch_cpu.h | 4 ++++ linux-user/i386/cpu_loop.c | 9 +++++---- 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, 20 insertions(+), 17 deletions(-) diff --git a/bsd-user/i386/target_arch_cpu.h b/bsd-user/i386/target_arch_cp= u.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; =20 + 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..9eeda551eaf 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -211,6 +211,9 @@ void cpu_loop(CPUX86State *env) =20 switch(trapnr) { case 0x80: +#ifndef TARGET_X86_64 + case EXCP_SYSCALL: +#endif /* linux syscall from int $0x80 */ ret =3D do_syscall(env, env->regs[R_EAX], @@ -227,9 +230,9 @@ void cpu_loop(CPUX86State *env) env->regs[R_EAX] =3D ret; } break; -#ifndef TARGET_ABI32 +#ifdef TARGET_X86_64 case EXCP_SYSCALL: - /* linux syscall from syscall instruction */ + /* linux syscall from syscall instruction. */ ret =3D do_syscall(env, env->regs[R_EAX], env->regs[R_EDI], @@ -245,8 +248,6 @@ void cpu_loop(CPUX86State *env) env->regs[R_EAX] =3D 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 vendo= r1, CPUID_EXT_X2APIC, CPUID_EXT_TSC_DEADLINE_TIMER */ =20 #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 vendo= r1, #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) =20 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, in= t) 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 =3D offset; } +#endif /* TARGET_X86_64 */ =20 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 =3D (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_MAS= K | @@ -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 |=3D 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 */ =20 /* 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/s= eg_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" =20 -#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 =3D (env->star >> 32) & 0xffff; +#ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { int code64; =20 @@ -61,7 +61,9 @@ void helper_syscall(CPUX86State *env, int next_eip_addend) } else { env->eip =3D env->cstar; } - } else { + } else +#endif + { env->regs[R_ECX] =3D (uint32_t)(env->eip + next_eip_addend); =20 env->eflags &=3D ~(IF_MASK | RF_MASK | VM_MASK); @@ -78,7 +80,6 @@ void helper_syscall(CPUX86State *env, int next_eip_addend) env->eip =3D (uint32_t)env->star; } } -#endif /* TARGET_X86_64 */ =20 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 =3D 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 =3D=3D 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_h= elper.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" =20 -#ifdef TARGET_X86_64 void helper_syscall(CPUX86State *env, int next_eip_addend) { CPUState *cs =3D env_cpu(env); @@ -36,7 +35,6 @@ void helper_syscall(CPUX86State *env, int next_eip_addend) env->exception_next_eip =3D env->eip + next_eip_addend; cpu_loop_exit(cs); } -#endif /* TARGET_X86_64 */ =20 /* * fake user mode interrupt. is_int is TRUE if coming from the int --=20 2.41.0 From nobody Fri Dec 19 15:17:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687778190; cv=none; d=zohomail.com; s=zohoarc; b=YRJjlFea+GUmZ2pTvnC8BNjig1qWW8xykL59OX8L/E21FZoBGoRbOMGgneKVcOF5u4ar5AMVD0FUDmxX8ZPMzUTBjL475tkPazY8oCM9Nx/gC5aXRdCPX7yX38qSHxs36hKfOeJWL5aco/ZXeKxQVH1QWq5nwaPB9O2ygYuKGv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687778190; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ath+2F7qJveL8sgT+2ECYF27f9KTqV0CItidFFplvAo=; b=QpLpILgBa7aD8GVMS/QjqxYWQ6vYwJqtYx/HefOxU88O1r873WbPIKMSTMRyvc3b8xtFZtqXEEyClM1aR+oAGK0Sav/P9IR6JQvI47x/Ixp56qhCoIHK7JtetBF5j3j2ZhKz11ZWjhn4D/8v5zSE6dA53eNuxgnvS+TC5h2KL4o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687778190160634.779160709253; Mon, 26 Jun 2023 04:16:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDkC1-0003lo-Ps; Mon, 26 Jun 2023 07:15:37 -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 1qDkBz-0003fn-RS for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:35 -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 1qDkBx-0000vr-Ky for qemu-devel@nongnu.org; Mon, 26 Jun 2023 07:15:35 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-325-wkMPgA4gNiOGjhnICYijVA-1; Mon, 26 Jun 2023 07:15:31 -0400 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-3fa8562f6cdso6838975e9.0 for ; Mon, 26 Jun 2023 04:15:30 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id c6-20020a05600c0ac600b003f9c0a7c6bcsm7471459wmr.0.2023.06.26.04.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 04:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687778133; 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=Ath+2F7qJveL8sgT+2ECYF27f9KTqV0CItidFFplvAo=; b=PJJxY7b0k0lncq25OvxvgzYCMkGXjBYigDOfBEuOJIVQU8KaWiaYr6PojFzMTX5VcR4Sq7 LWGhYX40eMlkY40ysJwGKvvmgOVFQOuoe111MRu/h0BgCfg1VvXyJkvmSqsSW3r55QQeqk yPj7K/NnDLFqKgdHGR55c6wjWfWYlyk= X-MC-Unique: wkMPgA4gNiOGjhnICYijVA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687778114; x=1690370114; 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=Ath+2F7qJveL8sgT+2ECYF27f9KTqV0CItidFFplvAo=; b=Q8ON22zIEEe2nXtn5gwXAzfwsiFovFCYB3jAtjf2kuQoHpkfJ2di6zsffWlKETmeMw qGZg1ASOKhNYadRCcNOoYLxcq3TH99XR5Cv1s75lHtKbbbvRnKDpFINGBAVtr0wEHb0I mrJdpTg5hTsrsf0gxKjCez/I53hyWRXIe6LsootKAIdk2xj8VbYeu2iWMMaJ/9OHotZq EuZF2w0pUuKvQU0uUMSEpNtOO0VHvBIRGqI5vokuMj1OC6ErhIuWclhQq79/v9qadmk3 c9iz2q05acK16xwdOjD94eyd41Z7qhlDPqmnPdb9qMyvfD+r8rWBuDNQ1befV/cvT2yC H1zg== X-Gm-Message-State: AC+VfDxol1FrPA8KFilgyXjmjouCaO193ypnUnj+ZgKOpoBiYJQdE4d4 doTqnlb+5CSOhS/RTFQV+dsgjsUXohhQ3AI1TTPrFay+xtRS3jMKS/9wo1h/F3TgiiACF2bfM3a CD8av7Kgd1EbUDja7+DG9wf61iRoFRM4+JOzrKNV09So9ASXiP9JA6ZXFipFGJhf388AMhKlQuf E= X-Received: by 2002:a7b:c8c9:0:b0:3f9:82f:bad5 with SMTP id f9-20020a7bc8c9000000b003f9082fbad5mr17574630wml.35.1687778114362; Mon, 26 Jun 2023 04:15:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ZhH1IdDj5/52AsPvaf+66M4haJQwShcVe7RM0FwpI9/5lCfBrTjEDYvO5YSTlHQ9VR4D7Ag== X-Received: by 2002:a7b:c8c9:0:b0:3f9:82f:bad5 with SMTP id f9-20020a7bc8c9000000b003f9082fbad5mr17574613wml.35.1687778114020; Mon, 26 Jun 2023 04:15:14 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Nina Schoetterl-Glausch Subject: [PULL 18/18] git-submodule.sh: allow running in validate mode without previous update Date: Mon, 26 Jun 2023 13:14:45 +0200 Message-ID: <20230626111445.163573-19-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626111445.163573-1-pbonzini@redhat.com> References: <20230626111445.163573-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687778190927100001 Content-Type: text/plain; charset="utf-8" The call to git-submodule.sh done in configure may happen without a previous checkout of the roms/SLOF submodule, or even without a previous run of the script. So, handle creating a .git-submodule-status file even in validate mode. If git is absent, ensure that all passed directories exists (because you should be in a fresh untar and will not have stale arguments to git-submodule.sh) but do no other checks. If git is present, ensure that .git-submodule-status contains an entry for all submodules passed on the command line. With this change, "ignore" mode is not needed anymore. Reported-by: Nina Schoetterl-Glausch Fixes: b11f9bd96f4 ("configure: move SLOF submodule handling to pc-bios/s39= 0-ccw", 2023-06-06) Signed-off-by: Paolo Bonzini --- configure | 2 +- scripts/git-submodule.sh | 73 ++++++++++++++++++++++------------------ 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/configure b/configure index 86363a7e508..2b41c49c0d1 100755 --- a/configure +++ b/configure @@ -758,7 +758,7 @@ done =20 if ! test -e "$source_path/.git" then - git_submodules_action=3D"ignore" + git_submodules_action=3D"validate" fi =20 # test for any invalid configuration combinations diff --git a/scripts/git-submodule.sh b/scripts/git-submodule.sh index 11fad2137cd..335f7f5fdf8 100755 --- a/scripts/git-submodule.sh +++ b/scripts/git-submodule.sh @@ -9,13 +9,22 @@ command=3D$1 shift maybe_modules=3D"$@" =20 -# if not running in a git checkout, do nothing -test "$command" =3D "ignore" && exit 0 - +test -z "$maybe_modules" && exit 0 test -z "$GIT" && GIT=3D$(command -v git) =20 cd "$(dirname "$0")/.." =20 +no_git_error=3D +if ! test -e ".git"; then + no_git_error=3D'no git checkout exists' +elif test -z "$GIT"; then + no_git_error=3D'git binary not found' +fi + +is_git() { + test -z "$no_git_error" +} + update_error() { echo "$0: $*" echo @@ -34,7 +43,7 @@ update_error() { } =20 validate_error() { - if test "$1" =3D "validate"; then + if is_git && test "$1" =3D "validate"; then echo "GIT submodules checkout is out of date, and submodules" echo "configured for validate only. Please run" echo " scripts/git-submodule.sh update $maybe_modules" @@ -51,42 +60,42 @@ check_updated() { test "$CURSTATUS" =3D "$OLDSTATUS" } =20 -if test -n "$maybe_modules" && ! test -e ".git" -then - echo "$0: unexpectedly called with submodules but no git checkout exis= ts" - exit 1 +if is_git; then + test -e $substat || touch $substat + modules=3D"" + for m in $maybe_modules + do + $GIT submodule status $m 1> /dev/null 2>&1 + if test $? =3D 0 + then + modules=3D"$modules $m" + grep $m $substat > /dev/null 2>&1 || $GIT submodule status $mo= dule >> $substat + else + echo "warn: ignoring non-existent submodule $m" + fi + done +else + modules=3D$maybe_modules fi =20 -if test -n "$maybe_modules" && test -z "$GIT" -then - echo "$0: unexpectedly called with submodules but git binary not found" - exit 1 -fi - -modules=3D"" -for m in $maybe_modules -do - $GIT submodule status $m 1> /dev/null 2>&1 - if test $? =3D 0 - then - modules=3D"$modules $m" - else - echo "warn: ignoring non-existent submodule $m" - fi -done - case "$command" in status|validate) - test -f "$substat" || validate_error "$command" - test -z "$maybe_modules" && exit 0 for module in $modules; do - check_updated $module || validate_error "$command" + if is_git; then + check_updated $module || validate_error "$command" + elif ! (set xyz "$module"/* && test -e "$2"); then + # The directory does not exist or it contains no files + echo "$0: sources not available for $module and $no_git_error" + validate_error "$command" + fi done - exit 0 ;; + update) - test -e $substat || touch $substat - test -z "$maybe_modules" && exit 0 + is_git || { + echo "$0: unexpectedly called with submodules but $no_git_error" + exit 1 + } =20 $GIT submodule update --init $modules 1>/dev/null test $? -ne 0 && update_error "failed to update modules" --=20 2.41.0