From patchwork Wed Sep 13 04:52:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 9951065 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5B4D9603F4 for ; Wed, 13 Sep 2017 11:02:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E01A28655 for ; Wed, 13 Sep 2017 11:02:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 42EEC28DD1; Wed, 13 Sep 2017 11:02:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E40D22866F for ; Wed, 13 Sep 2017 11:02:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ds5Oq-0003uK-0x; Wed, 13 Sep 2017 11:00:08 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ds5Op-0003tm-2O for xen-devel@lists.xen.org; Wed, 13 Sep 2017 11:00:07 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id 9D/25-02226-6BF09B95; Wed, 13 Sep 2017 11:00:06 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRWlGSWpSXmKPExsXS1tYhoruVf2e kwdOdxhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8abrecZC/pFK5Zu9m9gPMHfxcjFISQwjVFi 3oxFbF2MnBwSArwSR5bNYIWw/SW2t7YyQRR1MEqs3jYdLMEmoC5xYvFERhBbREBa4trny4wgR cwC6xglGtr+soAkhAW8JaZv7QSzWQRUJfZs3AbWwCvgInFsURsjxAYFiSkP3zOD2JwCrhIdb9 6A1QsB1Xyb+pBpAiPvAkaGVYwaxalFZalFukbGeklFmekZJbmJmTm6hgbGermpxcWJ6ak5iUn Fesn5uZsYgQFRz8DAuIOxb6/fIUZJDiYlUd79e3ZECvEl5adUZiQWZ8QXleakFh9ilOHgUJLg ncy3M1JIsCg1PbUiLTMHGJowaQkOHiUR3mUgad7igsTc4sx0iNQpRl2Ojpt3/zAJseTl56VKi fPagxQJgBRllObBjYDFySVGWSlhXkYGBgYhnoLUotzMElT5V4ziHIxKwrxZIFN4MvNK4Da9Aj qCCeiIM6d3gBxRkoiQkmpgzFHIb7dQqArJyTnc+sFR2fD5q/eN/Om5d80slG6e/r5V4UeeyM/ kGTsFH1z4zqhxMls9et/u0xbbRKzjfnIEGYV3XyudXmnR3hB09WpEUJhjccSHpte8/EYs3EE1 L+Qb0/njCuM+38zba6i4WX+Hrc/EpVP2vGZ4dzkmmvVq0YFkj8+BWRxKLMUZiYZazEXFiQDDR qMxjgIAAA== X-Env-Sender: tianyu.lan@intel.com X-Msg-Ref: server-14.tower-31.messagelabs.com!1505300403!114414589!1 X-Originating-IP: [134.134.136.20] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTM0LjEzNC4xMzYuMjAgPT4gMzU1MzU4\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32016 invoked from network); 13 Sep 2017 11:00:05 -0000 Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by server-14.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 13 Sep 2017 11:00:05 -0000 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Sep 2017 03:59:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,387,1500966000"; d="scan'208";a="148671230" Received: from sky-ws.sh.intel.com (HELO localhost) ([10.239.48.141]) by orsmga005.jf.intel.com with ESMTP; 13 Sep 2017 03:59:55 -0700 From: Lan Tianyu To: xen-devel@lists.xen.org Date: Wed, 13 Sep 2017 00:52:48 -0400 Message-Id: <1505278369-21605-3-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1505278369-21605-1-git-send-email-tianyu.lan@intel.com> References: <1505278369-21605-1-git-send-email-tianyu.lan@intel.com> Cc: Lan Tianyu , kevin.tian@intel.com, wei.liu2@citrix.com, ian.jackson@eu.citrix.com, jbeulich@suse.com, roger.pau@citrix.com, chao.gao@intel.com Subject: [Xen-devel] [RFC PATCH V3 2/3] Tool/ACPI: DSDT extension to support more vcpus X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch is to change DSDT table for processor object to support >128 vcpus accroding to ACPI spec 8.4 Declaring Processors Signed-off-by: Lan Tianyu --- tools/libacpi/mk_dsdt.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c index 2daf32c..09c1529 100644 --- a/tools/libacpi/mk_dsdt.c +++ b/tools/libacpi/mk_dsdt.c @@ -24,6 +24,8 @@ #include #endif +#define CPU_NAME_FMT "P%.03X" + static unsigned int indent_level; static bool debug = false; @@ -196,10 +198,27 @@ int main(int argc, char **argv) /* Define processor objects and control methods. */ for ( cpu = 0; cpu < max_cpus; cpu++) { - push_block("Processor", "PR%02X, %d, 0x0000b010, 0x06", cpu, cpu); - stmt("Name", "_HID, \"ACPI0007\""); +#ifdef CONFIG_X86 + unsigned int apic_id = cpu * 2; + + if ( apic_id > 254 ) + { + push_block("Device", CPU_NAME_FMT, cpu); + } + else +#endif + { + if (cpu > 255) + { + fprintf(stderr, "Exceed the range of processor ID \n"); + return -1; + } + push_block("Processor", CPU_NAME_FMT ", %d,0x0000b010, 0x06", + cpu, cpu); + } + stmt("Name", "_HID, \"ACPI0007\""); stmt("Name", "_UID, %d", cpu); #ifdef CONFIG_ARM_64 pop_block(); @@ -268,15 +287,15 @@ int main(int argc, char **argv) /* Extract current CPU's status: 0=offline; 1=online. */ stmt("And", "Local1, 1, Local2"); /* Check if status is up-to-date in the relevant MADT LAPIC entry... */ - push_block("If", "LNotEqual(Local2, \\_SB.PR%02X.FLG)", cpu); + push_block("If", "LNotEqual(Local2, \\_SB." CPU_NAME_FMT ".FLG)", cpu); /* ...If not, update it and the MADT checksum, and notify OSPM. */ - stmt("Store", "Local2, \\_SB.PR%02X.FLG", cpu); + stmt("Store", "Local2, \\_SB." CPU_NAME_FMT ".FLG", cpu); push_block("If", "LEqual(Local2, 1)"); - stmt("Notify", "PR%02X, 1", cpu); /* Notify: Device Check */ + stmt("Notify", CPU_NAME_FMT ", 1", cpu); /* Notify: Device Check */ stmt("Subtract", "\\_SB.MSU, 1, \\_SB.MSU"); /* Adjust MADT csum */ pop_block(); push_block("Else", NULL); - stmt("Notify", "PR%02X, 3", cpu); /* Notify: Eject Request */ + stmt("Notify", CPU_NAME_FMT ", 3", cpu); /* Notify: Eject Request */ stmt("Add", "\\_SB.MSU, 1, \\_SB.MSU"); /* Adjust MADT csum */ pop_block(); pop_block();