From patchwork Fri Sep 6 19:12:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 1159189 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="CEoNzp9K"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 46Q6sV3t7Hz9sDB for ; Sat, 7 Sep 2019 05:23:10 +1000 (AEST) Received: from localhost ([::1]:59620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i6Jp5-0004fO-RA for incoming@patchwork.ozlabs.org; Fri, 06 Sep 2019 15:23:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42472) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i6Jf9-000380-T2 for qemu-devel@nongnu.org; Fri, 06 Sep 2019 15:12:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i6Jf8-0004M2-Nq for qemu-devel@nongnu.org; Fri, 06 Sep 2019 15:12:51 -0400 Received: from mail-eopbgr750082.outbound.protection.outlook.com ([40.107.75.82]:59016 helo=NAM02-BL2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i6Jf8-0004LZ-IS for qemu-devel@nongnu.org; Fri, 06 Sep 2019 15:12:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LbzxCXQqmWBSPb/fG/dVZqkuzF6axRtnMi632zqB48HEJImSEhmy3U6vAcagsygUFuwQAB6iKiexbcvDocwurnP+9U4z8NLLobjWH0ZZkBPJDIRCsb8QqpEmgHKMuAyaTM2u2iOYBjZaD9LOdGRwmd/r0WwHL9sUjcJ3PlPqZ/jrXwBELMcMO/6D11rFkOajYduTA/rWIfKrLNGKPuVghwvLGhitESaGO/He0muTM0teDKFqea+sur4C8yGDQ4ThZ7hbKmm2C9wtxRCMgqgk3xWHaeqeXOO6weY12dLYXY6D5m5myrTjuJcnLc7bIRFZit4lIjdt+408mHLbnyz+0g== 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=DxsJhqLR+BfQ+IqEOrYydyQCvANIoJcfhC7kDyB/VLY=; b=j49pNs0rphfSByLhUNVqx4t62mcgZX2S6t++V3+2HuDENvdrktXmCuH1UhBnRdSqe3s25r5c1ioxGDXSnInnzsqPh1iFSVbeyng8FYNPWux/U7Ta9gW6QXqcBdg7kSBeB/zf+KS0L71rTttHgNVQaKJ4s24VV7ueS4mawPWGeGmpLRREXMZDP8jUMVghXkqNNSmGMIdQ/oAlmaw+6nseic8MuQr6onIQGjqccxwjQZgF+RjBOBSGbUESXd/RoRSa+kNKsgoI80dc4dD96tmkeeG55hQxMkPTqpEUBxkoFpQrgOjnfVIPGrd21idCmkgPCCJAtnu/60MfUvqD/Lvc0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DxsJhqLR+BfQ+IqEOrYydyQCvANIoJcfhC7kDyB/VLY=; b=CEoNzp9KNuLn0DppWHA0vlDzMJaMGu39q/cRVDamq4XrC37wVF7Jke14AZCeIvqAIluE5CRWBOYqrfXb5TFY2HNsFp78pzMU4txnpb7AOi7V6PQhJh2ZFJRlxbseMS3hUgrgM5UjNXLlI7UHUuNmZZF5XcnocF8dz+IAcxM42B0= Received: from DM5PR12MB2471.namprd12.prod.outlook.com (52.132.141.138) by DM5PR12MB1145.namprd12.prod.outlook.com (10.168.238.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2241.14; Fri, 6 Sep 2019 19:12:48 +0000 Received: from DM5PR12MB2471.namprd12.prod.outlook.com ([fe80::6c7c:4b6d:f136:1bf8]) by DM5PR12MB2471.namprd12.prod.outlook.com ([fe80::6c7c:4b6d:f136:1bf8%3]) with mapi id 15.20.2220.022; Fri, 6 Sep 2019 19:12:48 +0000 From: "Moger, Babu" To: ssg.sos.staff , "ehabkost@redhat.com" , "marcel.apfelbaum@gmail.com" , "mst@redhat.com" , "pbonzini@redhat.com" , "rth@twiddle.net" , "eblake@redhat.com" , "armbru@redhat.com" , "imammedo@redhat.com" Thread-Topic: [RFC 2 PATCH 10/16] hw/i386: Introduce apicid_from_cpu_idx in PCMachineState Thread-Index: AQHVZOcSApWPC/FakEeb0y+1mx+yAw== Date: Fri, 6 Sep 2019 19:12:48 +0000 Message-ID: <156779716561.21957.7845498562538992402.stgit@localhost.localdomain> References: <156779689013.21957.1631551572950676212.stgit@localhost.localdomain> In-Reply-To: <156779689013.21957.1631551572950676212.stgit@localhost.localdomain> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN4PR0601CA0020.namprd06.prod.outlook.com (2603:10b6:803:2f::30) To DM5PR12MB2471.namprd12.prod.outlook.com (2603:10b6:4:b5::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.204.78.1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b079fc1a-0f2b-4734-367d-08d732fe33ee x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:DM5PR12MB1145; x-ms-traffictypediagnostic: DM5PR12MB1145: x-ld-processed: 3dd8961f-e488-4e60-8e11-a82d994e183d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 0152EBA40F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(396003)(366004)(39860400002)(136003)(346002)(199004)(189003)(2201001)(71190400001)(305945005)(7736002)(9686003)(52116002)(86362001)(71200400001)(6116002)(8936002)(6512007)(3846002)(6436002)(11346002)(103116003)(99286004)(6506007)(6486002)(26005)(4326008)(14454004)(5660300002)(386003)(476003)(102836004)(2906002)(25786009)(76176011)(2501003)(53936002)(8676002)(66446008)(446003)(186003)(66556008)(486006)(66946007)(66476007)(64756008)(110136005)(81166006)(81156014)(478600001)(14444005)(66066001)(256004)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1145; H:DM5PR12MB2471.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 2qKJHO0Or4hk7upgUBqQkr1SVP9IuLgjBOsdujBhI4PTynTNUs4weEWsWwga8tudzvypN7rlOn7iW1/W7g4gUACTBIombwaVepDDwUyqobBTU9GMNKiSMSyF8CTokR9y3Kv6UQLDKtKMzbM3/QtSnqB6wXwdoGDIqDCuePca687TL8vxuZGN+sb0E8JlN5s2EDvyj0SESAg01WKNwneZR5gftXW5Gvw56FdKPS6T9zj/jPbRpxWKW7NNycmPs9KvVAY4ILk7aoo7+L8r34n4x+bn+XVumcjidYDZJG2il+PvRThIoDDHcPncyCRBaHUQLxl96VGWuV5jP1DQLiAH5U5duOZrCPWarWxieKTJ3x/8lZxlg81bk+MEVMqeASQB4TO6hCZLqWZ+ttPYc6777tRSSYslYk2p0xdvXlob2r8= Content-ID: <2205F9627BE0F9409A6F5DEF4D240172@namprd12.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b079fc1a-0f2b-4734-367d-08d732fe33ee X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Sep 2019 19:12:48.4128 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: HjFmlwqHx1wgfSGSTPmPHSweZdBxRYPzs15oFh9SsQd08I9mUvQkKj/YZ650kNE+ X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1145 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.75.82 Subject: [Qemu-devel] [RFC 2 PATCH 10/16] hw/i386: Introduce apicid_from_cpu_idx in PCMachineState 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: "qemu-devel@nongnu.org" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add function pointers in PCMachineState to handle apic id specific functionalities. This will be used to initialize with correct handlers based on mode selected. x86_apicid_from_cpu_idx will be default handler. Signed-off-by: Babu Moger --- hw/i386/pc.c | 5 ++++- include/hw/i386/pc.h | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 504e1ab083..69a6b82186 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -947,7 +947,7 @@ static uint32_t x86_cpu_apic_id_from_index(PCMachineState *pcms, initialize_topo_info(&topo_info, pcms, ms); - correct_id = x86_apicid_from_cpu_idx(&topo_info, cpu_index); + correct_id = pcms->apicid_from_cpu_idx(&topo_info, cpu_index); if (pcmc->compat_apic_id_mode) { if (cpu_index != correct_id && !warned && !qtest_enabled()) { error_report("APIC IDs set in compatibility mode, " @@ -2828,6 +2828,9 @@ static void pc_machine_initfn(Object *obj) pcms->pit_enabled = true; pcms->smp_dies = 1; + /* Initialize the apic id related handlers */ + pcms->apicid_from_cpu_idx = x86_apicid_from_cpu_idx; + pc_system_flash_create(pcms); } diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 859b64c51d..6cefefdd57 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -17,6 +17,7 @@ #include "hw/mem/pc-dimm.h" #include "hw/mem/nvdimm.h" #include "hw/acpi/acpi_dev_interface.h" +#include "hw/i386/topology.h" #define HPET_INTCAP "hpet-intcap" @@ -66,6 +67,9 @@ struct PCMachineState { uint64_t numa_nodes; uint64_t *node_mem; + /* Apic id specific handlers */ + uint32_t (*apicid_from_cpu_idx)(X86CPUTopoInfo *topo_info, unsigned cpu_index); + /* Address space used by IOAPIC device. All IOAPIC interrupts * will be translated to MSI messages in the address space. */ AddressSpace *ioapic_as;