From patchwork Tue Mar 2 20:48:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dov Murik X-Patchwork-Id: 12112207 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,SPF_HELO_NONE,SPF_PASS,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 48976C433E6 for ; Tue, 2 Mar 2021 20:50:51 +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 7A96060234 for ; Tue, 2 Mar 2021 20:50:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A96060234 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHByj-0003Dh-Ew for qemu-devel@archiver.kernel.org; Tue, 02 Mar 2021 15:50:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45708) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHBwd-0001Oy-Ae for qemu-devel@nongnu.org; Tue, 02 Mar 2021 15:48:39 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:24122) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHBwb-00085I-8G for qemu-devel@nongnu.org; Tue, 02 Mar 2021 15:48:39 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 122KjIOn042909; Tue, 2 Mar 2021 15:48:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=Wx/vEAbRkX9QV8xxhblVvmPL07WccAn1wPbN6fuibac=; b=nfK0rfyPxBZ4l0BiBJkM4XqQxmarJnF/ezuMxGzZDkwcRXIogNKdUEY1cKZIwA8ZtzQQ OvPjfHV+xUow98QU6J5cVnIkDvT7A7t784x8EW5MiufMKoj7/6SaQKfghVCMVc/vknlg YH3W6qd9rNNo7jcTBxRXDj0BoTL4zEFX/AsNTlLZiC9tzdfixjSlHMN8KDoXrJbw57cT yt1Y63f5f3di4l2PFv0EmOEmXRttq6zlEcd5JSYZWxo2W0zN+6e05WzdgDZ+gw5bL9Uq LJntwytj94lkNmhiy2R7cbhhb+qyS63igoBKidmLBkhKxkggGkZ+WbwcbpfdE+zGGVtZ CQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 371vp083g1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Mar 2021 15:48:32 -0500 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 122Kk8Ct045199; Tue, 2 Mar 2021 15:48:32 -0500 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com with ESMTP id 371vp083f5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Mar 2021 15:48:32 -0500 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 122KmRQp008407; Tue, 2 Mar 2021 20:48:31 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma04dal.us.ibm.com with ESMTP id 36ydq988k0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Mar 2021 20:48:31 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 122KmT3O25690586 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 2 Mar 2021 20:48:30 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D564D28059; Tue, 2 Mar 2021 20:48:29 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9A8BE28065; Tue, 2 Mar 2021 20:48:29 +0000 (GMT) Received: from amdrome1.watson.ibm.com (unknown [9.2.130.16]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 2 Mar 2021 20:48:29 +0000 (GMT) From: Dov Murik To: qemu-devel@nongnu.org Subject: [RFC PATCH 06/26] hw/acpi: Don't include auxiliary vcpus in ACPI tables Date: Tue, 2 Mar 2021 15:48:02 -0500 Message-Id: <20210302204822.81901-7-dovmurik@linux.vnet.ibm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210302204822.81901-1-dovmurik@linux.vnet.ibm.com> References: <20210302204822.81901-1-dovmurik@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-02_08:2021-03-01, 2021-03-02 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=860 clxscore=1015 mlxscore=0 malwarescore=0 adultscore=0 impostorscore=0 spamscore=0 bulkscore=0 phishscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103020156 Received-SPF: none client-ip=148.163.156.1; envelope-from=dovmurik@linux.vnet.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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: Tom Lendacky , Ashish Kalra , Brijesh Singh , Eduardo Habkost , "Michael S. Tsirkin" , Richard Henderson , James Bottomley , Jon Grimm , Tobin Feldman-Fitzthum , Dov Murik , Hubertus Franke , Tobin Feldman-Fitzthum , Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Tobin Feldman-Fitzthum By excluding auxiliary vcpus from the ACPI tables, we hide them from the guest OS. This in turn allows OVMF to execute code on the auxiliary vcpus in parallel to the OS. Signed-off-by: Tobin Feldman-Fitzthum Signed-off-by: Dov Murik --- hw/acpi/cpu.c | 10 ++++++++++ hw/i386/acpi-build.c | 5 +++++ hw/i386/acpi-common.c | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c index e2317be546..d3f0a48da9 100644 --- a/hw/acpi/cpu.c +++ b/hw/acpi/cpu.c @@ -436,6 +436,11 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, method = aml_method(CPU_NOTIFY_METHOD, 2, AML_NOTSERIALIZED); for (i = 0; i < arch_ids->len; i++) { + if (arch_ids->cpus[i].aux) { + /* don't build objects for auxiliary CPUs */ + continue; + } + Aml *cpu = aml_name(CPU_NAME_FMT, i); Aml *uid = aml_arg(0); Aml *event = aml_arg(1); @@ -651,6 +656,11 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, /* build Processor object for each processor */ for (i = 0; i < arch_ids->len; i++) { + if (arch_ids->cpus[i].aux) { + /* don't build objects for auxiliary CPUs */ + continue; + } + Aml *dev; Aml *uid = aml_int(i); GArray *madt_buf = g_array_new(0, 1, 1); diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index b9190b924a..8cc7e2af3a 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1708,6 +1708,11 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine) srat->reserved1 = cpu_to_le32(1); for (i = 0; i < apic_ids->len; i++) { + if (apic_ids->cpus[i].aux) { + /* don't build objects for auxiliary CPUs */ + continue; + } + int node_id = apic_ids->cpus[i].props.node_id; uint32_t apic_id = apic_ids->cpus[i].arch_id; diff --git a/hw/i386/acpi-common.c b/hw/i386/acpi-common.c index 1f5947fcf9..7c73f3900b 100644 --- a/hw/i386/acpi-common.c +++ b/hw/i386/acpi-common.c @@ -91,6 +91,11 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker, madt->flags = cpu_to_le32(1); for (i = 0; i < apic_ids->len; i++) { + if (apic_ids->cpus[i].aux) { + /* don't build objects for auxiliary CPUs */ + continue; + } + adevc->madt_cpu(adev, i, apic_ids, table_data); if (apic_ids->cpus[i].arch_id > 254) { x2apic_mode = true;