From patchwork Tue Jan 19 14:22:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Edmondson X-Patchwork-Id: 12029923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D204C433E0 for ; Tue, 19 Jan 2021 14:36:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ABCBE20729 for ; Tue, 19 Jan 2021 14:36:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ABCBE20729 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:41994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1s7Z-0004VS-Lg for qemu-devel@archiver.kernel.org; Tue, 19 Jan 2021 09:36:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1s4a-0002XC-JV for qemu-devel@nongnu.org; Tue, 19 Jan 2021 09:33:32 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:41540) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1s4Y-0003k8-KA for qemu-devel@nongnu.org; Tue, 19 Jan 2021 09:33:32 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10JEOVCu023645; Tue, 19 Jan 2021 14:33:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=ZbRfLsDhWtuhK7Qm5NXdKknC88dwjGdtZvbMq4fdzVw=; b=YAOWsCSZCzWoA91wNQpdDQkM5WDqv1r7cf8YP1hFgA6EiqFKOODFvo37iBW2siEOpNvF p7n+/0ds4elHXCKY0c/dyjHUu/ayDKQxOu4ytVZGf3gMdxgTUUgy9MDNLl/tGbo6hHj+ D/q4D5NBinkVbnVkRsPowyZIrwln72wbS/qNwuTpxiIB9NsBednr7nt6YVvnLCsuM+Wv b5Gh3NNB8u1A9xr8rV1y2J5hZXu4ocpYIVZjdwo3OeDyqriHe6s7wBfz5LKSqhRlHMed 9GLZgUgJoTtxPjYy1OrG+zhTYCNX3FXA6SgT9QtKoaophmU/O+4ajj/Ggj9FTMu5ApjW hg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 363nnahff6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Jan 2021 14:33:26 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10JEPNnZ069961; Tue, 19 Jan 2021 14:33:26 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by aserp3030.oracle.com with ESMTP id 3649qp98cy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Jan 2021 14:33:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EmaFkohtw99R93YpNx6hPvaNAlSRU/amH9E9idQHWZ9J3ovJ/VZiRJmuxTmolO9xogyXYTlba1Rt0z4Yf+MChu/hCf4s0L1MSZkXKpaZKm8TOfSsfJ8AJLEeeRWJJUf20o/OYJSXXZHA3Y+wS9EabJg+kzQ5Zd8pNPSnSWEb8u6CYuMOLFhNiJfuvr4kh83js7fv/v4FbXXqtlagBf8dT1U5dn/X8AniTisNJFZ9rdRJAR/gNRB0D1JT2eEvLuDIDDY90wT/HAo9mHCWLi8wwH8YLTf7pKUP79mkcERF1tNOpMRQTObRwq4aas48CAhTf4BeVLRuhwLxZZ2RPN91PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZbRfLsDhWtuhK7Qm5NXdKknC88dwjGdtZvbMq4fdzVw=; b=jfY1WS5/bDPujraIm/romO+2uaSCyFLJ1Wfe6BejgEdAUyWUyxVGPEWEjEs1AnHW+V3GCQZmLOkIWqZpJYl0ldyZuadEaOG52KPQ26iDJVoNqSLHq55ykgeOhFYAOi8aBbTt0DqAN2EnyNRKtChEtoPOPKXozSsNGW8M9heBjm8smSSxTnEshjj6LzuOBT8mKOSMl8zvwHNAAms4zX4rdK8eEhRBzMlwMFRCasvJMKHDyNx6ykrAVHCGc+3NiZ3XeWPuGWh5JS7j/zGPjq/AjXMYUM+LyDOoJR258wEk8Nyjziq4QDKISpi/jSq7O52UgUjKA1i6VmaEZiHTj8RDDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZbRfLsDhWtuhK7Qm5NXdKknC88dwjGdtZvbMq4fdzVw=; b=aJXZrPkH6azbS4kLwG/PbxmakpSL8PELQqufr/4QCsZ2HjxP1zpZzE4XKzrSiLo9ReauFmLKMoydZkGlA8oz6CEFXmN3o4hsBCTJC8jjChK4Q2mQJP8l0kAboBuOZoULoidk2WFZvpJwseaFzjpCY6zoldgK4AYYqEY9DWYdnro= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=oracle.com; Received: from MWHPR10MB2048.namprd10.prod.outlook.com (2603:10b6:300:10d::19) by MWHPR10MB1757.namprd10.prod.outlook.com (2603:10b6:301:7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.11; Tue, 19 Jan 2021 14:22:16 +0000 Received: from MWHPR10MB2048.namprd10.prod.outlook.com ([fe80::106e:c89d:3be1:6a52]) by MWHPR10MB2048.namprd10.prod.outlook.com ([fe80::106e:c89d:3be1:6a52%3]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 14:22:16 +0000 From: David Edmondson To: qemu-devel@nongnu.org Subject: [RFC PATCH 1/2] hw/i386: -cpu model, -feature, +feature should enable feature Date: Tue, 19 Jan 2021 14:22:06 +0000 Message-Id: <20210119142207.3443123-2-david.edmondson@oracle.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210119142207.3443123-1-david.edmondson@oracle.com> References: <20210119142207.3443123-1-david.edmondson@oracle.com> X-Originating-IP: [2001:8b0:bb71:7140:64::1] X-ClientProxiedBy: LO4P123CA0153.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:188::14) To MWHPR10MB2048.namprd10.prod.outlook.com (2603:10b6:300:10d::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from disaster-area.hh.sledj.net (2001:8b0:bb71:7140:64::1) by LO4P123CA0153.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:188::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.11 via Frontend Transport; Tue, 19 Jan 2021 14:22:14 +0000 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 4afdb1a1; Tue, 19 Jan 2021 14:22:07 +0000 (UTC) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 45656680-a582-4b48-03e7-08d8bc859f57 X-MS-TrafficTypeDiagnostic: MWHPR10MB1757: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oIanD6YspQdiPmY46GpzkFXx6th2k0ZvgE/j1+7xGzDLh3jApPromnXVCLK5hMFV84q5AICopJqv5LRkfGoZ9Xs6gL2bJ2q45tPcCMPHdJ6TwSGJg3OHEG2ITSxQpKFyZfwGhnztiexTpWfSGTsiiELRyJ7fpkdcM2DhxqZdXWHqSqaQdATauNix3/8ZLSfifi/q3swR7w9dh2zA6bnO6oFrExreuGLxb8NSIDfmYkPm3RwsQ2p64t98uvgNni6pb1iIuB6Ist313JAXnvdeKcolSQk8FC+9hBWlyX82lvrjdeNlH7PMUHb+yOrMPrLtfQHMDiPPa6mB5NXA8Uh1eKIJDJ0zanex+UfM0luU2JAY8qMXbsaayhJTtaz9LXjEvazQnXsRNpu7rPTB5Zaimw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR10MB2048.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(396003)(376002)(346002)(136003)(366004)(52116002)(86362001)(54906003)(316002)(66556008)(2616005)(5660300002)(8936002)(1076003)(66476007)(66946007)(83380400001)(478600001)(8676002)(36756003)(107886003)(6916009)(2906002)(4326008)(186003)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 7sY01x2W74xQtGYjyaC8G3L4eFjyeK/86w3i8BqR/Xw09PKzj1Ug1FgUWiij4BAoAUHWh6GRvN1TKD8LswCYwPMOomOkV+oDLRqbGO3dga1WrN6wnxjmT9cAys2TcLFiEaHzrJ0ASRDnSY0Ooif2UPoJg04nnivFMiyaOUP/W89RpUrmAbj1DksqPQHFDR4HChuw9XCRPkJuzweZ/1qkKHqG3F73OP/CjznHT6/HyC0dX5shn4LfrMVps2pQ0dq7LFOjVnMPKxl2SUa0StSU2iJNDUiZZrtIu3wJFyRuH03azDiu/ooijlGlOnz0xe6hZN+IL+sHwRj8YnDw8kYRuszf2kYNtQdPnV+UnOFnr9wBl9DX97sfJGM5zah3yW8j3ZteMT3wrFcuA5CBDUkFnW+EVlzS8WWHFiDRMtEt8VyTYs9F9aRrDmXCGQYA/xDdxalz4ln343kIeS6EPcfdA/j4c5WcW5OR6uRSR74Cmvxre56GK2OXZetLAgERrDF6Zvr+lP/qMo+rjO63STmvGKXSlB/oqThd1qEfdaB4yCTkG9daSJWPrvQJH6j/kCPxfIwDlEvOEzrIokWBbg+iuM1s1aU/hSe3dSyfthxCpZ3L6KXA7WA47yZBUJ4vM96og/OGs5o0u0qm62ny1zHpdlCxTjfIuN9YsuUYwpo7gUOfonB5/4zlhWzm+ysNoHOp5VL9MeYPIjQ9GOLFE0i/rxwOKlFPMnhTQ5j95M1oFYqP/VR6k/x1BbOvmpmGLkDhycRyrI4hKeERttAGkEAOfQ6ptlBF0LUiJrYXrvx/oF2e5JAjDzrGH5rinT4tmaGXt4jbBMAYgqzHzO0DmbKywUQ7pFCZ4bRMyXEADu+aZJqThNE4+Ue9z8VToGMag34Bcd4k14iOBrOmP9VJj8SPpqElfCnGXBypekZ2PUQP9fTZKuI6wFKxou7ELE3k8uebZU0MR1u4vrLxoYKZdibpXJKoUv/d6A+5AbeDO9/ewGtQkTkHVwQydZDKAWJuejGW6X7zvbtJLzz27ddG0flgIQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45656680-a582-4b48-03e7-08d8bc859f57 X-MS-Exchange-CrossTenant-AuthSource: MWHPR10MB2048.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 14:22:16.5716 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Tl1aFict2QeVkb0y9OkMzEilX9Q9YY5o+ZFCjpu8+KkG4doP/EV1dZjkfC4vrkQ/Va5nSf89pK2J+T4QRop3jfmqZzFoutwOB/mMYNa6h6Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1757 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9868 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 bulkscore=0 spamscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101190087 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9868 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 spamscore=0 mlxlogscore=999 clxscore=1015 bulkscore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101190087 Received-SPF: pass client-ip=141.146.126.79; envelope-from=david.edmondson@oracle.com; helo=aserp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Thomas Huth , Eduardo Habkost , "Michael S. Tsirkin" , Richard Henderson , David Edmondson , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" "Minus" features are applied after "plus" features, so ensure that a later "plus" feature causes an earlier "minus" feature to be removed. This has no effect on the existing "-feature,feature=on" backward compatibility code (which warns and turns the feature off). Signed-off-by: David Edmondson --- target/i386/cpu.c | 33 +++++++++++++++++++++++------ tests/qtest/test-x86-cpuid-compat.c | 8 +++---- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 35459a38bb..13f58ef183 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -4750,13 +4750,32 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features, GlobalProperty *prop; /* Compatibility syntax: */ - if (featurestr[0] == '+') { - plus_features = g_list_append(plus_features, - g_strdup(featurestr + 1)); - continue; - } else if (featurestr[0] == '-') { - minus_features = g_list_append(minus_features, - g_strdup(featurestr + 1)); + if (featurestr[0] == '+' || featurestr[0] == '-') { + const char *feat = featurestr + 1; + GList **remove, **add; + GList *val; + + if (featurestr[0] == '+') { + remove = &minus_features; + add = &plus_features; + } else { + remove = &plus_features; + add = &minus_features; + } + + val = g_list_find_custom(*remove, feat, compare_string); + if (val) { + char *data = val->data; + + *remove = g_list_remove(*remove, data); + g_free(data); + } + + val = g_list_find_custom(*add, feat, compare_string); + if (!val) { + *add = g_list_append(*add, g_strdup(feat)); + } + continue; } diff --git a/tests/qtest/test-x86-cpuid-compat.c b/tests/qtest/test-x86-cpuid-compat.c index 7ca1883a29..6824d2b13e 100644 --- a/tests/qtest/test-x86-cpuid-compat.c +++ b/tests/qtest/test-x86-cpuid-compat.c @@ -171,18 +171,18 @@ static void test_plus_minus_subprocess(void) char *path; /* Rules: - * 1)"-foo" overrides "+foo" + * 1) The later of "+foo" or "-foo" wins * 2) "[+-]foo" overrides "foo=..." * 3) Old feature names with underscores (e.g. "sse4_2") * should keep working * - * Note: rules 1 and 2 are planned to be removed soon, and - * should generate a warning. + * Note: rule 2 is planned to be removed soon, and should generate + * a warning. */ qtest_start("-cpu pentium,-fpu,+fpu,-mce,mce=on,+cx8,cx8=off,+sse4_1,sse4_2=on"); path = get_cpu0_qom_path(); - g_assert_false(qom_get_bool(path, "fpu")); + g_assert_true(qom_get_bool(path, "fpu")); g_assert_false(qom_get_bool(path, "mce")); g_assert_true(qom_get_bool(path, "cx8")); From patchwork Tue Jan 19 14:22:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Edmondson X-Patchwork-Id: 12029917 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42CDFC433E0 for ; Tue, 19 Jan 2021 14:34:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ABCFD206F8 for ; Tue, 19 Jan 2021 14:34:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ABCFD206F8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1s5R-0002UN-E8 for qemu-devel@archiver.kernel.org; Tue, 19 Jan 2021 09:34:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1s2V-0001Eu-Qu for qemu-devel@nongnu.org; Tue, 19 Jan 2021 09:31:24 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:37322) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1s2Q-0002ut-2S for qemu-devel@nongnu.org; Tue, 19 Jan 2021 09:31:21 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10JEOOb1023585; Tue, 19 Jan 2021 14:28:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=k9ndqdMYrPzBtTmr/SPQVXOYjn+L3JvKqkmiX72uogE=; b=Ubl0Jv6pKuuV1NX58CH7AlkLAYArQvypSnQXPBY3K78hqnWMtb2SgLhdOeKiX/UpEqvS atbiVNjrlBU9eoE0AuLFwHheWTZ8OHDsRCqSLaEL3/VWqeuMkBc//ZGLrcVimTPVNtGY 4/5UrfJIPaSdYSi7eowzGVEeR9P2CSpk1GIA6KiDKlPzuNDY1RRtb1uK71d2232cRASe MfhDRzbegPE011FdnLIaWadtdVbwb3+Bn8dCVnG7HMRTKVDa5uu12ZzwX3Wp3eAO8Vam zzc1iR/jzMt6koOuX2QFEDlIaWAti5Zz70bBkbfbngBmniW/IgfVXO9oY4qCexU08I+j lA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 363nnahert-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Jan 2021 14:28:06 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10JEQtwA047482; Tue, 19 Jan 2021 14:28:05 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by userp3020.oracle.com with ESMTP id 3649wrmnx4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Jan 2021 14:28:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aPmFfdz9B2rbmxC03QG4Q6kzKKWZOYx9BfbJ7PiC0Y/Mgac8pV11EvTtaep8635dPi9nYLWIfMrBhTNZhlpa0Pp5PaZn9IMYkkiV/geK0tJXKbvXl9jNIvwINfqKb/0QnWhSuJQ3bRP+fGNwhwSF/HItVG67BUi6s6QFtVEkcy1tSZ+BAyQW4psvDkgC1j3Ys8KBixvF8A2mhEhE/79QDpvI8Wjn/TBT2JEGOwfDJyVsRtnwbevDvtMAy/IvfWssYw515FN61AOmNe3dQ/4MX3x2QiGWGxjnSwdaIF9daIOUA45KeFs9baUXPKM8NIaHR5kgRsKb7DZI8EAP5FD/8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k9ndqdMYrPzBtTmr/SPQVXOYjn+L3JvKqkmiX72uogE=; b=jJECYiJLCeRU2I4rjS8jG1rshpmBE9R3T3JQo2N92T9Ms8HV360BlxY0lhqlEuduUAgc9KVTqYmdn5yUZau6qJ5aivaX+xhTPaZmQ4ZHRS11Ff5UjP9ukZpUkt6USM45TZ8yUMMUVQZNYIOg/gm3yueBgN2/igSv/DbRFvYye3jsaYB3lQlAm3o9fesYr4mTA3IUNWJMhniu9rShJyhIZjS9HJu5/giz59XZWVoPfa+/lDqtYykY5LMzLJJdYSc1spB40/aRTj37ofjV3NAkUIRTk/KVJ0/LBZNSGePpHlqgqEwl2n8UVywh+QZ9GqQmN8h+vn6yeG+EtKRe7QE9RA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k9ndqdMYrPzBtTmr/SPQVXOYjn+L3JvKqkmiX72uogE=; b=E4rMkLw5gLpTF0UJO0xZIV0lzkHzXd0AJK5i0g7/8WAoO1DXApDg9bMIUUVKO5puQa0rJzV630cTOY0sjo3UoN5HU/9XHyrCj3dMndRCZhG+vD+YWCoXuWDMQ3ABAXuyoTVUl+PsGkoLPY99HAQYiHBOk7B9LbzQ++mmekCdFcU= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from MWHPR10MB2048.namprd10.prod.outlook.com (2603:10b6:300:10d::19) by MWHPR10MB1757.namprd10.prod.outlook.com (2603:10b6:301:7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.11; Tue, 19 Jan 2021 14:22:17 +0000 Received: from MWHPR10MB2048.namprd10.prod.outlook.com ([fe80::106e:c89d:3be1:6a52]) by MWHPR10MB2048.namprd10.prod.outlook.com ([fe80::106e:c89d:3be1:6a52%3]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 14:22:17 +0000 From: David Edmondson To: qemu-devel@nongnu.org Subject: [RFC PATCH 2/2] target/i386: Add "-cpu +kvm-no-defaults" Date: Tue, 19 Jan 2021 14:22:07 +0000 Message-Id: <20210119142207.3443123-3-david.edmondson@oracle.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210119142207.3443123-1-david.edmondson@oracle.com> References: <20210119142207.3443123-1-david.edmondson@oracle.com> X-Originating-IP: [2001:8b0:bb71:7140:64::1] X-ClientProxiedBy: LO4P123CA0091.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:191::6) To MWHPR10MB2048.namprd10.prod.outlook.com (2603:10b6:300:10d::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from disaster-area.hh.sledj.net (2001:8b0:bb71:7140:64::1) by LO4P123CA0091.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:191::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9 via Frontend Transport; Tue, 19 Jan 2021 14:22:15 +0000 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 6754d73e; Tue, 19 Jan 2021 14:22:07 +0000 (UTC) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ac66a43c-fe43-4c0b-10f9-08d8bc859fc4 X-MS-TrafficTypeDiagnostic: MWHPR10MB1757: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eHOdRjSoE2LCmerBJDe0Om0MexohGhVaGi7dmQKkoq5SrCu6WirJYWUBPGbt+pw31ArwYIXRCTByWb1vDa64Ut7Di3AL1sgnZXbd9uH6J5pSCCb5xo6I12LWFPjwH0AxwbnAunozih6IWF+E5ysgFcIDZQlAIRK+o1rv3rd4siNcX5DVd1YzRUgxIewYpqpOhZcxUoLklICEmxwkdF5zs0PUgVt5xeaAed6Qvn1T88Jmi2qQ3ov7AFLqD97PdAOkx3y6eB1g69Yfh4V36HgxKvdLvoWcDXmHNnvNqsnUjekPin/T1DbBf/n3E9xlXC3QlVu9Up9wlyl+wKeBQ6W4XYxRmwNZUNRUx2FOnuBbZNcMn45LTrkGmkXPStJZucMxlFr2fofItoOvlvbxjz0s3Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR10MB2048.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(396003)(376002)(346002)(136003)(366004)(52116002)(86362001)(54906003)(316002)(66556008)(2616005)(5660300002)(8936002)(1076003)(66476007)(66946007)(83380400001)(478600001)(8676002)(36756003)(107886003)(6916009)(2906002)(4326008)(186003)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: GO6vTMW7puDn2AQoETXL13UzS1o5VN+O6M0FZO5IVubHDXHZP4NKT5RxvXyHEsLwMbO97X+JodGjkIk2gKkJpEv1KFslcTdNnLkmN9TjXyZzKbgJX9t1TLpoZYa4Twbmmz9OqaywyYhqZ2kedah5YFsIuqY4XeGgLc+GnwRfVtLKI2mRPUTr9ih1+Oixwu+lhaIke9q2Ox8XKcXQhBRnCUVLrfUSfMvEqGKe2NfUNH72DSaE4fZVDJI8GTX+45mncI7c1j4ayI/ASgfqZG2E+FJzJf36UxlUmfo/vg0S8+dRfrFfC4csqcQhDU6tb4iJx+Yl/SGWq+fLHljjfoOr+/xdW8rkzkqVslyD+/6u/rPGI5pCzg+hQa4owkASBB1dSQTDHnSv9uODxjhISBDKROwFR6qOWt2XAcLlQ5VEvzkn5iIgVp2Tt454YNuc5Grw9tW256U835wAbGzbN1aVWxSH2zCSMaHDQPQs1mx0Y0RIFcSEujTUoxb9MvR5Q8BOYjsrreq0TUUOsNMVVD0czPlwU7NkVn7/q7+4GDTfw4ruAx74P/MRuWu0QNAkGmvlovnMgVmIJq5V9AZeEuHtIncNVfI3G+dd8YKOlHKh2AZAq0zi/28VRG/qVgELVCtrKFjyWPgT+uw+SXw8AYkBQRacGj8HfwvCuw4PxurtFMR5WXJNvkeVpTjvxwVUTnX6j/3Q7kk+s8+VpS60M2j0OLirNDCI1iXpSMDiuB0+7ALOtUxRsnEIH4XRjnw9r8ezk02axtfHYQznGFjCPARQ9XIAzzjioqFlBXKbZIvo8QDzc8pLPZ+g3LiU+TsvYXdU/kzY/7/v9bYufWs3pnm/29z4mht5eygNxnB7jUPK13laegV117SrlEqukCphTOvG5dIY4QSRCjXSwakB/hlbYFcuf9BUHM7Unl88/DSqYOcQvcg7PhKqBrZI89ATen3H/d/cb7ND22vxcrXx+iG1B+xNnO1SzQuFvSQabARY/1G0T31MmFnP+pLSyh4FE4yR68iztw1ilLvTdgyoINsDbw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac66a43c-fe43-4c0b-10f9-08d8bc859fc4 X-MS-Exchange-CrossTenant-AuthSource: MWHPR10MB2048.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 14:22:17.1533 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9FPRjnde46hX1p2brapxtspbcS+xZY4y74c/odgc+m91MCWNrORnP+WwSc8WAQzhuP1Jat9i5ap7iLpzuG0r3saCa4DP+lT9jcrI1oVnjGk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1757 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9868 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101190087 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9868 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 spamscore=0 mlxlogscore=999 clxscore=1011 bulkscore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101190087 Received-SPF: pass client-ip=141.146.126.79; envelope-from=david.edmondson@oracle.com; helo=aserp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Thomas Huth , Eduardo Habkost , "Michael S. Tsirkin" , Richard Henderson , David Edmondson , Paolo Bonzini , Joao Martins Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Joao Martins When enabling reporting to the guest that the hypervisor is KVM via "+kvm", we also enable all of the known KVM features that are supported by the host kernel. A new "kvm-no-defaults" option for -cpu defeats this, enabling KVM reporting but *not* enabling any specific KVM features. Those features can be enabled one-by-one using existing feature flags, such as kvmclock, kvm-pv-eoi, etc. Signed-off-by: Joao Martins Signed-off-by: David Edmondson --- target/i386/cpu.c | 5 +++++ target/i386/cpu.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 13f58ef183..4f1e807815 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6398,6 +6398,10 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp) int i; GList *l; + if (kvm_enabled() && cpu->kvm_no_defaults) { + env->features[FEAT_KVM] = 0; + } + for (l = plus_features; l; l = l->next) { const char *prop = l->data; if (!object_property_set_bool(OBJECT(cpu), prop, true, errp)) { @@ -7269,6 +7273,7 @@ static Property x86_cpu_properties[] = { DEFINE_PROP_BOOL("cpuid-0xb", X86CPU, enable_cpuid_0xb, true), DEFINE_PROP_BOOL("lmce", X86CPU, enable_lmce, false), DEFINE_PROP_BOOL("l3-cache", X86CPU, enable_l3_cache, true), + DEFINE_PROP_BOOL("kvm-no-defaults", X86CPU, kvm_no_defaults, false), DEFINE_PROP_BOOL("kvm-no-smi-migration", X86CPU, kvm_no_smi_migration, false), DEFINE_PROP_BOOL("vmware-cpuid-freq", X86CPU, vmware_cpuid_freq, true), diff --git a/target/i386/cpu.h b/target/i386/cpu.h index d23a5b340a..f76af4a771 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1744,6 +1744,9 @@ struct X86CPU { /* if set, limit maximum value for phys_bits when host_phys_bits is true */ uint8_t host_phys_bits_limit; + /* Don't automatically enable all of the discovered KVM features. */ + bool kvm_no_defaults; + /* Stop SMI delivery for migration compatibility with old machines */ bool kvm_no_smi_migration;